From b74c421bbb6094a54f0cb7a48a3e5d50f5ec1c46 Mon Sep 17 00:00:00 2001 From: Usman Shafiq Date: Wed, 15 Jun 2022 18:15:32 -0400 Subject: [PATCH] Added IsRetired (ApprovalStatus 3) --- VRCMelonAssistant/Classes/InstallHandlers.cs | 2 +- VRCMelonAssistant/Classes/Mod.cs | 2 ++ VRCMelonAssistant/Pages/Mods.xaml.cs | 24 +++++++++++++------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/VRCMelonAssistant/Classes/InstallHandlers.cs b/VRCMelonAssistant/Classes/InstallHandlers.cs index f173080..d731ee8 100644 --- a/VRCMelonAssistant/Classes/InstallHandlers.cs +++ b/VRCMelonAssistant/Classes/InstallHandlers.cs @@ -101,7 +101,7 @@ namespace VRCMelonAssistant stream.Position = 0; targetFilePath = Path.Combine(App.VRChatInstallDirectory, mod.versions[0].IsPlugin ? "Plugins" : "Mods", - mod.versions[0].IsBroken ? "Broken" : "", resp.RequestMessage.RequestUri.Segments.Last()); + mod.versions[0].IsBroken ? "Broken" : (mod.versions[0].IsRetired ? "Retired" : ""), resp.RequestMessage.RequestUri.Segments.Last()); Directory.CreateDirectory(Path.GetDirectoryName(targetFilePath)); diff --git a/VRCMelonAssistant/Classes/Mod.cs b/VRCMelonAssistant/Classes/Mod.cs index fdabbc5..45e077e 100644 --- a/VRCMelonAssistant/Classes/Mod.cs +++ b/VRCMelonAssistant/Classes/Mod.cs @@ -15,6 +15,7 @@ namespace VRCMelonAssistant public string installedFilePath; public string installedVersion; public bool installedInBrokenDir; + public bool installedInRetiredDir; public class ModVersion { @@ -33,6 +34,7 @@ namespace VRCMelonAssistant public int approvalStatus; public bool IsBroken => approvalStatus == 2; + public bool IsRetired => approvalStatus == 3; public bool IsPlugin => modType.Equals("plugin", StringComparison.InvariantCultureIgnoreCase); } } diff --git a/VRCMelonAssistant/Pages/Mods.xaml.cs b/VRCMelonAssistant/Pages/Mods.xaml.cs index 178916f..b732b22 100644 --- a/VRCMelonAssistant/Pages/Mods.xaml.cs +++ b/VRCMelonAssistant/Pages/Mods.xaml.cs @@ -31,6 +31,7 @@ namespace VRCMelonAssistant.Pages public static Mods Instance = new Mods(); private static readonly ModListItem.CategoryInfo BrokenCategory = new("Broken", "These mods were broken by a game update. They will be temporarily removed and restored once they are updated for the current game version"); + private static readonly ModListItem.CategoryInfo RetiredCategory = new("Retired", "These mods are either no longer needed due to VRChat updates or are no longer being maintained"); private static readonly ModListItem.CategoryInfo UncategorizedCategory = new("Uncategorized", "Mods without a category assigned"); private static readonly ModListItem.CategoryInfo UnknownCategory = new("Unknown/Unverified", "Mods not coming from VRCMG. Potentially dangerous."); @@ -138,10 +139,12 @@ namespace VRCMelonAssistant.Pages await Task.Run(() => { - CheckInstallDir("Plugins", false); - CheckInstallDir("Mods", false); - CheckInstallDir("Plugins/Broken", true); - CheckInstallDir("Mods/Broken", true); + CheckInstallDir("Plugins"); + CheckInstallDir("Mods"); + CheckInstallDir("Plugins/Broken", isBrokenDir: true); + CheckInstallDir("Mods/Broken", isBrokenDir: true); + CheckInstallDir("Plugins/Retired", isRetiredDir: true); + CheckInstallDir("Mods/Retired", isRetiredDir: true); }); } @@ -168,7 +171,7 @@ namespace VRCMelonAssistant.Pages } } - private void CheckInstallDir(string directory, bool isBrokenDir) + private void CheckInstallDir(string directory, bool isBrokenDir = false, bool isRetiredDir = false) { if (!Directory.Exists(Path.Combine(App.VRChatInstallDirectory, directory))) { @@ -193,6 +196,7 @@ namespace VRCMelonAssistant.Pages mod.installedFilePath = file; mod.installedVersion = modInfo.ModVersion; mod.installedInBrokenDir = isBrokenDir; + mod.installedInRetiredDir = isRetiredDir; break; } @@ -203,6 +207,7 @@ namespace VRCMelonAssistant.Pages installedFilePath = file, installedVersion = modInfo.ModVersion, installedInBrokenDir = isBrokenDir, + installedInRetiredDir = isRetiredDir, versions = new [] { new Mod.ModVersion() @@ -255,7 +260,7 @@ namespace VRCMelonAssistant.Pages public async Task PopulateModsList() { - foreach (Mod mod in AllModsList.Where(x => !x.versions[0].IsBroken)) + foreach (Mod mod in AllModsList.Where(x => !x.versions[0].IsBroken && !x.versions[0].IsRetired)) AddModToList(mod); foreach (var mod in UnknownMods) @@ -263,6 +268,9 @@ namespace VRCMelonAssistant.Pages foreach (Mod mod in AllModsList.Where(x => x.versions[0].IsBroken)) AddModToList(mod); + + foreach (Mod mod in AllModsList.Where(x => x.versions[0].IsRetired)) + AddModToList(mod); } private void AddModToList(Mod mod, ModListItem.CategoryInfo categoryOverride = null) @@ -295,7 +303,7 @@ namespace VRCMelonAssistant.Pages IsInstalled = mod.installedFilePath != null, InstalledVersion = mod.installedVersion, InstalledModInfo = mod, - Category = categoryOverride ?? (latestVersion.IsBroken ? BrokenCategory : GetCategory(mod)) + Category = categoryOverride ?? (latestVersion.IsBroken ? BrokenCategory : (latestVersion.IsRetired ? RetiredCategory : GetCategory(mod))) }; foreach (Promotion promo in Promotions.ActivePromotions) @@ -322,7 +330,7 @@ namespace VRCMelonAssistant.Pages foreach (Mod mod in AllModsList) { // Ignore mods that are newer than installed version or up-to-date - if (mod.ListItem.GetVersionComparison >= 0 && mod.installedInBrokenDir == mod.versions[0].IsBroken) continue; + if (mod.ListItem.GetVersionComparison >= 0 && mod.installedInBrokenDir == mod.versions[0].IsBroken && mod.installedInRetiredDir == mod.versions[0].IsRetired) continue; if (mod.ListItem.IsSelected) {