Beispiel #1
0
 public void ApplyToSaveFile()
 {
     foreach (var kvp in _snapshotHandlersByFileName)
     {
         var data = kvp.Value.TakeSnapshot();
         File.WriteAllText(PersistenceHelper.GetPath(_persistentDataPath, kvp.Key), data);
     }
 }
Beispiel #2
0
 private string TryLoadFromFile(string fileName)
 {
     try
     {
         var path = PersistenceHelper.GetPath(_persistentDataPath, fileName);
         if (!File.Exists(path))
         {
             return(string.Empty);
         }
         var result = File.ReadAllText(path);
         return(result);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(string.Empty);
 }