From 33b3f2e2f63be21d0fc8e1af42e6d864e96a8cd5 Mon Sep 17 00:00:00 2001 From: Salvador Cipolla Date: Tue, 28 Jan 2025 21:09:29 -0300 Subject: [PATCH] Check if you have access to an existing ID during mod creation --- .../Windows/DevModCreateNewViewModel.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Knossos.NET/ViewModels/Windows/DevModCreateNewViewModel.cs b/Knossos.NET/ViewModels/Windows/DevModCreateNewViewModel.cs index c5addb44..281f6171 100644 --- a/Knossos.NET/ViewModels/Windows/DevModCreateNewViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/DevModCreateNewViewModel.cs @@ -100,6 +100,7 @@ public DevModCreateNewViewModel(Window dialog) private async Task Verify() { + bool displayWarningID = false; //Is library set? if(Knossos.GetKnossosLibraryPath() == null ) { @@ -132,8 +133,16 @@ private async Task Verify() } if (await Nebula.IsModIdInNebula(ModId)) { - await MessageBox.Show(MainWindow.instance, "Mod ID already exist in Nebula: " + ModId, "Validation error", MessageBox.MessageBoxButtons.OK); - return false; + var editableIds = await Nebula.GetEditableModIDs(); + if (editableIds != null && editableIds.Contains(ModId)) + { + displayWarningID = true; + } + else + { + await MessageBox.Show(MainWindow.instance, "Mod id already exist in Nebula: " + ModId, "Validation error", MessageBox.MessageBoxButtons.OK); + return false; + } } if (Knossos.GetInstalledModList(ModId).Any() || Knossos.GetInstalledBuildsList(ModId).Any()) { @@ -207,6 +216,13 @@ private async Task Verify() } } } + + if(displayWarningID) + { + var res = await MessageBox.Show(MainWindow.instance, "This mod id already exists in Nebula, if there are uploaded versions of this mod you WILL override metadata for those versions if you try to upload something.", "ModID exists and you have write access to it", MessageBox.MessageBoxButtons.ContinueCancel); + return res == MessageBox.MessageBoxResult.Continue; + } + return true; }