mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-09-28 23:31:33 +12:00
Added diagnostics options (2/3)
Remove all mods button
This commit is contained in:
parent
3e7240eb8f
commit
b5637cba63
2 changed files with 37 additions and 17 deletions
|
@ -98,7 +98,7 @@ namespace ModAssistant.Pages
|
|||
MainWindow.Instance.GameVersionsBox.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void CheckInstalledMods()
|
||||
public void CheckInstalledMods()
|
||||
{
|
||||
GetAllMods();
|
||||
List<string> empty = new List<string>();
|
||||
|
@ -578,12 +578,24 @@ namespace ModAssistant.Pages
|
|||
private void UninstallModFromList(Mod mod)
|
||||
{
|
||||
UninstallMod(mod.ListItem.InstalledModInfo);
|
||||
mod.ListItem.IsInstalled = false;
|
||||
mod.ListItem.InstalledVersion = null;
|
||||
if (App.SelectInstalledMods)
|
||||
{
|
||||
mod.ListItem.IsSelected = false;
|
||||
UnresolveDependencies(mod);
|
||||
App.SavedMods.Remove(mod.name);
|
||||
Properties.Settings.Default.SavedMods = String.Join(",", App.SavedMods.ToArray());
|
||||
Properties.Settings.Default.Save();
|
||||
RefreshModsList();
|
||||
}
|
||||
view.Refresh();
|
||||
}
|
||||
|
||||
public void UninstallMod(Mod mod)
|
||||
{
|
||||
Mod.DownloadLink links = null;
|
||||
foreach (Mod.DownloadLink link in installedMod.downloads)
|
||||
foreach (Mod.DownloadLink link in mod.downloads)
|
||||
{
|
||||
if (link.type.ToLower() == "universal" || link.type.ToLower() == App.BeatSaberInstallType.ToLower())
|
||||
{
|
||||
|
@ -600,19 +612,6 @@ namespace ModAssistant.Pages
|
|||
if (File.Exists(Path.Combine(App.BeatSaberInstallDirectory, "IPA", "Pending", files.file)))
|
||||
File.Delete(Path.Combine(App.BeatSaberInstallDirectory, "IPA", "Pending", files.file));
|
||||
}
|
||||
|
||||
mod.ListItem.IsInstalled = false;
|
||||
mod.ListItem.InstalledVersion = null;
|
||||
if (App.SelectInstalledMods)
|
||||
{
|
||||
mod.ListItem.IsSelected = false;
|
||||
UnresolveDependencies(mod);
|
||||
App.SavedMods.Remove(mod.name);
|
||||
Properties.Settings.Default.SavedMods = String.Join(",", App.SavedMods.ToArray());
|
||||
Properties.Settings.Default.Save();
|
||||
RefreshModsList();
|
||||
}
|
||||
view.Refresh();
|
||||
}
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
|
|
|
@ -13,6 +13,8 @@ using System.Windows.Media.Imaging;
|
|||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace ModAssistant.Pages
|
||||
{
|
||||
|
@ -171,9 +173,28 @@ namespace ModAssistant.Pages
|
|||
}
|
||||
MainWindow.Instance.MainText = "BSIPA Uninstalled...";
|
||||
}
|
||||
private void YeetModsButton_Click(object sender, RoutedEventArgs e)
|
||||
private async void YeetModsButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//
|
||||
if (System.Windows.Forms.MessageBox.Show($"Are you sure you want to remove ALL mods?\nThis cannot be undone.", $"Uninstall All Mods?", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
|
||||
{
|
||||
|
||||
if (Mods.Instance.AllModsList == null)
|
||||
{
|
||||
MainWindow.Instance.MainText = "Getting Mod List...";
|
||||
await Task.Run(() => Mods.Instance.CheckInstalledMods());
|
||||
}
|
||||
foreach (Mod mod in Mods.InstalledMods)
|
||||
{
|
||||
Mods.Instance.UninstallMod(mod);
|
||||
}
|
||||
if (Directory.Exists(Path.Combine(App.BeatSaberInstallDirectory, "Plugins")))
|
||||
Directory.Delete(Path.Combine(App.BeatSaberInstallDirectory, "Plugins"), true);
|
||||
if (Directory.Exists(Path.Combine(App.BeatSaberInstallDirectory, "Libs")))
|
||||
Directory.Delete(Path.Combine(App.BeatSaberInstallDirectory, "Libs"), true);
|
||||
if (Directory.Exists(Path.Combine(App.BeatSaberInstallDirectory, "IPA")))
|
||||
Directory.Delete(Path.Combine(App.BeatSaberInstallDirectory, "IPA"), true);
|
||||
MainWindow.Instance.MainText = "All Mods Uninstalled...";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue