Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
If a renamed plugin is detected, only remove the old plugin if it actually is updated.
  • Loading branch information
Rookiestyle committed Jan 31, 2022
1 parent 5582cc9 commit 18047a2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
23 changes: 19 additions & 4 deletions src/PluginUpdateInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,11 @@ private void CheckRenamed(Dictionary<string, List<UpdateComponentInfo>> m_dUpdat
}
}

/// <summary>
/// All files related to the previous version of the plugin
/// Only filled if plugin was renamed
/// </summary>
private List<string> m_lOldPluginFiles = new List<string>();
private void ProcessRename()
{
List<string> lMsg = new List<string>();
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
2 changes: 1 addition & 1 deletion version.info
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 18047a2

Please sign in to comment.