Merge pull request #455 from N1Ran/master

Some fixes.
This commit is contained in:
Bishbash777
2021-09-03 16:54:54 +01:00
committed by GitHub
2 changed files with 14 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ using Torch.Server.Managers;
using Torch.Server.ViewModels;
using Torch.Views;
using VRage.Game.ModAPI;
using VRage.Serialization;
namespace Torch.Server.Views
{
@@ -143,6 +144,8 @@ namespace Torch.Server.Views
return;
}
if (w.Checkpoint.PromotedUsers == null)
w.Checkpoint.PromotedUsers = new SerializableDictionary<ulong, MyPromoteLevel>();
d.Edit(w.Checkpoint.PromotedUsers.Dictionary);
_instanceManager.DedicatedConfig.Administrators = w.Checkpoint.PromotedUsers.Dictionary.Where(k => k.Value >= MyPromoteLevel.Admin).Select(k => k.Key.ToString()).ToList();
}

View File

@@ -40,6 +40,7 @@ namespace Torch.Server.Views
private string PreviousSearchQuery = "";
private string _description = "Loading data from server, please wait..";
private static object _syncLock = new object();
public string CurrentDescription
{
get { return _description; }
@@ -55,18 +56,21 @@ namespace Torch.Server.Views
InitializeComponent();
var installedPlugins = pluginManager.Plugins;
BindingOperations.EnableCollectionSynchronization(Plugins,_syncLock);
Task.Run(async () =>
{
var res = await PluginQuery.Instance.QueryAll();
if (res == null)
return;
foreach (var item in res.Plugins.OrderBy(i => i.Name)) {
if (installedPlugins.Keys.Contains(Guid.Parse(item.ID)))
item.Installed = true;
Plugins.Add(item);
PluginsList.Dispatcher.Invoke(() => PluginsList.SelectedIndex = 0);
PluginsSource.Add(item);
lock (_syncLock)
{
if (installedPlugins.Keys.Contains(Guid.Parse(item.ID)))
item.Installed = true;
Plugins.Add(item);
PluginsList.Dispatcher.Invoke(() => PluginsList.SelectedIndex = 0);
PluginsSource.Add(item);
}
}
CurrentDescription = "Please select a plugin...";
});