Ejemplo n.º 1
0
 private void Save(string path, bool cloud)
 {
     lock (AchievementManager._ioLock)
     {
         if (SocialAPI.Achievements != null)
         {
             SocialAPI.Achievements.StoreStats();
         }
         try
         {
             using (MemoryStream memoryStream = new MemoryStream())
             {
                 using (CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, new RijndaelManaged().CreateEncryptor(this._cryptoKey, this._cryptoKey), CryptoStreamMode.Write))
                 {
                     using (BsonWriter bsonWriter = new BsonWriter((Stream)cryptoStream))
                     {
                         JsonSerializer.Create(this._serializerSettings).Serialize((JsonWriter)bsonWriter, (object)this._achievements);
                         ((JsonWriter)bsonWriter).Flush();
                         cryptoStream.FlushFinalBlock();
                         FileUtilities.WriteAllBytes(path, memoryStream.ToArray(), cloud);
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             string savePath = this._savePath;
             FancyErrorPrinter.ShowFileSavingFailError(ex, savePath);
         }
     }
 }
Ejemplo n.º 2
0
 private void Save(string path, bool cloud)
 {
     //IL_0047: Unknown result type (might be due to invalid IL or missing references)
     //IL_004e: Expected O, but got Unknown
     lock (_ioLock)
     {
         if (SocialAPI.Achievements != null)
         {
             SocialAPI.Achievements.StoreStats();
         }
         try
         {
             using MemoryStream memoryStream = new MemoryStream();
             using CryptoStream cryptoStream = new CryptoStream(memoryStream, new RijndaelManaged().CreateEncryptor(_cryptoKey, _cryptoKey), CryptoStreamMode.Write);
             BsonWriter val = new BsonWriter((Stream)cryptoStream);
             try
             {
                 JsonSerializer.Create(_serializerSettings).Serialize((JsonWriter)(object)val, (object)_achievements);
                 ((JsonWriter)val).Flush();
                 cryptoStream.FlushFinalBlock();
                 FileUtilities.WriteAllBytes(path, memoryStream.ToArray(), cloud);
             }
             finally
             {
                 ((IDisposable)val)?.Dispose();
             }
         }
         catch (Exception exception)
         {
             FancyErrorPrinter.ShowFileSavingFailError(exception, _savePath);
         }
     }
 }
Ejemplo n.º 3
0
 public void Save()
 {
     try {
         string s     = JsonConvert.SerializeObject(_data, Formatting.Indented);
         byte[] bytes = Encoding.ASCII.GetBytes(s);
         FileUtilities.WriteAllBytes(Path, bytes, IsCloudSave);
     }
     catch (Exception exception) {
         FancyErrorPrinter.ShowFileSavingFailError(exception, Path);
         throw;
     }
 }
Ejemplo n.º 4
0
 public void Save()
 {
     try
     {
         FileUtilities.WriteAllBytes(this.Path, Encoding.ASCII.GetBytes(JsonConvert.SerializeObject((object)this._data, (Formatting)1)), this.IsCloudSave);
     }
     catch (Exception ex)
     {
         string path = this.Path;
         FancyErrorPrinter.ShowFileSavingFailError(ex, path);
         throw;
     }
 }