Пример #1
0
 public static void Load()
 {
     try
     {
         string str1           = (string)null;
         Stream saveReadStream = RemoteSaveStorage.GetSaveReadStream("_accountsMeta", false);
         if (saveReadStream == null)
         {
             if (!SettingsLoader.hasEverSaved)
             {
                 ;
             }
             if (RemoteSaveStorage.FileExists("_accountsMeta", true))
             {
                 saveReadStream = RemoteSaveStorage.GetSaveReadStream("_accountsMeta", true);
                 if (SettingsLoader.hasEverSaved)
                 {
                     MainMenu.AccumErrors = saveReadStream == null ? MainMenu.AccumErrors + "Also failed loading backup\n" : MainMenu.AccumErrors + "Loaded Local saves backup...\n";
                 }
             }
         }
         else
         {
             str1 = new StreamReader(saveReadStream).ReadToEnd();
         }
         if (saveReadStream != null)
         {
             saveReadStream.Flush();
             saveReadStream.Dispose();
         }
         if (str1 == null)
         {
             return;
         }
         string[] strArray = str1.Split(new string[1] {
             "\r\n%------%"
         }, StringSplitOptions.RemoveEmptyEntries);
         if (strArray.Length <= 1)
         {
             throw new InvalidOperationException();
         }
         string str2 = strArray[0];
         OldSystemSaveFileManifest.Accounts.Clear();
         for (int index = 1; index < strArray.Length; ++index)
         {
             SaveAccountData fromString = SaveAccountData.ParseFromString(strArray[index]);
             OldSystemSaveFileManifest.Accounts.Add(fromString);
             if (fromString.Username == str2)
             {
                 OldSystemSaveFileManifest.LastLoggedInUser = fromString;
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
 public static void Load()
 {
     try
     {
         string str1           = null;
         var    saveReadStream = RemoteSaveStorage.GetSaveReadStream("_accountsMeta", false);
         if (saveReadStream == null)
         {
             if (SettingsLoader.hasEverSaved)
             {
                 MainMenu.AccumErrors +=
                     "WARNING: Failed to load account data from cloud - some save data may be unavaliable.\nConsider restarting your computer.\n";
             }
             if (RemoteSaveStorage.FileExists("_accountsMeta", true))
             {
                 saveReadStream = RemoteSaveStorage.GetSaveReadStream("_accountsMeta", true);
                 if (SettingsLoader.hasEverSaved)
                 {
                     MainMenu.AccumErrors = saveReadStream == null
                         ? MainMenu.AccumErrors + "Also failed loading backup\n"
                         : MainMenu.AccumErrors + "Loaded Local saves backup...\n";
                 }
             }
         }
         else
         {
             str1 = new StreamReader(saveReadStream).ReadToEnd();
         }
         if (saveReadStream != null)
         {
             saveReadStream.Flush();
             saveReadStream.Dispose();
         }
         var strArray = str1.Split(new string[1]
         {
             "\r\n%------%"
         }, StringSplitOptions.RemoveEmptyEntries);
         if (strArray.Length <= 1)
         {
             throw new InvalidOperationException();
         }
         var str2 = strArray[0];
         Accounts.Clear();
         for (var index = 1; index < strArray.Length; ++index)
         {
             var saveAccountData = SaveAccountData.ParseFromString(strArray[index]);
             Accounts.Add(saveAccountData);
             if (saveAccountData.Username == str2)
             {
                 LastLoggedInUser = saveAccountData;
             }
         }
     }
     catch (Exception ex)
     {
     }
 }