Ejemplo n.º 1
0
 public void UninstallMod(Mod mod)
 {
     Mod.DownloadLink links = null;
     foreach (Mod.DownloadLink link in mod.downloads)
     {
         if (link.type.ToLower() == "universal" || link.type.ToLower() == App.BeatSaberInstallType.ToLower())
         {
             links = link;
             break;
         }
     }
     if (mod.name.ToLower() == "bsipa")
     {
         UninstallBSIPA(links);
     }
     foreach (Mod.FileHashes files in links.hashMd5)
     {
         if (File.Exists(Path.Combine(App.BeatSaberInstallDirectory, files.file)))
         {
             File.Delete(Path.Combine(App.BeatSaberInstallDirectory, files.file));
         }
         if (File.Exists(Path.Combine(App.BeatSaberInstallDirectory, "IPA", "Pending", files.file)))
         {
             File.Delete(Path.Combine(App.BeatSaberInstallDirectory, "IPA", "Pending", files.file));
         }
     }
 }
Ejemplo n.º 2
0

        
Ejemplo n.º 3
0

        
Ejemplo n.º 4
0
        public void UninstallMod(Mod mod)
        {
            Mod.DownloadLink links = null;
            foreach (Mod.DownloadLink link in mod.downloads)
            {
                if (link.type.ToLower() == "universal" || link.type.ToLower() == App.BeatSaberInstallType.ToLower())
                {
                    links = link;
                    break;
                }
            }
            if (mod.name.ToLower() == "bsipa")
            {
                var hasIPAExe = File.Exists(Path.Combine(App.BeatSaberInstallDirectory, "IPA.exe"));
                var hasIPADir = Directory.Exists(Path.Combine(App.BeatSaberInstallDirectory, "IPA"));

                if (hasIPADir && hasIPAExe)
                {
                    UninstallBSIPA(links);
                }
                else
                {
                    var title = (string)FindResource("Mods:UninstallBSIPANotFound:Title");
                    var body  = (string)FindResource("Mods:UninstallBSIPANotFound:Body");

                    System.Windows.Forms.MessageBox.Show(body, title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            foreach (Mod.FileHashes files in links.hashMd5)
            {
                if (File.Exists(Path.Combine(App.BeatSaberInstallDirectory, files.file)))
                {
                    File.Delete(Path.Combine(App.BeatSaberInstallDirectory, files.file));
                }
                if (File.Exists(Path.Combine(App.BeatSaberInstallDirectory, "IPA", "Pending", files.file)))
                {
                    File.Delete(Path.Combine(App.BeatSaberInstallDirectory, "IPA", "Pending", files.file));
                }
            }
        }