Esempio n. 1
0
 public string getAbsolutePath(LocationPathHolder parse_me, string user)
 {
     foreach(KeyValuePair<HandlerType,ALocationHandler>  handler in handlers) {
         string result = handler.Value.getAbsolutePath(parse_me, user);
         if(result!=null)
             return result;
     }
     return null;
 }
Esempio n. 2
0
        public void populateUsers(LocationPathHolder location)
        {
            user_candidates.Clear();
            List<string> users = Core.locations.getUsers(location.rel_root);
            if(users.Count>0) {
                user_needed = true;
                if(users.Count>1) {
                    multiple_users = true;
                } else {
                    multiple_users = false;
                    NotifyPropertyChanged("only_user");
                }
            } else {
                switch(location.rel_root) {
                    case EnvironmentVariable.AllUsersProfile:
                    case EnvironmentVariable.AltSavePaths:
                    case EnvironmentVariable.Drive:
                    case EnvironmentVariable.InstallLocation:
                    case EnvironmentVariable.None:
                    case EnvironmentVariable.ProgramFiles:
                    case EnvironmentVariable.ProgramFilesX86:
                    case EnvironmentVariable.PS3Export:
                    case EnvironmentVariable.PS3Save:
                    case EnvironmentVariable.PSPSave:
                    case EnvironmentVariable.Public:
                    case EnvironmentVariable.SteamCommon:
                    case EnvironmentVariable.SteamSourceMods:
                        user_needed = false;
                        break;
                    default:
                        throw new MException("User Error","The environment variable " + location.rel_root + " requires a user to restore to, but none was detected for it. Try creating a save with a game that you know uses the folder.",false);
                }

            }
            foreach(string user in users) {
                user_candidates.Add(user);
            }
        }
Esempio n. 3
0
 public void restoreBackup(LocationPathHolder path, string user, RunWorkerCompletedEventHandler when_done)
 {
     string target;
     if(path.GetType()==typeof(ManualLocationPathHolder)) {
         target = path.ToString();
     } else {
         target = Core.locations.getAbsolutePath(path,user);
     }
     restoreBackup(target, when_done);
 }
Esempio n. 4
0
 public void addPathCandidate(LocationPathHolder location)
 {
     foreach(LocationPathHolder path in path_candidates) {
         if(location.GetType()==typeof(ManualLocationPathHolder)) {
             if(path.GetType()==typeof(ManualLocationPathHolder)) {
                 path_candidates.Remove(path);
                 break;
             }
         } else if(path.ToString().Equals(location.ToString())) {
             if(location.GetType()==typeof(DetectedLocationPathHolder)) {
                 path_candidates.Remove(path);
                 path_candidates.Add(location);
             }
             return;
         }
     }
     path_candidates.Add(location);
 }