Example #1
0
 public void SavePrefs(UserPrefs prefs)
 {
     var path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Save Backup Tool\\";
     if (!Directory.Exists(path))
         Directory.CreateDirectory(path);
     var fullPath = path + @"UserPrefs.dat";
     var text = JsonConvert.SerializeObject(prefs);
     File.WriteAllText(fullPath, text);
 }
Example #2
0
 public static UserPrefs GetDefaultPrefs()
 {
     var prefs = new UserPrefs() {
         SelectedGames = new ObservableCollection<Game>(),
         MaxBackups = 5,
         BackupSyncOptions = new BackupSyncOptions(),
         ThemeName = @"DarkStyle.xaml"
     };
     return prefs;
 }
Example #3
0
 private void SaveUserPrefs() {         
     var prefSaver = new PrefSaver();
     if (prefSaver.CheckForPrefs()) {
         var prefs = prefSaver.LoadPrefs();
         prefs.MaxBackups = MaxBackups;
         prefs.SelectedGames = GamesToBackup;
         prefs.LastBackupTime = LastBackupTime;
         prefs.BackupSyncOptions = BackupSyncOptions;
         prefs.ThemeName = _themeName;
         prefSaver.SavePrefs(prefs);
         return;
     }
     var newPrefs = new UserPrefs() {
         BackupSyncOptions = BackupSyncOptions,
         LastBackupTime = LastBackupTime,
         MaxBackups = MaxBackups,
         SelectedGames = GamesToBackup,
     };
     prefSaver.SavePrefs(newPrefs);
 }
Example #4
0
 private bool CreateDropboxOnlyPrefs(UserLogin userLogin)
 {
     if (userLogin != null) {
         var prefs = new UserPrefs {UserSecret = userLogin.Secret, UserToken = userLogin.Token};
         SavePrefs(prefs);
         return true;
     }
     return false;
 }