Example #1
0
        private void UninstallMod(ModInfo modInfo)
        {
            if (selectedGame == null)
            {
                Log.Print("Select a game.");
                return;
            }

            var modsPath = Path.Combine(gamePath, selectedGame.ModsDirectory);

            if (!Directory.Exists(modsPath))
            {
                Log.Print("Install the UnityModManager.");
                return;
            }

            if (Directory.Exists(modInfo.Path))
            {
                try
                {
                    Directory.Delete(modInfo.Path, true);
                    Log.Print($"Deleting '{modInfo.Id}' - SUCCESS.");
                }
                catch (Exception ex)
                {
                    Log.Print(ex.Message);
                    Log.Print($"Error when uninstalling '{modInfo.Id}'.");
                }
            }
            else
            {
                Log.Print($"Directory '{modInfo.Path}' - not found.");
            }

            ReloadMods();
            RefreshModList();
        }
Example #2
0
 public bool EqualsVersion(ModInfo other)
 {
     return(other != null && Id.Equals(other.Id) && Version.Equals(other.Version));
 }