/// <summary>Deletes the file specified by the ES3Settings object provided as a parameter.</summary> /// <param name="settings">The settings we want to use to override the default settings.</param> public static void DeleteFile(ES3Settings settings) { if (settings.location == Location.File) { ES3IO.DeleteFile(settings.FullPath); } else if (settings.location == Location.PlayerPrefs) { PlayerPrefs.DeleteKey(settings.FullPath); } else if (settings.location == Location.Resources) { throw new System.NotSupportedException("Deleting files from Resources is not supported."); } }
/// <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."); } }