From 18047a2b9435437ede16524b14aee3af0b5a7a47 Mon Sep 17 00:00:00 2001 From: rookiestyle Date: Mon, 31 Jan 2022 08:48:07 +0100 Subject: [PATCH] Bugfix If a renamed plugin is detected, only remove the old plugin if it actually is updated. --- src/PluginUpdateInfo.cs | 23 +++++++++++++++++++---- src/Properties/AssemblyInfo.cs | 4 ++-- version.info | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/PluginUpdateInfo.cs b/src/PluginUpdateInfo.cs index 5a62282..6130def 100644 --- a/src/PluginUpdateInfo.cs +++ b/src/PluginUpdateInfo.cs @@ -771,6 +771,11 @@ private void CheckRenamed(Dictionary> m_dUpdat } } + /// + /// All files related to the previous version of the plugin + /// Only filled if plugin was renamed + /// + private List m_lOldPluginFiles = new List(); private void ProcessRename() { List lMsg = new List(); @@ -783,25 +788,35 @@ private void ProcessRename() lMsg.Add("Plugin update URL - new: " + PluginUpdateURL); lMsg.Add("Plugin URL - old: " + URL); - URL = URL.Replace(Name.ToLowerInvariant(), NewName.ToLowerInvariant()); + URL = URL.Replace(Name.ToLowerInvariant(), sNewNameCleaned.ToLowerInvariant()); lMsg.Add("Plugin URL - new: " + URL); foreach (var t in Translations) { lMsg.Add("Translation file - old: " + t.LangugageFile); - PluginUpdateHandler.DeleteSpecialFile(PluginUpdateHandler.PluginsTranslationsFolder + t.LangugageFile, false); + m_lOldPluginFiles.Add(PluginUpdateHandler.PluginsTranslationsFolder + t.LangugageFile); + //PluginUpdateHandler.DeleteSpecialFile(PluginUpdateHandler.PluginsTranslationsFolder + t.LangugageFile, false); t.LangugageFile = t.LangugageFile.Replace(Name, sNewNameCleaned); lMsg.Add("Translation file - new: " + t.LangugageFile); //Decrease installed version to ensure the new file is downloaded t.Installed--; } - PluginUpdateHandler.DeleteSpecialFile(PluginFile, false); + m_lOldPluginFiles.Add(PluginFile); + //PluginUpdateHandler.DeleteSpecialFile(PluginFile, false); PluginDebug.AddInfo("Process new plugin name", 0, lMsg.ToArray()); } - private bool VersionAvailableIsUnknown() + internal override bool ProcessDownload(string sTargetFolder) + { + if (!IsRenamed) return true; + foreach (var f in m_lOldPluginFiles) + PluginUpdateHandler.DeleteSpecialFile(f); + return true; + } + + private bool VersionAvailableIsUnknown() { if (VersionAvailable.Major > 0) return false; if (VersionAvailable.Minor > 0) return false; diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index c15e1ff..ef8b8c4 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -26,6 +26,6 @@ // // You can specify all the values or you can use the default the Revision and // Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("4.1.1.0")] -[assembly: AssemblyFileVersion("4.1.1.0")] +[assembly: AssemblyVersion("4.1.2.0")] +[assembly: AssemblyFileVersion("4.1.2.0")] [assembly: Guid("672570AF-CC57-4980-86F9-D48FD1CC707D")] \ No newline at end of file diff --git a/version.info b/version.info index 6bca060..bb3130c 100644 --- a/version.info +++ b/version.info @@ -1,5 +1,5 @@ : -Early update check:4.1.1 +Early update check:4.1.2 Early update check!de:7 Early update check!ru:2 Early update check!fr:1