diff --git a/Knossos.NET/ViewModels/DeveloperModsViewModel.cs b/Knossos.NET/ViewModels/DeveloperModsViewModel.cs
index 82c11857..6a2fbc18 100644
--- a/Knossos.NET/ViewModels/DeveloperModsViewModel.cs
+++ b/Knossos.NET/ViewModels/DeveloperModsViewModel.cs
@@ -202,6 +202,14 @@ public void UpdateVersionManager(string? modid = null)
ModEditor?.UpdateVersionManager(modid);
}
+ ///
+ /// If the mod editor is open this will refresh the listed build options in the Fso Settings tabs
+ ///
+ public void UpdateListedFsoBuildVersionsInEditor()
+ {
+ ModEditor?.UpdateFsoSettingsComboBox();
+ }
+
///
/// Resets the mod editor
/// Reloads the currently loaded mod in editor if it matches the passed id, null for always
diff --git a/Knossos.NET/ViewModels/FsoBuildsViewModel.cs b/Knossos.NET/ViewModels/FsoBuildsViewModel.cs
index e73b804a..85468614 100644
--- a/Knossos.NET/ViewModels/FsoBuildsViewModel.cs
+++ b/Knossos.NET/ViewModels/FsoBuildsViewModel.cs
@@ -319,6 +319,7 @@ public void DeleteBuild(FsoBuild build, FsoBuildItemViewModel? item, bool runMod
}
}
Knossos.RemoveBuild(build);
+ DeveloperModsViewModel.Instance?.UpdateListedFsoBuildVersionsInEditor();
if (runModstatusChecks)
{
MainWindowViewModel.Instance?.RunModStatusChecks();
diff --git a/Knossos.NET/ViewModels/Templates/DevModEditorViewModel.cs b/Knossos.NET/ViewModels/Templates/DevModEditorViewModel.cs
index be3921be..ae3b98f2 100644
--- a/Knossos.NET/ViewModels/Templates/DevModEditorViewModel.cs
+++ b/Knossos.NET/ViewModels/Templates/DevModEditorViewModel.cs
@@ -344,5 +344,16 @@ public void UpdateVersionManager(string? modid = null)
if(VersionsView != null && (modid == null || ActiveVersion.id == modid) )
VersionsView?.HackUpdateModList();
}
+
+ ///
+ /// If the mod editor is open this will refresh the listed build options in the Fso Settings tabs
+ ///
+ public void UpdateFsoSettingsComboBox()
+ {
+ if (FsoSettingsView != null)
+ {
+ FsoSettingsView.UpdateFsoPicker();
+ }
+ }
}
}
diff --git a/Knossos.NET/ViewModels/Templates/DevModFsoSettingsViewModel.cs b/Knossos.NET/ViewModels/Templates/DevModFsoSettingsViewModel.cs
index 41993ef0..dcfc0218 100644
--- a/Knossos.NET/ViewModels/Templates/DevModFsoSettingsViewModel.cs
+++ b/Knossos.NET/ViewModels/Templates/DevModFsoSettingsViewModel.cs
@@ -26,40 +26,48 @@ public DevModFsoSettingsViewModel()
public DevModFsoSettingsViewModel(DevModEditorViewModel devModEditorViewModel)
{
editor = devModEditorViewModel;
- if (editor.ActiveVersion.modSettings.customBuildId == null)
- {
- fsoPicker = new FsoBuildPickerViewModel(null);
- }
- else
+ LoadFsoPicker();
+ }
+
+ private void LoadFsoPicker()
+ {
+ if (editor != null)
{
- if (editor.ActiveVersion.modSettings.customBuildExec != null)
+ if (editor.ActiveVersion.modSettings.customBuildId == null)
{
- fsoPicker = new FsoBuildPickerViewModel(new FsoBuild(editor.ActiveVersion.modSettings.customBuildExec));
+ FsoPicker = new FsoBuildPickerViewModel(null);
}
else
{
- var matchingBuilds = Knossos.GetInstalledBuildsList(editor.ActiveVersion.modSettings.customBuildId);
- if (matchingBuilds.Any())
+ if (editor.ActiveVersion.modSettings.customBuildExec != null)
{
- var theBuild = matchingBuilds.FirstOrDefault(build => build.version == editor.ActiveVersion.modSettings.customBuildVersion);
- if (theBuild != null)
+ FsoPicker = new FsoBuildPickerViewModel(new FsoBuild(editor.ActiveVersion.modSettings.customBuildExec));
+ }
+ else
+ {
+ var matchingBuilds = Knossos.GetInstalledBuildsList(editor.ActiveVersion.modSettings.customBuildId);
+ if (matchingBuilds.Any())
{
- fsoPicker = new FsoBuildPickerViewModel(theBuild);
+ var theBuild = matchingBuilds.FirstOrDefault(build => build.version == editor.ActiveVersion.modSettings.customBuildVersion);
+ if (theBuild != null)
+ {
+ FsoPicker = new FsoBuildPickerViewModel(theBuild);
+ }
+ else
+ {
+ Log.Add(Log.LogSeverity.Warning, "DevModFsoSettingsViewModel.Constructor()", "Missing user-saved build version for mod: " + editor.ActiveVersion.tile + " - " + editor.ActiveVersion.version + " requested build id: " + editor.ActiveVersion.modSettings.customBuildId + " and version: " + editor.ActiveVersion.modSettings.customBuildVersion);
+ FsoPicker = new FsoBuildPickerViewModel(null);
+ }
}
else
{
- Log.Add(Log.LogSeverity.Warning, "DevModFsoSettingsViewModel.Constructor()", "Missing user-saved build version for mod: " + editor.ActiveVersion.tile + " - " + editor.ActiveVersion.version + " requested build id: " + editor.ActiveVersion.modSettings.customBuildId + " and version: " + editor.ActiveVersion.modSettings.customBuildVersion);
- fsoPicker = new FsoBuildPickerViewModel(null);
+ Log.Add(Log.LogSeverity.Warning, "DevModFsoSettingsViewModel.Constructor()", "Missing user-saved build id for mod: " + editor.ActiveVersion.tile + " - " + editor.ActiveVersion.version + " requested build id: " + editor.ActiveVersion.modSettings.customBuildId);
+ FsoPicker = new FsoBuildPickerViewModel(null);
}
}
- else
- {
- Log.Add(Log.LogSeverity.Warning, "DevModFsoSettingsViewModel.Constructor()", "Missing user-saved build id for mod: " + editor.ActiveVersion.tile + " - " + editor.ActiveVersion.version + " requested build id: " + editor.ActiveVersion.modSettings.customBuildId);
- fsoPicker = new FsoBuildPickerViewModel(null);
- }
}
+ CmdLine = editor.ActiveVersion.cmdline;
}
- CmdLine = editor.ActiveVersion.cmdline;
}
internal void ConfigureBuild()
@@ -148,5 +156,15 @@ internal void SaveSettingsCommand()
editor.ActiveVersion.SaveJson();
}
}
+
+ ///
+ /// Updates the FSO picker combobox to display changes to installed fso builds
+ /// Note: it actually destroys the current fso picker and it replaces it with a new one.
+ ///
+ public void UpdateFsoPicker()
+ {
+ //Run from UI thread
+ Dispatcher.UIThread.Invoke(()=> { LoadFsoPicker(); });
+ }
}
}
diff --git a/Knossos.NET/ViewModels/Templates/DevModPkgMgrViewModel.cs b/Knossos.NET/ViewModels/Templates/DevModPkgMgrViewModel.cs
index 8c0a7ea0..a82514ee 100644
--- a/Knossos.NET/ViewModels/Templates/DevModPkgMgrViewModel.cs
+++ b/Knossos.NET/ViewModels/Templates/DevModPkgMgrViewModel.cs
@@ -280,6 +280,11 @@ internal void DeleteDependency()
EditorPackageItem.DeleteDependency(this);
}
+ internal void ReloadDependency()
+ {
+ EditorPackageItem.ReloadDependency(this);
+ }
+
public ModDependency? GetDependency()
{
try
@@ -441,6 +446,29 @@ public void DeleteDependency(EditorDependencyItem dependency)
}
}
+ public void ReloadDependency(EditorDependencyItem dependency)
+ {
+ int oldIndex = DependencyItems.IndexOf(dependency);
+ if (oldIndex != -1)
+ {
+ DeleteDependency(dependency);
+ try
+ {
+ if (PkgMgr.editor != null && oldIndex <= DependencyItems.Count())
+ DependencyItems.Insert(oldIndex, new EditorDependencyItem(dependency.Dependency, this, PkgMgr.editor.ActiveVersion.id, PkgMgr.editor.ActiveVersion.parent));
+ }
+ catch (Exception ex)
+ {
+ Log.Add(Log.LogSeverity.Error, "EditorModPackageItem.ReloadDependency()", ex);
+ }
+ }
+ else
+ {
+ Log.Add(Log.LogSeverity.Error, "EditorModPackageItem.ReloadDependency()", "Got -1 on DeprendencyItems.IndexOf(dependency) for some reason.");
+ }
+
+ }
+
internal void DeleteModPkg()
{
try
diff --git a/Knossos.NET/ViewModels/Templates/TaskItemViewModel.cs b/Knossos.NET/ViewModels/Templates/TaskItemViewModel.cs
index 1c2a5cb4..aff21ea1 100644
--- a/Knossos.NET/ViewModels/Templates/TaskItemViewModel.cs
+++ b/Knossos.NET/ViewModels/Templates/TaskItemViewModel.cs
@@ -4401,7 +4401,9 @@ await Dispatcher.UIThread.InvokeAsync(async () =>
FsoBuild newBuild = new FsoBuild(modJson);
if (modifyPkgs == null)
{
+ //New Build
Knossos.AddBuild(newBuild);
+ DeveloperModsViewModel.Instance?.UpdateListedFsoBuildVersionsInEditor();
}
if (modJson.devMode)
{
diff --git a/Knossos.NET/Views/Templates/DevModPkgMgrView.axaml b/Knossos.NET/Views/Templates/DevModPkgMgrView.axaml
index 6f606383..f99c075b 100644
--- a/Knossos.NET/Views/Templates/DevModPkgMgrView.axaml
+++ b/Knossos.NET/Views/Templates/DevModPkgMgrView.axaml
@@ -71,7 +71,7 @@
-
+
@@ -97,7 +97,10 @@
-