Exemplo n.º 1
0
 public void SetInstallByPath(string path)
 {
     try
     {
         path = Path.GetFullPath(path);
     }
     catch { }
     if (!string.IsNullOrEmpty(path))
     {
         var matchingInstall = BeatSaberLocations.Where(i => string.Equals(Path.GetFullPath(i.InstallPath), path, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
         if (matchingInstall != null)
         {
             ChosenInstall = matchingInstall;
         }
         else
         {
             var newInstall = new BeatSaberInstall(path, InstallType.Manual);
             BeatSaberLocations.Add(newInstall);
             ChosenInstall = newInstall;
         }
     }
     else
     {
         ChosenInstall = BeatSaberLocations.FirstOrDefault();
     }
 }
Exemplo n.º 2
0
        private bool RemoveLocation(BeatSaberInstall install)
        {
            bool result = BeatSaberLocations.Remove(install);

            if (ChosenInstall == install)
            {
                ChosenInstall = null;
            }
            NewLocationIsValid = CanAddLocation(NewLocationInput);
            return(result);
        }
Exemplo n.º 3
0
        private bool AddLocation(BeatSaberInstall beatSaberInstall)
        {
            bool hadEmptyList = BeatSaberLocations.Count == 0;

            BeatSaberLocations.Add(beatSaberInstall);
            if (BeatSaberLocations.Any(i => i.InstallPath == NewLocationInput.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)))
            {
                NewLocationIsValid = false;
            }
            if (hadEmptyList)
            {
                ChosenInstall = beatSaberInstall;
            }
            return(true);
        }