From 479e4a64dcad4a5f10f193cac69333d5c5c9feab Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Fri, 17 Jun 2022 18:41:05 +1000 Subject: [PATCH] GameData Changes - when changing the gamedata files (add, delete, reload) it will reload all the gamedata files and repopulate the server managers. - updated the viewmodels to check for valid class names. --- src/ARKServerManager/ARKServerManager.csproj | 2 + src/ARKServerManager/Lib/GameData.cs | 21 +++++ .../Lib/Model/CraftingOverride.cs | 20 +++-- .../Lib/Model/PreventTransferOverride.cs | 10 +-- .../Lib/Model/StackSizeOverride.cs | 10 +-- .../Lib/Model/SupplyCrateOverride.cs | 30 +++++-- .../Lib/ViewModel/DinoSettingsList.cs | 8 -- .../Lib/ViewModel/EngramSettings.cs | 4 - .../Lib/ViewModel/GameDataFile.cs | 51 +++++++++++ .../Lib/ViewModel/GameDataFileList.cs | 12 +++ .../Lib/ViewModel/NPCSpawnSettings.cs | 20 +++-- .../Lib/ViewModel/SupplyCrateSettings.cs | 6 +- .../GlobalSettingsControl.xaml.cs | 15 +++- .../ServerSettingsControl.xaml.cs | 57 ++++++++----- src/ARKServerManager/VersionFeed.xml | 25 +++++- src/ARKServerManager/VersionFeedBeta.xml | 85 ++----------------- .../Windows/GameDataWindow.xaml.cs | 60 ++----------- .../Windows/MainWindow.xaml.cs | 7 ++ .../Windows/RCONWindow.xaml.cs | 9 +- .../Windows/SettingsWindow.xaml | 5 +- .../Windows/SettingsWindow.xaml.cs | 8 ++ .../ConanServerManager.csproj | 2 + src/ConanServerManager/Lib/GameData.cs | 21 +++++ .../Lib/ViewModel/GameDataFile.cs | 51 +++++++++++ .../Lib/ViewModel/GameDataFileList.cs | 12 +++ .../GlobalSettingsControl.xaml.cs | 14 ++- .../ServerSettingsControl.xaml.cs | 20 ++++- src/ConanServerManager/VersionFeed.xml | 25 +++++- src/ConanServerManager/VersionFeedBeta.xml | 35 ++------ .../Windows/GameDataWindow.xaml.cs | 60 ++----------- .../Windows/MainWindow.xaml.cs | 7 ++ .../Windows/RconWindow.xaml.cs | 9 +- .../Windows/SettingsWindow.xaml.cs | 11 +-- 33 files changed, 427 insertions(+), 305 deletions(-) create mode 100644 src/ARKServerManager/Lib/ViewModel/GameDataFile.cs create mode 100644 src/ARKServerManager/Lib/ViewModel/GameDataFileList.cs create mode 100644 src/ConanServerManager/Lib/ViewModel/GameDataFile.cs create mode 100644 src/ConanServerManager/Lib/ViewModel/GameDataFileList.cs diff --git a/src/ARKServerManager/ARKServerManager.csproj b/src/ARKServerManager/ARKServerManager.csproj index 5c2be6f8..d17c1431 100644 --- a/src/ARKServerManager/ARKServerManager.csproj +++ b/src/ARKServerManager/ARKServerManager.csproj @@ -252,6 +252,8 @@ + + diff --git a/src/ARKServerManager/Lib/GameData.cs b/src/ARKServerManager/Lib/GameData.cs index 3e7c01d9..252bcb08 100644 --- a/src/ARKServerManager/Lib/GameData.cs +++ b/src/ARKServerManager/Lib/GameData.cs @@ -17,6 +17,8 @@ namespace ServerManagerTool.Lib public const string RCONINPUTMODE_COMMAND = "Command"; + public static event EventHandler GameDataLoaded; + public static string MainDataFolder = Path.Combine(Environment.CurrentDirectory, Config.Default.GameDataDir); public static string UserDataFolder = Path.Combine(Config.Default.DataDir, Config.Default.GameDataDir); @@ -26,6 +28,12 @@ namespace ServerManagerTool.Lib private static MainGameData gameData = null; public static void Initialize() + { + Load(); + OnGameDataLoaded(); + } + + private static void Load() { // read static game data GameDataUtils.ReadAllData(out gameData, MainDataFolder, Config.Default.GameDataExtension, Config.Default.GameDataApplication); @@ -174,6 +182,19 @@ namespace ServerManagerTool.Lib } } + private static void OnGameDataLoaded() + { + GameDataLoaded?.Invoke(null, EventArgs.Empty); + } + + public static void Reload() + { + gameData = null; + + Load(); + OnGameDataLoaded(); + } + public static string FriendlyNameForClass(string className, bool returnNullIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? (returnNullIfNotFound ? null : string.Empty) : GlobalizedApplication.Instance.GetResourceString(className) ?? (returnNullIfNotFound ? null : className); #region Creatures diff --git a/src/ARKServerManager/Lib/Model/CraftingOverride.cs b/src/ARKServerManager/Lib/Model/CraftingOverride.cs index a24daf7c..82438fa2 100644 --- a/src/ARKServerManager/Lib/Model/CraftingOverride.cs +++ b/src/ARKServerManager/Lib/Model/CraftingOverride.cs @@ -26,10 +26,6 @@ namespace ServerManagerTool.Lib { } - public void UpdateForLocalization() - { - } - public void Update(bool recursive = true) { IsEnabled = this.Count > 0; @@ -118,7 +114,15 @@ namespace ServerManagerTool.Lib resource.Update(); } - ValidStatus = IsValid ? (BaseCraftingResourceRequirements.Any(i => i.ValidStatus == "N") ? "N" : (BaseCraftingResourceRequirements.Any(i => i.ValidStatus == "W") ? "W" : "Y")) : "N"; + ValidStatus = IsValid + ? (BaseCraftingResourceRequirements.Any(i => i.ValidStatus == "N") + ? "N" + : (BaseCraftingResourceRequirements.Any(i => i.ValidStatus == "W") + ? "W" + : (GameData.HasItemForClass(ItemClassString) + ? "Y" + : "W"))) + : "N"; } } @@ -186,7 +190,11 @@ namespace ServerManagerTool.Lib public void Update() { - ValidStatus = IsValid ? (GameData.HasItemForClass(ResourceItemTypeString) ? "Y" : "W") : "N"; + ValidStatus = IsValid + ? (GameData.HasItemForClass(ResourceItemTypeString) + ? "Y" + : "W") + : "N"; } } } diff --git a/src/ARKServerManager/Lib/Model/PreventTransferOverride.cs b/src/ARKServerManager/Lib/Model/PreventTransferOverride.cs index c24d416f..72d3d03b 100644 --- a/src/ARKServerManager/Lib/Model/PreventTransferOverride.cs +++ b/src/ARKServerManager/Lib/Model/PreventTransferOverride.cs @@ -25,10 +25,6 @@ namespace ServerManagerTool.Lib { } - public void UpdateForLocalization() - { - } - public void Update() { IsEnabled = this.Count > 0; @@ -98,7 +94,11 @@ namespace ServerManagerTool.Lib public void Update() { - ValidStatus = IsValid ? (GameData.HasCreatureForClass(DinoClassString) ? "Y" : "W") : "N"; + ValidStatus = IsValid + ? (GameData.HasCreatureForClass(DinoClassString) + ? "Y" + : "W") + : "N"; } } } diff --git a/src/ARKServerManager/Lib/Model/StackSizeOverride.cs b/src/ARKServerManager/Lib/Model/StackSizeOverride.cs index bea75121..f3fb3566 100644 --- a/src/ARKServerManager/Lib/Model/StackSizeOverride.cs +++ b/src/ARKServerManager/Lib/Model/StackSizeOverride.cs @@ -44,10 +44,6 @@ namespace ServerManagerTool.Lib } } - public void UpdateForLocalization() - { - } - public void Update() { IsEnabled = this.Count > 0; @@ -160,7 +156,11 @@ namespace ServerManagerTool.Lib public void Update() { - ValidStatus = IsValid ? (GameData.HasItemForClass(ItemClassString) ? "Y" : "W") : "N"; + ValidStatus = IsValid + ? (GameData.HasItemForClass(ItemClassString) + ? "Y" + : "W") + : "N"; } } diff --git a/src/ARKServerManager/Lib/Model/SupplyCrateOverride.cs b/src/ARKServerManager/Lib/Model/SupplyCrateOverride.cs index 82104834..80761f31 100644 --- a/src/ARKServerManager/Lib/Model/SupplyCrateOverride.cs +++ b/src/ARKServerManager/Lib/Model/SupplyCrateOverride.cs @@ -72,10 +72,6 @@ namespace ServerManagerTool.Lib } } - public void UpdateForLocalization() - { - } - public void Update(bool recursive = true) { IsEnabled = this.Count > 0; @@ -226,7 +222,15 @@ namespace ServerManagerTool.Lib itemSet.Update(recursive); } - ValidStatus = IsViewValid ? (ItemSets.Any(i => i.ValidStatus == "N") ? "N" : (ItemSets.Any(i => i.ValidStatus == "W") ? "W" : "Y")) : "N"; + ValidStatus = IsViewValid + ? (ItemSets.Any(i => i.ValidStatus == "N") + ? "N" + : (ItemSets.Any(i => i.ValidStatus == "W") + ? "W" + : (GameData.HasSupplyCrateForClass(SupplyCrateClassString) + ? "Y" + : "W"))) + : "N"; } } @@ -340,7 +344,13 @@ namespace ServerManagerTool.Lib itemEntry.Update(recursive); } - ValidStatus = IsViewValid ? (ItemEntries.Any(i => i.ValidStatus == "N") ? "N" : (ItemEntries.Any(i => i.ValidStatus == "W") ? "W" : "Y")) : "N"; + ValidStatus = IsViewValid + ? (ItemEntries.Any(i => i.ValidStatus == "N") + ? "N" + : (ItemEntries.Any(i => i.ValidStatus == "W") + ? "W" + : "Y")) + : "N"; } } @@ -495,7 +505,13 @@ namespace ServerManagerTool.Lib item.Update(); } - ValidStatus = IsViewValid ? (Items.Any(i => i.ValidStatus == "N") ? "N" : (Items.Any(i => i.ValidStatus == "W") ? "W" : "Y")) : "N"; + ValidStatus = IsViewValid + ? (Items.Any(i => i.ValidStatus == "N") + ? "N" + : (Items.Any(i => i.ValidStatus == "W") + ? "W" + : "Y")) + : "N"; } } } diff --git a/src/ARKServerManager/Lib/ViewModel/DinoSettingsList.cs b/src/ARKServerManager/Lib/ViewModel/DinoSettingsList.cs index 668dad8f..f6fb884d 100644 --- a/src/ARKServerManager/Lib/ViewModel/DinoSettingsList.cs +++ b/src/ARKServerManager/Lib/ViewModel/DinoSettingsList.cs @@ -317,13 +317,5 @@ namespace ServerManagerTool.Lib.ViewModel } } } - - public void UpdateForLocalization() - { - //foreach (var dinoSetting in this) - //{ - // dinoSetting.FriendlyName = GameData.FriendlyNameForClass(dinoSetting.ClassName); - //} - } } } diff --git a/src/ARKServerManager/Lib/ViewModel/EngramSettings.cs b/src/ARKServerManager/Lib/ViewModel/EngramSettings.cs index 56eca10d..2e8c7dfe 100644 --- a/src/ARKServerManager/Lib/ViewModel/EngramSettings.cs +++ b/src/ARKServerManager/Lib/ViewModel/EngramSettings.cs @@ -174,10 +174,6 @@ namespace ServerManagerTool.Lib.ViewModel } } - public void UpdateForLocalization() - { - } - #region INotifyPropertyChanged private Dictionary _properties = new Dictionary(); diff --git a/src/ARKServerManager/Lib/ViewModel/GameDataFile.cs b/src/ARKServerManager/Lib/ViewModel/GameDataFile.cs new file mode 100644 index 00000000..29951370 --- /dev/null +++ b/src/ARKServerManager/Lib/ViewModel/GameDataFile.cs @@ -0,0 +1,51 @@ +using System; +using System.Windows; + +namespace ServerManagerTool.Lib.ViewModel +{ + public class GameDataFile : DependencyObject + { + public static readonly DependencyProperty CreatedDateProperty = DependencyProperty.Register(nameof(CreatedDate), typeof(DateTime), typeof(GameDataFile), new PropertyMetadata(DateTime.MinValue)); + public static readonly DependencyProperty FileProperty = DependencyProperty.Register(nameof(File), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); + public static readonly DependencyProperty FileNameProperty = DependencyProperty.Register(nameof(FileName), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); + public static readonly DependencyProperty IsUserDataProperty = DependencyProperty.Register(nameof(IsUserData), typeof(bool), typeof(GameDataFile), new PropertyMetadata(true)); + public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(nameof(Version), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); + public static readonly DependencyProperty HasErrorProperty = DependencyProperty.Register(nameof(HasError), typeof(bool), typeof(GameDataFile), new PropertyMetadata(false)); + + public DateTime CreatedDate + { + get { return (DateTime)GetValue(CreatedDateProperty); } + set { SetValue(CreatedDateProperty, value); } + } + + public string File + { + get { return (string)GetValue(FileProperty); } + set { SetValue(FileProperty, value); } + } + + public string FileName + { + get { return (string)GetValue(FileNameProperty); } + set { SetValue(FileNameProperty, value); } + } + + public bool IsUserData + { + get { return (bool)GetValue(IsUserDataProperty); } + set { SetValue(IsUserDataProperty, value); } + } + + public string Version + { + get { return (string)GetValue(VersionProperty); } + set { SetValue(VersionProperty, value); } + } + + public bool HasError + { + get { return (bool)GetValue(HasErrorProperty); } + set { SetValue(HasErrorProperty, value); } + } + } +} diff --git a/src/ARKServerManager/Lib/ViewModel/GameDataFileList.cs b/src/ARKServerManager/Lib/ViewModel/GameDataFileList.cs new file mode 100644 index 00000000..13c68573 --- /dev/null +++ b/src/ARKServerManager/Lib/ViewModel/GameDataFileList.cs @@ -0,0 +1,12 @@ +using ServerManagerTool.Common.Model; + +namespace ServerManagerTool.Lib.ViewModel +{ + public class GameDataFileList : SortableObservableCollection + { + public override string ToString() + { + return $"{nameof(GameDataFile)} - {Count}"; + } + } +} diff --git a/src/ARKServerManager/Lib/ViewModel/NPCSpawnSettings.cs b/src/ARKServerManager/Lib/ViewModel/NPCSpawnSettings.cs index acdadecc..17525cc0 100644 --- a/src/ARKServerManager/Lib/ViewModel/NPCSpawnSettings.cs +++ b/src/ARKServerManager/Lib/ViewModel/NPCSpawnSettings.cs @@ -195,10 +195,6 @@ namespace ServerManagerTool.Lib.ViewModel } } - public void UpdateForLocalization() - { - } - public void Update(bool recursive = true) { foreach (var npcSpawn in this) @@ -307,7 +303,15 @@ namespace ServerManagerTool.Lib.ViewModel itemSet.Update(); } - ValidStatus = IsViewValid ? (NPCSpawnEntrySettings.Any(i => i.ValidStatus == "N") ? "N" : (NPCSpawnEntrySettings.Any(i => i.ValidStatus == "W") ? "W" : "Y")) : "N"; + ValidStatus = IsViewValid + ? (NPCSpawnEntrySettings.Any(i => i.ValidStatus == "N") + ? "N" + : (NPCSpawnEntrySettings.Any(i => i.ValidStatus == "W") + ? "W" + : (GameData.HasMapSpawnerForClass(NPCSpawnEntriesContainerClassString) + ? "Y" + : "W"))) + : "N"; } } @@ -354,7 +358,11 @@ namespace ServerManagerTool.Lib.ViewModel public void Update() { - ValidStatus = IsValid ? (GameData.HasCreatureForClass(NPCClassString) ? "Y" : "W") : "N"; + ValidStatus = IsValid + ? (GameData.HasCreatureForClass(NPCClassString) + ? "Y" + : "W") + : "N"; } } } diff --git a/src/ARKServerManager/Lib/ViewModel/SupplyCrateSettings.cs b/src/ARKServerManager/Lib/ViewModel/SupplyCrateSettings.cs index 07d81387..33508496 100644 --- a/src/ARKServerManager/Lib/ViewModel/SupplyCrateSettings.cs +++ b/src/ARKServerManager/Lib/ViewModel/SupplyCrateSettings.cs @@ -40,7 +40,11 @@ namespace ServerManagerTool.Lib.ViewModel public void Update() { - ValidStatus = IsViewValid ? (GameData.HasItemForClass(ItemClassString) ? "Y" : "W") : "N"; + ValidStatus = IsViewValid + ? (GameData.HasItemForClass(ItemClassString) + ? "Y" + : "W") + : "N"; } } } diff --git a/src/ARKServerManager/UserControls/GlobalSettingsControl.xaml.cs b/src/ARKServerManager/UserControls/GlobalSettingsControl.xaml.cs index 07409575..bbab1442 100644 --- a/src/ARKServerManager/UserControls/GlobalSettingsControl.xaml.cs +++ b/src/ARKServerManager/UserControls/GlobalSettingsControl.xaml.cs @@ -65,6 +65,8 @@ namespace ServerManagerTool } this.DataContext = this; + + GameData.GameDataLoaded += GameData_GameDataLoaded; } public App AppInstance @@ -396,15 +398,21 @@ namespace ServerManagerTool e.Handled = true; } + private void GameData_GameDataLoaded(object sender, EventArgs e) + { + PopulateRconMessageModesComboBox(); + } + private void LanguageSelectionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Config.CultureName = AvailableLanguages.Instance.SelectedLanguage; PopulateWindowsStatesMainWindowComboBox(); PopulateWindowsStatesServerMonitorWindowComboBox(); - PopulateRconMessageModesComboBox(); PopulateTaskPrioritiesComboBox(); + GameData_GameDataLoaded(sender, e); + App.Instance.OnResourceDictionaryChanged(Config.CultureName); } @@ -490,6 +498,11 @@ namespace ServerManagerTool } } + public void CloseControl() + { + GameData.GameDataLoaded -= GameData_GameDataLoaded; + } + private void PopulateWindowsStatesMainWindowComboBox() { var selectedValue = this.WindowStateMainWindowComboBox?.SelectedValue ?? Config.MainWindow_WindowState; diff --git a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs index 7a79815a..8127bbcc 100644 --- a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs +++ b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs @@ -342,9 +342,36 @@ namespace ServerManagerTool // hook into the language change event GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent += ResourceDictionaryChangedEvent; + GameData.GameDataLoaded += GameData_GameDataLoaded; } #region Event Methods + private void GameData_GameDataLoaded(object sender, EventArgs e) + { + this.RefreshBaseDinoModList(); + this.RefreshBaseEngramModList(); + this.RefreshBaseResourceModList(); + + this.RefreshBaseDinoList(); + this.RefreshBaseMapSpawnerList(); + this.RefreshBasePrimalItemList(); + this.RefreshBaseSupplyCrateList(); + this.RefreshBaseGameMapsList(); + this.RefreshBaseTotalConversionsList(); + this.RefreshBaseBranchesList(); + this.RefreshBaseEventsList(); + this.RefreshProcessPrioritiesList(); + this.RefreshCustomLevelProgressionsInformation(); + + this.HarvestResourceItemAmountClassMultipliersListBox.Items.Refresh(); + + this.Settings.ConfigOverrideItemCraftingCosts.Update(); + this.Settings.ConfigOverrideItemMaxQuantity.Update(); + this.Settings.ConfigOverrideSupplyCrateItems.Update(); + this.Settings.NPCSpawnSettings.Update(); + this.Settings.PreventTransferForClassNames.Update(); + } + private static void ServerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var ssc = (ServerSettingsControl)d; @@ -378,30 +405,8 @@ namespace ServerManagerTool { this.CurrentCulture = Thread.CurrentThread.CurrentCulture; - this.Settings.DinoSettings.UpdateForLocalization(); - this.Settings.EngramSettings.UpdateForLocalization(); - this.Settings.NPCSpawnSettings.UpdateForLocalization(); - this.Settings.ConfigOverrideSupplyCrateItems.UpdateForLocalization(); - this.Settings.ConfigOverrideItemMaxQuantity.UpdateForLocalization(); - - this.RefreshBaseDinoModList(); - this.RefreshBaseEngramModList(); - this.RefreshBaseResourceModList(); - - this.RefreshBaseDinoList(); - this.RefreshBaseMapSpawnerList(); - this.RefreshBasePrimalItemList(); - this.RefreshBaseSupplyCrateList(); - this.RefreshBaseGameMapsList(); - this.RefreshBaseTotalConversionsList(); - this.RefreshBaseBranchesList(); - this.RefreshBaseEventsList(); - this.RefreshProcessPrioritiesList(); - - this.HarvestResourceItemAmountClassMultipliersListBox.Items.Refresh(); - - this.RefreshCustomLevelProgressionsInformation(); this.UpdateLastStartedDetails(false); + GameData_GameDataLoaded(source, e); Runtime.UpdateServerStatusString(); } @@ -3487,6 +3492,12 @@ namespace ServerManagerTool #endregion #region Methods + public void CloseControl() + { + GameData.GameDataLoaded -= GameData_GameDataLoaded; + GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent -= ResourceDictionaryChangedEvent; + } + public void RefreshBaseDinoModList() { var selectedValue = SelectedModDino; diff --git a/src/ARKServerManager/VersionFeed.xml b/src/ARKServerManager/VersionFeed.xml index 293bbdbe..0b2b7789 100644 --- a/src/ARKServerManager/VersionFeed.xml +++ b/src/ARKServerManager/VersionFeed.xml @@ -5,7 +5,30 @@ Ark Server Manager Version Feed This is the Ark Server Manager release version feed. - 2022-06-16T00:00:00Z + 2022-06-17T00:00:00Z + + + urn:uuid:1AE0925B-64EB-4177-B834-7A75FA46E807 + 1.1.433 (1.1.433.1) + 1.1.433.1 + + 2022-06-17T00:00:00Z + +
+

+ CHANGE +
+

    +
  • Gamedata Files - when adding, deleteing or reloading the gamedata files via the gamedata window, the server manager will reload them and update the settings window.
  • +
+

+
+
+ + bletch + bletch1971@hotmail.com + +
urn:uuid:93A04A12-C632-4C2B-AC76-42D9E476431C diff --git a/src/ARKServerManager/VersionFeedBeta.xml b/src/ARKServerManager/VersionFeedBeta.xml index d81948c4..29239e89 100644 --- a/src/ARKServerManager/VersionFeedBeta.xml +++ b/src/ARKServerManager/VersionFeedBeta.xml @@ -5,94 +5,21 @@ Ark Server Manager Version Feed This is the Ark Server Manager beta version feed. - 2022-06-16T00:00:00Z + 2022-06-17T00:00:00Z - urn:uuid:DB240E90-17B0-4DE1-B60B-0D5E4753810F - 1.1.432 (1.1.432.4) - 1.1.432.4 + urn:uuid:1AE0925B-64EB-4177-B834-7A75FA46E807 + 1.1.433 (1.1.433.1) + 1.1.433.1 - 2022-06-16T00:00:00Z - -
-

- NEW -
-

    -
  • Profile Settings - Rules Section - Added UseFjordurTraversalBuff setting. Located in the Fjordur group at the bottom of the Rules section.
  • -
-

-
-
- - bletch - bletch1971@hotmail.com - -
- - - urn:uuid:EB7309A6-5E1F-4F97-A813-CDCFC51A9A7C - 1.1.432 (1.1.432.3) - 1.1.432.3 - - 2022-06-16T00:00:00Z + 2022-06-17T00:00:00Z

CHANGE

    -
  • Crafting Override Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for items not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing items.
  • -
  • Prevent Transfer Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for creatures not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing creatures.
  • -
  • Map Spawner Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for spawners/creatures not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing spawners/creatures.
  • -
  • Stack Size Grid - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for items not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing items.
  • -
  • Server Monitor - added shutdown reason.
  • -
-

-
-
- - bletch - bletch1971@hotmail.com - -
- - - urn:uuid:93A04A12-C632-4C2B-AC76-42D9E476431C - 1.1.432 (1.1.432.2) - 1.1.432.2 - - 2022-06-16T00:00:00Z - -
-

- CHANGE -
-

    -
  • Gamedata Files - changed the Fjordur official mod to the correct mod id.
  • -
-

-
-
- - bletch - bletch1971@hotmail.com - -
- - - urn:uuid:93A04A12-C632-4C2B-AC76-42D9E476431C - 1.1.432 (1.1.432.1) - 1.1.432.1 - - 2022-06-16T00:00:00Z - -
-

- NEW -
-

    -
  • Reset Server - added new button to reset your server. This will delete all server, player and tribe files and reset your server back to new.
  • +
  • Gamedata Files - when adding, deleteing or reloading the gamedata files via the gamedata window, the server manager will reload them and update the settings window.

diff --git a/src/ARKServerManager/Windows/GameDataWindow.xaml.cs b/src/ARKServerManager/Windows/GameDataWindow.xaml.cs index f0f46328..a27ecd85 100644 --- a/src/ARKServerManager/Windows/GameDataWindow.xaml.cs +++ b/src/ARKServerManager/Windows/GameDataWindow.xaml.cs @@ -1,7 +1,7 @@ using Microsoft.WindowsAPICodePack.Dialogs; -using ServerManagerTool.Common.Model; using ServerManagerTool.Common.Utils; using ServerManagerTool.Lib; +using ServerManagerTool.Lib.ViewModel; using ServerManagerTool.Utils; using System; using System.Collections.Generic; @@ -19,60 +19,6 @@ namespace ServerManagerTool /// public partial class GameDataWindow : Window { - public class GameDataFileList : SortableObservableCollection - { - public override string ToString() - { - return $"{nameof(GameDataFile)} - {Count}"; - } - } - - public class GameDataFile : DependencyObject - { - public static readonly DependencyProperty CreatedDateProperty = DependencyProperty.Register(nameof(CreatedDate), typeof(DateTime), typeof(GameDataFile), new PropertyMetadata(DateTime.MinValue)); - public static readonly DependencyProperty FileProperty = DependencyProperty.Register(nameof(File), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); - public static readonly DependencyProperty FileNameProperty = DependencyProperty.Register(nameof(FileName), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); - public static readonly DependencyProperty IsUserDataProperty = DependencyProperty.Register(nameof(IsUserData), typeof(bool), typeof(GameDataFile), new PropertyMetadata(true)); - public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(nameof(Version), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); - public static readonly DependencyProperty HasErrorProperty = DependencyProperty.Register(nameof(HasError), typeof(bool), typeof(GameDataFile), new PropertyMetadata(false)); - - public DateTime CreatedDate - { - get { return (DateTime)GetValue(CreatedDateProperty); } - set { SetValue(CreatedDateProperty, value); } - } - - public string File - { - get { return (string)GetValue(FileProperty); } - set { SetValue(FileProperty, value); } - } - - public string FileName - { - get { return (string)GetValue(FileNameProperty); } - set { SetValue(FileNameProperty, value); } - } - - public bool IsUserData - { - get { return (bool)GetValue(IsUserDataProperty); } - set { SetValue(IsUserDataProperty, value); } - } - - public string Version - { - get { return (string)GetValue(VersionProperty); } - set { SetValue(VersionProperty, value); } - } - - public bool HasError - { - get { return (bool)GetValue(HasErrorProperty); } - set { SetValue(HasErrorProperty, value); } - } - } - private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance; public static readonly DependencyProperty GameDataFilesProperty = DependencyProperty.Register(nameof(GameDataFiles), typeof(GameDataFileList), typeof(GameDataWindow), new PropertyMetadata(null)); @@ -117,6 +63,7 @@ namespace ServerManagerTool try { AddGameDataFile(GameData.UserDataFolder, dialog.FileName); + GameData.Reload(); } catch (Exception ex) { @@ -135,6 +82,7 @@ namespace ServerManagerTool { DeleteAllGameDataFiles(GameData.UserDataFolder); } + GameData.Reload(); } catch (Exception ex) { @@ -166,6 +114,7 @@ namespace ServerManagerTool try { ReloadGameDataFiles(); + GameData.Reload(); } catch (Exception ex) { @@ -182,6 +131,7 @@ namespace ServerManagerTool { var gameDataItem = ((GameDataFile)((Button)e.Source).DataContext); DeleteGameDataFile(gameDataItem.File, true); + GameData.Reload(); } catch (Exception ex) { diff --git a/src/ARKServerManager/Windows/MainWindow.xaml.cs b/src/ARKServerManager/Windows/MainWindow.xaml.cs index 56dd84f5..d8b09181 100644 --- a/src/ARKServerManager/Windows/MainWindow.xaml.cs +++ b/src/ARKServerManager/Windows/MainWindow.xaml.cs @@ -246,6 +246,13 @@ namespace ServerManagerTool this.Activate(); } + protected override void OnClosed(EventArgs e) + { + GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent -= ResourceDictionaryChangedEvent; + + base.OnClosed(e); + } + protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { if (DiscordBotHelper.HasRunningCommands) diff --git a/src/ARKServerManager/Windows/RCONWindow.xaml.cs b/src/ARKServerManager/Windows/RCONWindow.xaml.cs index 405d370d..8939ef6d 100644 --- a/src/ARKServerManager/Windows/RCONWindow.xaml.cs +++ b/src/ARKServerManager/Windows/RCONWindow.xaml.cs @@ -245,6 +245,7 @@ namespace ServerManagerTool // hook into the language change event GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent += ResourceDictionaryChangedEvent; + GameData.GameDataLoaded += GameData_GameDataLoaded; } #region Properties @@ -684,13 +685,19 @@ namespace ServerManagerTool return new RCONWindow(parameters); } - private void ResourceDictionaryChangedEvent(object source, ResourceDictionaryChangedEventArgs e) + private void GameData_GameDataLoaded(object sender, EventArgs e) { PopulateRconInputModesComboBox(); } + private void ResourceDictionaryChangedEvent(object source, ResourceDictionaryChangedEventArgs e) + { + GameData_GameDataLoaded(source, e); + } + protected override void OnClosed(EventArgs e) { + GameData.GameDataLoaded -= GameData_GameDataLoaded; GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent -= ResourceDictionaryChangedEvent; if (this.RCONParameters?.Server?.Runtime != null) diff --git a/src/ARKServerManager/Windows/SettingsWindow.xaml b/src/ARKServerManager/Windows/SettingsWindow.xaml index f2826aa5..e133195d 100644 --- a/src/ARKServerManager/Windows/SettingsWindow.xaml +++ b/src/ARKServerManager/Windows/SettingsWindow.xaml @@ -3,9 +3,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:local="clr-namespace:ServerManagerTool" + xmlns:sm="clr-namespace:ServerManagerTool" mc:Ignorable="d" MinWidth="800" MinHeight="600" Width="800" Height="700" ResizeMode="CanResizeWithGrip" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" + Closing="SettingsWindow_Closing" Icon="../Art/favicon.ico" Title="{DynamicResource Settings_Title}" > @@ -16,6 +17,6 @@ - + diff --git a/src/ARKServerManager/Windows/SettingsWindow.xaml.cs b/src/ARKServerManager/Windows/SettingsWindow.xaml.cs index a5d07092..70b3318f 100644 --- a/src/ARKServerManager/Windows/SettingsWindow.xaml.cs +++ b/src/ARKServerManager/Windows/SettingsWindow.xaml.cs @@ -1,5 +1,6 @@ using ServerManagerTool.Common.Utils; using System; +using System.ComponentModel; using System.IO; using System.Reflection; using System.Windows; @@ -20,8 +21,15 @@ namespace ServerManagerTool WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile); } + private void SettingsWindow_Closing(object sender, CancelEventArgs e) + { + if (!globalSettingsControl.IsEnabled) + e.Cancel = true; + } + protected override void OnClosed(EventArgs e) { + globalSettingsControl.CloseControl(); globalSettingsControl.ApplyChangesToConfig(); if (SecurityUtils.IsAdministrator()) diff --git a/src/ConanServerManager/ConanServerManager.csproj b/src/ConanServerManager/ConanServerManager.csproj index 8ec0afaf..34913ede 100644 --- a/src/ConanServerManager/ConanServerManager.csproj +++ b/src/ConanServerManager/ConanServerManager.csproj @@ -212,6 +212,8 @@ + + diff --git a/src/ConanServerManager/Lib/GameData.cs b/src/ConanServerManager/Lib/GameData.cs index 1c5d8c5c..5273f852 100644 --- a/src/ConanServerManager/Lib/GameData.cs +++ b/src/ConanServerManager/Lib/GameData.cs @@ -12,12 +12,20 @@ namespace ServerManagerTool.Lib { public const string RCONINPUTMODE_COMMAND = "Command"; + public static event EventHandler GameDataLoaded; + public static string MainDataFolder = Path.Combine(Environment.CurrentDirectory, Config.Default.GameDataRelativePath); public static string UserDataFolder = Path.Combine(Config.Default.DataPath, Config.Default.GameDataRelativePath); private static MainGameData gameData = null; public static void Initialize() + { + Load(); + OnGameDataLoaded(); + } + + private static void Load() { // read static game data GameDataUtils.ReadAllData(out gameData, MainDataFolder, Config.Default.GameDataExtension, Config.Default.GameDataApplication); @@ -74,6 +82,19 @@ namespace ServerManagerTool.Lib } } + private static void OnGameDataLoaded() + { + GameDataLoaded?.Invoke(null, EventArgs.Empty); + } + + public static void Reload() + { + gameData = null; + + Load(); + OnGameDataLoaded(); + } + public static string FriendlyNameForClass(string className, bool returnNullIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? (returnNullIfNotFound ? null : string.Empty) : GlobalizedApplication.Instance.GetResourceString(className) ?? (returnNullIfNotFound ? null : className); #region Game Maps diff --git a/src/ConanServerManager/Lib/ViewModel/GameDataFile.cs b/src/ConanServerManager/Lib/ViewModel/GameDataFile.cs new file mode 100644 index 00000000..29951370 --- /dev/null +++ b/src/ConanServerManager/Lib/ViewModel/GameDataFile.cs @@ -0,0 +1,51 @@ +using System; +using System.Windows; + +namespace ServerManagerTool.Lib.ViewModel +{ + public class GameDataFile : DependencyObject + { + public static readonly DependencyProperty CreatedDateProperty = DependencyProperty.Register(nameof(CreatedDate), typeof(DateTime), typeof(GameDataFile), new PropertyMetadata(DateTime.MinValue)); + public static readonly DependencyProperty FileProperty = DependencyProperty.Register(nameof(File), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); + public static readonly DependencyProperty FileNameProperty = DependencyProperty.Register(nameof(FileName), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); + public static readonly DependencyProperty IsUserDataProperty = DependencyProperty.Register(nameof(IsUserData), typeof(bool), typeof(GameDataFile), new PropertyMetadata(true)); + public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(nameof(Version), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); + public static readonly DependencyProperty HasErrorProperty = DependencyProperty.Register(nameof(HasError), typeof(bool), typeof(GameDataFile), new PropertyMetadata(false)); + + public DateTime CreatedDate + { + get { return (DateTime)GetValue(CreatedDateProperty); } + set { SetValue(CreatedDateProperty, value); } + } + + public string File + { + get { return (string)GetValue(FileProperty); } + set { SetValue(FileProperty, value); } + } + + public string FileName + { + get { return (string)GetValue(FileNameProperty); } + set { SetValue(FileNameProperty, value); } + } + + public bool IsUserData + { + get { return (bool)GetValue(IsUserDataProperty); } + set { SetValue(IsUserDataProperty, value); } + } + + public string Version + { + get { return (string)GetValue(VersionProperty); } + set { SetValue(VersionProperty, value); } + } + + public bool HasError + { + get { return (bool)GetValue(HasErrorProperty); } + set { SetValue(HasErrorProperty, value); } + } + } +} diff --git a/src/ConanServerManager/Lib/ViewModel/GameDataFileList.cs b/src/ConanServerManager/Lib/ViewModel/GameDataFileList.cs new file mode 100644 index 00000000..13c68573 --- /dev/null +++ b/src/ConanServerManager/Lib/ViewModel/GameDataFileList.cs @@ -0,0 +1,12 @@ +using ServerManagerTool.Common.Model; + +namespace ServerManagerTool.Lib.ViewModel +{ + public class GameDataFileList : SortableObservableCollection + { + public override string ToString() + { + return $"{nameof(GameDataFile)} - {Count}"; + } + } +} diff --git a/src/ConanServerManager/UserControls/GlobalSettingsControl.xaml.cs b/src/ConanServerManager/UserControls/GlobalSettingsControl.xaml.cs index 45f5d5e6..9e83704f 100644 --- a/src/ConanServerManager/UserControls/GlobalSettingsControl.xaml.cs +++ b/src/ConanServerManager/UserControls/GlobalSettingsControl.xaml.cs @@ -63,6 +63,8 @@ namespace ServerManagerTool } this.DataContext = this; + + GameData.GameDataLoaded += GameData_GameDataLoaded; } public App AppInstance @@ -398,14 +400,19 @@ namespace ServerManagerTool e.Handled = true; } + private void GameData_GameDataLoaded(object sender, EventArgs e) + { + PopulateRconMessageModesComboBox(); + } + private void LanguageSelectionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Config.CultureName = AvailableLanguages.Instance.SelectedLanguage; PopulateWindowsStatesMainWindowComboBox(); PopulateWindowsStatesServerMonitorWindowComboBox(); - PopulateRconMessageModesComboBox(); PopulateTaskPrioritiesComboBox(); + GameData_GameDataLoaded(sender, e); App.Instance.OnResourceDictionaryChanged(Config.CultureName); } @@ -492,6 +499,11 @@ namespace ServerManagerTool } } + public void CloseControl() + { + GameData.GameDataLoaded -= GameData_GameDataLoaded; + } + private void PopulateWindowsStatesMainWindowComboBox() { var selectedValue = this.WindowStateMainWindowComboBox?.SelectedValue ?? Config.MainWindow_WindowState; diff --git a/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs b/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs index 023c862a..beb76349 100644 --- a/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs +++ b/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs @@ -153,9 +153,18 @@ namespace ServerManagerTool // hook into the language change event GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent += ResourceDictionaryChangedEvent; + GameData.GameDataLoaded += GameData_GameDataLoaded; } #region Event Methods + private void GameData_GameDataLoaded(object sender, EventArgs e) + { + this.RefreshBaseGameMapsList(); + this.RefreshBaseBranchesList(); + this.RefreshProcessPrioritiesList(); + this.RefreshServerRegionsList(); + } + private static void ServerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var ssc = (ServerSettingsControl)d; @@ -184,11 +193,8 @@ namespace ServerManagerTool { this.CurrentCulture = Thread.CurrentThread.CurrentCulture; - this.RefreshBaseGameMapsList(); - this.RefreshBaseBranchesList(); - this.RefreshProcessPrioritiesList(); - this.RefreshServerRegionsList(); this.UpdateLastStartedDetails(false); + GameData_GameDataLoaded(source, e); Runtime.UpdateServerStatusString(); } @@ -1248,6 +1254,12 @@ namespace ServerManagerTool #endregion #region Methods + public void CloseControl() + { + GameData.GameDataLoaded -= GameData_GameDataLoaded; + GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent -= ResourceDictionaryChangedEvent; + } + public void RefreshBaseGameMapsList() { var newList = new ComboBoxItemList(); diff --git a/src/ConanServerManager/VersionFeed.xml b/src/ConanServerManager/VersionFeed.xml index a5fbbf7b..b4c602a0 100644 --- a/src/ConanServerManager/VersionFeed.xml +++ b/src/ConanServerManager/VersionFeed.xml @@ -5,7 +5,30 @@ Conan Server Manager Version Feed This is the Conan Server Manager release version feed. - 2022-06-13T00:00:00Z + 2022-06-17T00:00:00Z + + + urn:uuid:15FEC514-38B7-4367-BE79-1E00983E7EBB + 1.1.76 (1.1.76.1) + 1.1.76.1 + + 2022-06-17T00:00:00Z + +
+

+ CHANGE +
+

    +
  • Gamedata Files - when adding, deleteing or reloading the gamedata files via the gamedata window, the server manager will reload them and update the settings window.
  • +
+

+
+
+ + bletch + bletch1971@hotmail.com + +
urn:uuid:4E189446-9861-4B64-9B27-0E3E655CD1CA diff --git a/src/ConanServerManager/VersionFeedBeta.xml b/src/ConanServerManager/VersionFeedBeta.xml index 9b72aa19..1a97222c 100644 --- a/src/ConanServerManager/VersionFeedBeta.xml +++ b/src/ConanServerManager/VersionFeedBeta.xml @@ -5,44 +5,21 @@ Conan Server Manager Version Feed This is the Conan Server Manager beta version feed. - 2022-06-16T00:00:00Z + 2022-06-17T00:00:00Z - urn:uuid:4E189446-9861-4B64-9B27-0E3E655CD1CA - 1.1.75 (1.1.75.2) - 1.1.75.2 + urn:uuid:15FEC514-38B7-4367-BE79-1E00983E7EBB + 1.1.76 (1.1.76.1) + 1.1.76.1 - 2022-06-16T00:00:00Z + 2022-06-17T00:00:00Z

CHANGE

    -
  • Server Monitor - added shutdown reason.
  • -
-

-
-
- - bletch - bletch1971@hotmail.com - -
- - - urn:uuid:4E189446-9861-4B64-9B27-0E3E655CD1CA - 1.1.75 (1.1.75.1) - 1.1.75.1 - - 2022-06-16T00:00:00Z - -
-

- NEW -
-

    -
  • Reset Server - added new button to reset your server. This will delete all server files and reset your server back to new.
  • +
  • Gamedata Files - when adding, deleteing or reloading the gamedata files via the gamedata window, the server manager will reload them and update the settings window.

diff --git a/src/ConanServerManager/Windows/GameDataWindow.xaml.cs b/src/ConanServerManager/Windows/GameDataWindow.xaml.cs index d1b1ec2a..1c57d243 100644 --- a/src/ConanServerManager/Windows/GameDataWindow.xaml.cs +++ b/src/ConanServerManager/Windows/GameDataWindow.xaml.cs @@ -1,7 +1,7 @@ using Microsoft.WindowsAPICodePack.Dialogs; -using ServerManagerTool.Common.Model; using ServerManagerTool.Common.Utils; using ServerManagerTool.Lib; +using ServerManagerTool.Lib.ViewModel; using ServerManagerTool.Utils; using System; using System.Collections.Generic; @@ -19,60 +19,6 @@ namespace ServerManagerTool /// public partial class GameDataWindow : Window { - public class GameDataFileList : SortableObservableCollection - { - public override string ToString() - { - return $"{nameof(GameDataFile)} - {Count}"; - } - } - - public class GameDataFile : DependencyObject - { - public static readonly DependencyProperty CreatedDateProperty = DependencyProperty.Register(nameof(CreatedDate), typeof(DateTime), typeof(GameDataFile), new PropertyMetadata(DateTime.MinValue)); - public static readonly DependencyProperty FileProperty = DependencyProperty.Register(nameof(File), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); - public static readonly DependencyProperty FileNameProperty = DependencyProperty.Register(nameof(FileName), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); - public static readonly DependencyProperty IsUserDataProperty = DependencyProperty.Register(nameof(IsUserData), typeof(bool), typeof(GameDataFile), new PropertyMetadata(true)); - public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(nameof(Version), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty)); - public static readonly DependencyProperty HasErrorProperty = DependencyProperty.Register(nameof(HasError), typeof(bool), typeof(GameDataFile), new PropertyMetadata(false)); - - public DateTime CreatedDate - { - get { return (DateTime)GetValue(CreatedDateProperty); } - set { SetValue(CreatedDateProperty, value); } - } - - public string File - { - get { return (string)GetValue(FileProperty); } - set { SetValue(FileProperty, value); } - } - - public string FileName - { - get { return (string)GetValue(FileNameProperty); } - set { SetValue(FileNameProperty, value); } - } - - public bool IsUserData - { - get { return (bool)GetValue(IsUserDataProperty); } - set { SetValue(IsUserDataProperty, value); } - } - - public string Version - { - get { return (string)GetValue(VersionProperty); } - set { SetValue(VersionProperty, value); } - } - - public bool HasError - { - get { return (bool)GetValue(HasErrorProperty); } - set { SetValue(HasErrorProperty, value); } - } - } - private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance; public static readonly DependencyProperty GameDataFilesProperty = DependencyProperty.Register(nameof(GameDataFiles), typeof(GameDataFileList), typeof(GameDataWindow), new PropertyMetadata(null)); @@ -117,6 +63,7 @@ namespace ServerManagerTool try { AddGameDataFile(GameData.UserDataFolder, dialog.FileName); + GameData.Reload(); } catch (Exception ex) { @@ -135,6 +82,7 @@ namespace ServerManagerTool { DeleteAllGameDataFiles(GameData.UserDataFolder); } + GameData.Reload(); } catch (Exception ex) { @@ -166,6 +114,7 @@ namespace ServerManagerTool try { ReloadGameDataFiles(); + GameData.Reload(); } catch (Exception ex) { @@ -182,6 +131,7 @@ namespace ServerManagerTool { var gameDataItem = ((GameDataFile)((Button)e.Source).DataContext); DeleteGameDataFile(gameDataItem.File, true); + GameData.Reload(); } catch (Exception ex) { diff --git a/src/ConanServerManager/Windows/MainWindow.xaml.cs b/src/ConanServerManager/Windows/MainWindow.xaml.cs index 0f44483a..751a6251 100644 --- a/src/ConanServerManager/Windows/MainWindow.xaml.cs +++ b/src/ConanServerManager/Windows/MainWindow.xaml.cs @@ -246,6 +246,13 @@ namespace ServerManagerTool this.Activate(); } + protected override void OnClosed(EventArgs e) + { + GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent -= ResourceDictionaryChangedEvent; + + base.OnClosed(e); + } + protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { if (DiscordBotHelper.HasRunningCommands) diff --git a/src/ConanServerManager/Windows/RconWindow.xaml.cs b/src/ConanServerManager/Windows/RconWindow.xaml.cs index 84e4ca29..c137a187 100644 --- a/src/ConanServerManager/Windows/RconWindow.xaml.cs +++ b/src/ConanServerManager/Windows/RconWindow.xaml.cs @@ -238,6 +238,7 @@ namespace ServerManagerTool // hook into the language change event GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent += ResourceDictionaryChangedEvent; + GameData.GameDataLoaded += GameData_GameDataLoaded; } #region Properties @@ -554,13 +555,19 @@ namespace ServerManagerTool return window; } - private void ResourceDictionaryChangedEvent(object source, ResourceDictionaryChangedEventArgs e) + private void GameData_GameDataLoaded(object sender, EventArgs e) { PopulateRconInputModesComboBox(); } + private void ResourceDictionaryChangedEvent(object source, ResourceDictionaryChangedEventArgs e) + { + GameData_GameDataLoaded(source, e); + } + protected override void OnClosed(EventArgs e) { + GameData.GameDataLoaded -= GameData_GameDataLoaded; GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent -= ResourceDictionaryChangedEvent; if (this.RconParameters?.Server?.Runtime != null) diff --git a/src/ConanServerManager/Windows/SettingsWindow.xaml.cs b/src/ConanServerManager/Windows/SettingsWindow.xaml.cs index 95eef649..e4555fda 100644 --- a/src/ConanServerManager/Windows/SettingsWindow.xaml.cs +++ b/src/ConanServerManager/Windows/SettingsWindow.xaml.cs @@ -13,24 +13,14 @@ namespace ServerManagerTool /// public partial class SettingsWindow : Window { - public static readonly DependencyProperty AppInstanceProperty = DependencyProperty.Register(nameof(AppInstance), typeof(App), typeof(SettingsWindow), new PropertyMetadata(null)); - private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance; public SettingsWindow() { - this.AppInstance = App.Instance; - InitializeComponent(); WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile); } - public App AppInstance - { - get { return GetValue(AppInstanceProperty) as App; } - set { SetValue(AppInstanceProperty, value); } - } - private void SettingsWindow_Closing(object sender, CancelEventArgs e) { if (!globalSettingsControl.IsEnabled) @@ -39,6 +29,7 @@ namespace ServerManagerTool protected override void OnClosed(EventArgs e) { + globalSettingsControl.CloseControl(); globalSettingsControl.ApplyChangesToConfig(); if (SecurityUtils.IsAdministrator())