Esempio n. 1
0
 /// <summary>Checks whether a file exists.</summary>
 /// <param name="settings">The settings we want to use to override the default settings.</param>
 /// <returns>True if the file exists, otherwise False.</returns>
 public static bool FileExists(ES3Settings settings)
 {
     if (settings.location == Location.File)
     {
         return(ES3IO.FileExists(settings.FullPath));
     }
     else if (settings.location == Location.PlayerPrefs)
     {
         return(PlayerPrefs.HasKey(settings.FullPath));
     }
     else if (settings.location == Location.Resources)
     {
         return(Resources.Load(settings.FullPath) != null);
     }
     return(false);
 }
Esempio n. 2
0
 /// <summary>Copies a file from one location to another, using the ES3Settings provided to determine the locations.</summary>
 /// <param name="oldSettings">The settings we want to use when copying the old file.</param>
 /// <param name="newSettings">The settings we want to use when creating the new file.</param>
 public static void CopyFile(ES3Settings oldSettings, ES3Settings newSettings)
 {
     if (oldSettings.location == Location.File)
     {
         if (ES3IO.FileExists(oldSettings.FullPath))
         {
             ES3IO.DeleteFile(newSettings.FullPath);
             ES3IO.CopyFile(oldSettings.FullPath, newSettings.FullPath);
         }
     }
     else if (oldSettings.location == Location.PlayerPrefs)
     {
         PlayerPrefs.SetString(newSettings.FullPath, PlayerPrefs.GetString(oldSettings.FullPath));
     }
     else if (oldSettings.location == Location.Resources)
     {
         throw new System.NotSupportedException("Modifying files from Resources is not allowed.");
     }
 }