Added IsRetired (ApprovalStatus 3)

This commit is contained in:
Usman Shafiq 2022-06-15 18:15:32 -04:00
parent 71efc3990f
commit b74c421bbb
3 changed files with 19 additions and 9 deletions

View File

@ -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));

View File

@ -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);
}
}

View File

@ -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)
{