### Load Audio Data from File (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Shows how to load AudioClip objects from saved audio files using ES3.LoadAudio. Examples include loading a sound effect and playing it, loading an MP3 with format specification, and a function to load background music with checks for file existence. This is crucial for managing in-game audio assets. ```csharp // Load audio clip AudioClip clip = ES3.LoadAudio("recorded_sound.wav"); audioSource.clip = clip; audioSource.Play(); // Load with format specification AudioClip mp3Clip = ES3.LoadAudio("music.mp3", AudioType.MPEG); // Load into audio source void LoadBackgroundMusic(string filename) { if (ES3.FileExists(filename)) { AudioClip bgm = ES3.LoadAudio(filename); musicSource.clip = bgm; musicSource.loop = true; musicSource.Play(); } } ``` -------------------------------- ### Cache File in Memory for Faster Access (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Explains how to use ES3.CacheFile to load an entire file into memory for significantly faster repeated access. The examples demonstrate caching a file, then loading data from it instantly, caching on game start, and caching with custom settings like specifying a directory. This is ideal for frequently accessed configuration or player data. ```csharp // Cache frequently accessed file ES3.CacheFile("player_stats.es3"); // Now loads are instant (from RAM) int level = ES3.Load("level", "player_stats.es3"); int gold = ES3.Load("gold", "player_stats.es3"); int xp = ES3.Load("xp", "player_stats.es3"); // Cache on game start void Start() { ES3.CacheFile("game_config.es3"); LoadAllSettings(); } // Cache with custom settings var settings = new ES3Settings { directory = "Config" }; ES3.CacheFile("settings.es3", settings); ``` -------------------------------- ### Synchronize Local and Cloud Saves (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Illustrates how to synchronize local save data with cloud storage using ES3Cloud.Sync. The examples show basic synchronization with a provided server URL and API key, including error handling, and a coroutine-based sync for game data with timestamp comparison logic. This is essential for implementing cross-device save functionality. ```csharp // Basic cloud sync var cloud = new ES3Cloud("https://yourserver.com/api/", "apiKey123"); yield return StartCoroutine(cloud.Sync("save_file.es3")); if (cloud.isError) { Debug.LogError($"Sync failed: {cloud.error}"); } else { Debug.Log("Sync successful!"); } // Sync with timestamp comparison IEnumerator SyncGameData() { var cloud = new ES3Cloud(cloudURL, apiKey); yield return StartCoroutine(cloud.Sync("game_progress.es3")); if (!cloud.isError) { LoadGameProgress(); } } ``` -------------------------------- ### Timestamp Methods Source: https://docs.moodkie.com/product/easy-save-3/es3-api/es3-methods Methods for getting and managing timestamps. ```APIDOC ## ES3.GetTimestamp ### Description Gets the timestamp of a saved file. ### Method `ES3.GetTimestamp(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the saved file. ### Request Example ```csharp DateTime timestamp = ES3.GetTimestamp("last_played"); ``` ### Response #### Success Response - **DateTime** - The timestamp of the file. ``` -------------------------------- ### Create Custom Reader for Batch Operations (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Demonstrates how to create a custom ES3Reader for efficient batch reading of multiple values from an Easy Save 3 file. It shows examples of reading various data types, using custom settings like encryption, and iterating through all properties in a save file. This is useful for optimizing read operations when multiple values are needed. ```csharp // Batch read with ES3Reader using (var reader = ES3Reader.Create("batch_save.es3")) { string name = reader.Read("playerName"); int level = reader.Read("playerLevel"); Vector3 pos = reader.Read("playerPosition"); List inventory = reader.Read>("playerInventory"); } // Read with custom settings var settings = new ES3Settings { encryptionType = ES3.EncryptionType.AES, encryptionPassword = "key123" }; using (var reader = ES3Reader.Create("encrypted.es3", settings)) { string data = reader.Read("secretData"); } // Read all properties using (var reader = ES3Reader.Create("data.es3")) { foreach (string key in reader.Properties) { Debug.Log($"Key: {key}"); } } ``` -------------------------------- ### Load Image Data from File (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Demonstrates how to load Texture2D objects from saved image files using ES3.LoadImage. The examples include loading an image and displaying it as a sprite, and loading a profile picture with basic file existence checks for error handling. This is useful for loading assets like user avatars or game textures. ```csharp // Load image Texture2D loadedImage = ES3.LoadImage("screenshot.png"); imageDisplay.sprite = Sprite.Create( loadedImage, new Rect(0, 0, loadedImage.width, loadedImage.height), Vector2.zero ); // Load with error handling if (ES3.FileExists("profile_picture.png")) { Texture2D profilePic = ES3.LoadImage("profile_picture.png"); profileImage.texture = profilePic; } else { profileImage.texture = defaultProfileTexture; } ``` -------------------------------- ### Save Image Data to File (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Provides examples of saving Texture2D objects to image files using ES3.SaveImage. It covers saving a screenshot, saving with specific quality settings (like compression), and capturing and saving texture data from a camera. This function is essential for implementing features like user profile pictures or in-game screenshots. ```csharp // Save screenshot Texture2D screenshot = ScreenCapture.CaptureScreenshotAsTexture(); ES3.SaveImage(screenshot, "screenshot.png"); // Save with quality settings ES3.SaveImage(screenshot, "compressed.jpg", new ES3Settings { format = ES3.Format.JSON }); // Save texture from camera void SaveCameraCapture() { RenderTexture rt = new RenderTexture(512, 512, 24); camera.targetTexture = rt; camera.Render(); Texture2D texture = new Texture2D(512, 512); RenderTexture.active = rt; texture.ReadPixels(new Rect(0, 0, 512, 512), 0, 0); texture.Apply(); ES3.SaveImage(texture, "camera_capture.png"); } ``` -------------------------------- ### Write Cached Data to Disk (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Details how to use ES3.StoreCachedFile to persist changes made to cached data back to disk. Examples include modifying cached data and then saving it, and implementing an auto-save system where data is saved to cache for speed and periodically flushed to disk. This ensures data integrity after in-memory modifications. ```csharp // Modify cached data and save ES3.CacheFile("stats.es3"); ES3.Save("level", 25, "stats.es3"); // Saved to cache ES3.Save("gold", 5000, "stats.es3"); // Saved to cache ES3.StoreCachedFile("stats.es3"); // Write all changes to disk // Auto-save with caching void AutoSave() { if (!isCached) { ES3.CacheFile(saveFile); isCached = true; } // Make multiple saves to cache (fast) ES3.Save("position", transform.position, saveFile); ES3.Save("health", currentHealth, saveFile); ES3.Save("timestamp", System.DateTime.Now.Ticks, saveFile); // Periodically flush to disk if (Time.time - lastFlush > flushInterval) { ES3.StoreCachedFile(saveFile); lastFlush = Time.time; } } ``` -------------------------------- ### ES3Spreadsheet.RowCount/ColumnCount - Get spreadsheet dimensions Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Provides methods to retrieve the total number of rows and columns present in a loaded spreadsheet. These are essential for iterating through all data or for understanding the structure of the loaded CSV file. They return integers representing the dimensions. ```csharp // Get spreadsheet size var sheet = new ES3Spreadsheet(); sheet.Load("data.csv"); int rows = sheet.RowCount; int cols = sheet.ColumnCount; Debug.Log($"Spreadsheet size: {rows} rows x {cols} columns"); // Iterate all cells for (int r = 0; r < sheet.RowCount; r++) { for (int c = 0; c < sheet.ColumnCount; c++) { string value = sheet.GetCell(r, c); Debug.Log($"Cell [{r},{c}]: {value}"); } } ``` -------------------------------- ### ES3Spreadsheet.GetRowLength/GetColumnLength - Get specific row or column size Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Returns the number of columns in a specific row or the number of rows in a specific column. This is useful for handling CSV files with irregular structures where rows or columns may have varying lengths. Requires a loaded spreadsheet. ```csharp // Get specific row length var sheet = new ES3Spreadsheet(); sheet.Load("irregular.csv"); for (int row = 0; row < sheet.RowCount; row++) { int rowLength = sheet.GetRowLength(row); Debug.Log($"Row {row} has {rowLength} columns"); } // Get specific column length int col0Length = sheet.GetColumnLength(0); Debug.Log($"Column 0 has {col0Length} rows"); ``` -------------------------------- ### ES3.GetTimestamp - Get file last modified timestamp Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Retrieves the last modified timestamp of a specified save file. This utility method is helpful for version checking, displaying 'last saved' information, or comparing the recency of different save files. It returns a long integer representing the timestamp. ```csharp // Get file timestamp long timestamp = ES3.GetTimestamp("save_file.es3"); System.DateTime saveTime = new System.DateTime(timestamp); Debug.Log($"Last saved: {saveTime}"); // Compare timestamps long localTime = ES3.GetTimestamp("local.es3"); long backupTime = ES3.GetTimestamp("backup.es3"); if (localTime > backupTime) { Debug.Log("Local save is newer"); } else { Debug.Log("Backup is newer - consider restoring"); } // Display last save time in UI void UpdateSaveTimeDisplay() { if (ES3.FileExists("autosave.es3")) { long timestamp = ES3.GetTimestamp("autosave.es3"); System.DateTime saveTime = new System.DateTime(timestamp); // Assuming saveTimeText is a UI Text element // saveTimeText.text = $"Last saved: {saveTime:yyyy-MM-dd HH:mm}"; } } ``` -------------------------------- ### ES3Settings Constructor - Create Custom Save Settings Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Configures save settings such as location (PlayerPrefs, File, Cloud), directory, encryption, compression, and format. Allows for basic settings with custom locations or full configuration including buffer size and encoding. Useful for platform-specific or cloud-based storage. ```csharp // Basic settings with custom location var settings = new ES3Settings(ES3.Location.PlayerPrefs); ES3.Save("score", 1000, settings); // Full configuration var advancedSettings = new ES3Settings { location = ES3.Location.File, directory = "GameSaves", encryptionType = ES3.EncryptionType.AES, encryptionPassword = "SecurePass123", compressionType = ES3.CompressionType.Gzip, format = ES3.Format.JSON, bufferSize = 2048, encoding = System.Text.Encoding.UTF8 }; ES3.Save("player", playerData, "secure_save.es3", advancedSettings); // Platform-specific settings var mobileSettings = new ES3Settings { location = ES3.Location.File, compressionType = ES3.CompressionType.Gzip, // Reduce storage on mobile directory = "MobileSaves" }; // Cloud settings var cloudSettings = new ES3Settings { location = ES3.Location.Cloud, directory = "CloudBackups" }; ``` -------------------------------- ### Key and Directory Management Source: https://docs.moodkie.com/product/easy-save-3/es3-api/es3-methods Methods for managing keys and directories within the Easy Save system. ```APIDOC ## ES3.DeleteKey ### Description Deletes a key and its associated value. ### Method `ES3.DeleteKey(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key to delete. ### Request Example ```csharp ES3.DeleteKey("oldSetting"); ``` ### Response #### Success Response N/A (void) ## ES3.KeyExists ### Description Checks if a key exists. ### Method `ES3.KeyExists(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key to check. ### Request Example ```csharp bool exists = ES3.KeyExists("username"); ``` ### Response #### Success Response - **bool** - True if the key exists, false otherwise. ## ES3.DirectoryExists ### Description Checks if a directory exists. ### Method `ES3.DirectoryExists(string directoryPath, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **directoryPath** (string) - Required - The path of the directory to check. ### Request Example ```csharp bool exists = ES3.DirectoryExists("saves/level1"); ``` ### Response #### Success Response - **bool** - True if the directory exists, false otherwise. ## ES3.GetKeys ### Description Gets a list of all keys. ### Method `ES3.GetKeys(...)` ### Endpoint N/A (Scripting API) ### Request Example ```csharp string[] allKeys = ES3.GetKeys(); ``` ### Response #### Success Response - **string[]** - An array of all keys. ## ES3.GetFiles ### Description Gets a list of all files in the save directory. ### Method `ES3.GetFiles(...)` ### Endpoint N/A (Scripting API) ### Request Example ```csharp string[] allFiles = ES3.GetFiles(); ``` ### Response #### Success Response - **string[]** - An array of all file names. ## ES3.GetDirectories ### Description Gets a list of all directories in the save directory. ### Method `ES3.GetDirectories(...)` ### Endpoint N/A (Scripting API) ### Request Example ```csharp string[] allDirs = ES3.GetDirectories(); ``` ### Response #### Success Response - **string[]** - An array of all directory names. ``` -------------------------------- ### Backup and Restore Methods Source: https://docs.moodkie.com/product/easy-save-3/es3-api/es3-methods Methods for creating and restoring backups of save data. ```APIDOC ## ES3.CreateBackup ### Description Creates a backup of the current save data. ### Method `ES3.CreateBackup(string backupName, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **backupName** (string) - Optional - The name for the backup. ### Request Example ```csharp ES3.CreateBackup("level1_backup"); ``` ### Response #### Success Response N/A (void) ## ES3.RestoreBackup ### Description Restores save data from a backup. ### Method `ES3.RestoreBackup(string backupName, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **backupName** (string) - Optional - The name of the backup to restore. ### Request Example ```csharp ES3.RestoreBackup("level1_backup"); ``` ### Response #### Success Response N/A (void) ``` -------------------------------- ### Image and Audio Loading Source: https://docs.moodkie.com/product/easy-save-3/es3-api/es3-methods Methods for loading images and audio data. ```APIDOC ## ES3.SaveImage ### Description Saves an image to a file. ### Method `ES3.SaveImage(string key, Texture2D image, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key to identify the image file. - **image** (Texture2D) - Required - The image to save. ### Request Example ```csharp ES3.SaveImage("playerAvatar", myTexture); ``` ### Response #### Success Response N/A (void) ## ES3.LoadImage ### Description Loads an image from a file. ### Method `ES3.LoadImage(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the image file to load. ### Request Example ```csharp Texture2D loadedImage = ES3.LoadImage("playerAvatar"); ``` ### Response #### Success Response - **Texture2D** - The loaded image. ## ES3.LoadAudio ### Description Loads audio data from a file. ### Method `ES3.LoadAudio(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the audio file to load. ### Request Example ```csharp AudioClip loadedAudio = ES3.LoadAudio("backgroundMusic"); ``` ### Response #### Success Response - **AudioClip** - The loaded audio data. ``` -------------------------------- ### ES3Cloud Methods Source: https://docs.moodkie.com/product/easy-save-3/es3-api/es3-methods Methods for interacting with cloud storage services. ```APIDOC ## ES3Cloud.Sync ### Description Synchronizes local save data with cloud storage. ### Method `ES3Cloud.Sync(...)` ### Endpoint N/A (Scripting API) ### Request Example ```csharp ES3Cloud.Sync(); ``` ### Response #### Success Response N/A (void) ## ES3Cloud.UploadFile ### Description Uploads a local file to cloud storage. ### Method `ES3Cloud.UploadFile(string localPath, string cloudPath, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **localPath** (string) - Required - The local path of the file to upload. - **cloudPath** (string) - Required - The destination path in cloud storage. ### Request Example ```csharp ES3Cloud.UploadFile("local/save.dat", "cloud/save.dat"); ``` ### Response #### Success Response N/A (void) ## ES3Cloud.DownloadFile ### Description Downloads a file from cloud storage to local storage. ### Method `ES3Cloud.DownloadFile(string cloudPath, string localPath, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **cloudPath** (string) - Required - The path of the file in cloud storage. - **localPath** (string) - Required - The local destination path. ### Request Example ```csharp ES3Cloud.DownloadFile("cloud/save.dat", "local/save.dat"); ``` ### Response #### Success Response N/A (void) ## ES3Cloud.DeleteFile ### Description Deletes a file from cloud storage. ### Method `ES3Cloud.DeleteFile(string cloudPath, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **cloudPath** (string) - Required - The path of the file in cloud storage to delete. ### Request Example ```csharp ES3Cloud.DeleteFile("cloud/old_save.dat"); ``` ### Response #### Success Response N/A (void) ## ES3Cloud.DownloadFilenames ### Description Downloads a list of filenames from cloud storage. ### Method `ES3Cloud.DownloadFilenames(...)` ### Endpoint N/A (Scripting API) ### Request Example ```csharp string[] cloudFiles = ES3Cloud.DownloadFilenames(); ``` ### Response #### Success Response - **string[]** - An array of filenames from cloud storage. ## ES3Cloud.DownloadTimestamp ### Description Downloads the timestamp of a file from cloud storage. ### Method `ES3Cloud.DownloadTimestamp(string cloudPath, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **cloudPath** (string) - Required - The path of the file in cloud storage. ### Request Example ```csharp DateTime timestamp = ES3Cloud.DownloadTimestamp("cloud/save.dat"); ``` ### Response #### Success Response - **DateTime** - The timestamp of the file. ## ES3Cloud.AddPOSTField ### Description Adds a POST field for cloud uploads. ### Method `ES3Cloud.AddPOSTField(string key, string value, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the POST field. - **value** (string) - Required - The value of the POST field. ### Request Example ```csharp ES3Cloud.AddPOSTField("userId", "12345"); ``` ### Response #### Success Response N/A (void) ## ES3Cloud.SearchFilenames ### Description Searches for filenames in cloud storage based on a query. ### Method `ES3Cloud.SearchFilenames(string query, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **query** (string) - Required - The search query. ### Request Example ```csharp string[] searchResults = ES3Cloud.SearchFilenames("save_game_"); ``` ### Response #### Success Response - **string[]** - An array of filenames matching the query. ## ES3Cloud.RenameFile ### Description Renames a file in cloud storage. ### Method `ES3Cloud.RenameFile(string oldCloudPath, string newCloudPath, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **oldCloudPath** (string) - Required - The current path of the file in cloud storage. - **newCloudPath** (string) - Required - The new path for the file in cloud storage. ### Request Example ```csharp ES3Cloud.RenameFile("cloud/save_v1.dat", "cloud/save_v2.dat"); ``` ### Response #### Success Response N/A (void) ``` -------------------------------- ### Data Persistence Methods Source: https://docs.moodkie.com/product/easy-save-3/es3-api/es3-methods Methods for saving and loading various types of data using Easy Save 3. ```APIDOC ## ES3.Save ### Description Saves a value to a file. ### Method `ES3.Save(string key, object value, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key to identify the saved data. - **value** (object) - Required - The value to save. ### Request Example ```csharp ES3.Save("playerScore", 100); ``` ### Response #### Success Response N/A (void) ## ES3.Load ### Description Loads a value from a file. ### Method `ES3.Load(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the data to load. ### Request Example ```csharp int score = ES3.Load("playerScore"); ``` ### Response #### Success Response - **value** (object) - The loaded value. ## ES3.LoadInto ### Description Loads a value from a file into a specified object. ### Method `ES3.LoadInto(string key, object objectToLoadInto, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the data to load. - **objectToLoadInto** (object) - Required - The object to load the data into. ### Request Example ```csharp PlayerData data = new PlayerData(); ES3.LoadInto("playerData", data); ``` ### Response #### Success Response N/A (void) ## ES3.LoadRawBytes ### Description Loads raw bytes from a file. ### Method `ES3.LoadRawBytes(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the file to load. ### Request Example ```csharp byte[] fileBytes = ES3.LoadRawBytes("myFile.bin"); ``` ### Response #### Success Response - **bytes** (byte[]) - The raw bytes loaded from the file. ## ES3.SaveRaw ### Description Saves raw bytes to a file. ### Method `ES3.SaveRaw(string key, byte[] bytes, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key to identify the file. - **bytes** (byte[]) - Required - The raw bytes to save. ### Request Example ```csharp byte[] dataToSave = { 1, 2, 3 }; ES3.SaveRaw("rawData.dat", dataToSave); ``` ### Response #### Success Response N/A (void) ## ES3.AppendRaw ### Description Appends raw bytes to an existing file. ### Method `ES3.AppendRaw(string key, byte[] bytes, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the file to append to. - **bytes** (byte[]) - Required - The raw bytes to append. ### Request Example ```csharp byte[] newData = { 4, 5, 6 }; ES3.AppendRaw("logFile.txt", newData); ``` ### Response #### Success Response N/A (void) ## ES3.LoadRawString ### Description Loads a string from a file. ### Method `ES3.LoadRawString(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the file to load. ### Request Example ```csharp string fileContent = ES3.LoadRawString("myTextFile.txt"); ``` ### Response #### Success Response - **string** - The content of the file as a string. ``` -------------------------------- ### Create or Load Spreadsheet (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Initializes a new ES3Spreadsheet object or loads an existing CSV/Excel file. Allows specifying custom settings for loading, such as directory. Uses ES3Settings for configuration. ```csharp // Create new spreadsheet var sheet = new ES3Spreadsheet(); // Load existing spreadsheet var loadedSheet = new ES3Spreadsheet(); loadedSheet.Load("data.csv"); // Load from specific file with settings var settings = new ES3Settings { directory = "Spreadsheets" }; var configSheet = new ES3Spreadsheet(); configSheet.Load("config.csv", settings); ``` -------------------------------- ### Download File from Cloud (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Downloads a remote save file to local storage using ES3Cloud. Includes functionality for checking timestamps to prevent overwriting newer local saves. Requires server URL and API key. ```csharp // Download from cloud var cloud = new ES3Cloud(cloudURL, apiKey); yield return StartCoroutine(cloud.DownloadFile("cloud_save.es3", "local_save.es3")); if (!cloud.isError) { Debug.Log($"Downloaded: {cloud.text}"); LoadLocalSave(); } // Download with overwrite protection IEnumerator DownloadCloudSave() { var cloud = new ES3Cloud(serverURL, userToken); // Check cloud timestamp first yield return StartCoroutine(cloud.DownloadTimestamp("save.es3")); long cloudTime = cloud.timestamp; long localTime = ES3.Load("lastSaveTime", 0); if (cloudTime > localTime) { yield return StartCoroutine(cloud.DownloadFile("save.es3", "local.es3")); Debug.Log("Newer cloud save downloaded"); } } ``` -------------------------------- ### ES3.CreateBackup - Create Backup of Save File Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Creates timestamped backup copies of save files for data recovery. Supports default file, specific files, and custom settings for directory and other options. Useful for protecting game progress before critical changes. ```csharp // Create backup of default file ES3.CreateBackup(); // Create backup of specific file ES3.CreateBackup("critical_data.es3"); // Backup before major changes void SaveWithBackup() { ES3.CreateBackup("game_progress.es3"); ES3.Save("playerLevel", newLevel, "game_progress.es3"); ES3.Save("playerGold", newGold, "game_progress.es3"); } // Create backup with custom settings var settings = new ES3Settings { directory = "Backups" }; ES3.CreateBackup("main_save.es3", settings); ``` -------------------------------- ### ES3Writer.Create - Create Custom Writer for Batch Operations Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Provides low-level control for writing multiple values to a save file efficiently, especially for batch operations. Allows writing individual values, properties, and supports custom settings like encryption. Uses a `using` statement for proper resource management. ```csharp // Batch write with ES3Writer using (var writer = ES3Writer.Create("batch_save.es3")) { writer.Write("playerName", "Hero"); writer.Write("playerLevel", 50); writer.Write("playerPosition", transform.position); writer.Write("playerInventory", inventoryList); } // Write with custom settings var settings = new ES3Settings { encryptionType = ES3.EncryptionType.AES, encryptionPassword = "key123" }; using (var writer = ES3Writer.Create("encrypted.es3", settings)) { writer.Write("secretData", sensitiveInfo); } // Write properties using (var writer = ES3Writer.Create("data.es3")) { writer.WriteProperty("version", 1); writer.WriteProperty("timestamp", System.DateTime.Now.Ticks); } ``` -------------------------------- ### Caching Methods Source: https://docs.moodkie.com/product/easy-save-3/es3-api/es3-methods Methods for caching files to improve load times. ```APIDOC ## ES3.CacheFile ### Description Caches a file for faster access. ### Method `ES3.CacheFile(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the file to cache. ### Request Example ```csharp ES3.CacheFile("large_asset.dat"); ``` ### Response #### Success Response N/A (void) ## ES3.StoreCachedFile ### Description Stores a cached file persistently. ### Method `ES3.StoreCachedFile(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key of the cached file to store. ### Request Example ```csharp ES3.StoreCachedFile("large_asset.dat"); ``` ### Response #### Success Response N/A (void) ``` -------------------------------- ### Upload File to Cloud (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Uploads a local save file to a remote server using ES3Cloud. Supports custom POST fields for additional data. Requires server URL and API key. ```csharp // Upload to cloud var cloud = new ES3Cloud("https://api.example.com/saves/", "user_api_key"); yield return StartCoroutine(cloud.UploadFile("local_save.es3")); if (cloud.isError) { Debug.LogError($"Upload failed: {cloud.error} (Code: {cloud.errorCode})"); } else { Debug.Log("Upload complete!"); } // Upload with custom data var cloud = new ES3Cloud(serverURL, apiKey); cloud.AddPOSTField("userId", currentUserId); cloud.AddPOSTField("platform", Application.platform.ToString()); yield return StartCoroutine(cloud.UploadFile("profile.es3")); ``` -------------------------------- ### Copy Save File with ES3.CopyFile Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Creates backup copies or duplicate save slots by copying a file from a source to a destination. It supports specifying different storage locations using ES3Settings for both source and destination. ```csharp // Create backup ES3.CopyFile("autosave.es3", "backup_autosave.es3"); // Copy to different location var sourceSettings = new ES3Settings(ES3.Location.File); var destSettings = new ES3Settings(ES3.Location.PlayerPrefs); ES3.CopyFile("local.es3", "prefs.es3", sourceSettings, destSettings); // Duplicate save slot void DuplicateSaveSlot(int sourceSlot, int destSlot) { string source = $"slot_{sourceSlot}.es3"; string dest = $"slot_{destSlot}.es3"; if (ES3.FileExists(source)) { ES3.CopyFile(source, dest); } } ``` -------------------------------- ### Search Cloud Files (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Searches cloud storage for files matching a specified pattern using ES3Cloud. Returns an array of filenames that match the pattern. Requires server URL and API key. ```csharp // Search for specific files var cloud = new ES3Cloud(cloudURL, apiKey); yield return StartCoroutine(cloud.SearchFilenames("save_slot_*")); if (!cloud.isError) { Debug.Log($"Found {cloud.filenames.Length} matching files"); foreach (string file in cloud.filenames) { Debug.Log(file); } } // Search user-specific saves IEnumerator FindUserSaves(string userId) { var cloud = new ES3Cloud(serverURL, token); string searchPattern = $"user_{userId}_*.es3"; yield return StartCoroutine(cloud.SearchFilenames(searchPattern)); return cloud.filenames; } ``` -------------------------------- ### ES3Spreadsheet Methods Source: https://docs.moodkie.com/product/easy-save-3/es3-api/es3-methods Methods for working with spreadsheet data. ```APIDOC ## ES3Spreadsheet.SetCell ### Description Sets the value of a cell in the spreadsheet. ### Method `ES3Spreadsheet.SetCell(int row, int column, object value, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **row** (int) - Required - The row index of the cell. - **column** (int) - Required - The column index of the cell. - **value** (object) - Required - The value to set. ### Request Example ```csharp ES3Spreadsheet.SetCell(0, 0, "Player Name"); ES3Spreadsheet.SetCell(1, 0, "Alice"); ``` ### Response #### Success Response N/A (void) ## ES3Spreadsheet.GetCell ### Description Gets the value of a cell from the spreadsheet. ### Method `ES3Spreadsheet.GetCell(int row, int column, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **row** (int) - Required - The row index of the cell. - **column** (int) - Required - The column index of the cell. ### Request Example ```csharp string playerName = ES3Spreadsheet.GetCell(1, 0); ``` ### Response #### Success Response - **object** - The value of the cell. ## ES3Spreadsheet.Save ### Description Saves the current spreadsheet data. ### Method `ES3Spreadsheet.Save(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key to save the spreadsheet under. ### Request Example ```csharp ES3Spreadsheet.Save("leaderboard"); ``` ### Response #### Success Response N/A (void) ## ES3Spreadsheet.Load ### Description Loads spreadsheet data from a key. ### Method `ES3Spreadsheet.Load(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key to load the spreadsheet from. ### Request Example ```csharp ES3Spreadsheet.Load("leaderboard"); ``` ### Response #### Success Response N/A (void) ## ES3Spreadsheet.RowCount ### Description Gets the number of rows in the spreadsheet. ### Method `ES3Spreadsheet.RowCount(...)` ### Endpoint N/A (Scripting API) ### Request Example ```csharp int rowCount = ES3Spreadsheet.RowCount(); ``` ### Response #### Success Response - **int** - The number of rows. ## ES3Spreadsheet.ColumnCount ### Description Gets the number of columns in the spreadsheet. ### Method `ES3Spreadsheet.ColumnCount(...)` ### Endpoint N/A (Scripting API) ### Request Example ```csharp int colCount = ES3Spreadsheet.ColumnCount(); ``` ### Response #### Success Response - **int** - The number of columns. ## ES3Spreadsheet.GetColumnLength ### Description Gets the number of rows in a specific column. ### Method `ES3Spreadsheet.GetColumnLength(int column, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **column** (int) - Required - The column index. ### Request Example ```csharp int columnLength = ES3Spreadsheet.GetColumnLength(0); ``` ### Response #### Success Response - **int** - The number of rows in the column. ## ES3Spreadsheet.GetRowLength ### Description Gets the number of columns in a specific row. ### Method `ES3Spreadsheet.GetRowLength(int row, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **row** (int) - Required - The row index. ### Request Example ```csharp int rowLength = ES3Spreadsheet.GetRowLength(0); ``` ### Response #### Success Response - **int** - The number of columns in the row. ``` -------------------------------- ### List Cloud Files (C#) Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Retrieves an array of all filenames stored in cloud storage using ES3Cloud. Used to populate UI elements or iterate through cloud saves. Requires server URL and API key. ```csharp // Get list of cloud files var cloud = new ES3Cloud(cloudURL, apiKey); yield return StartCoroutine(cloud.DownloadFilenames()); if (!cloud.isError) { foreach (string filename in cloud.filenames) { Debug.Log($"Cloud file: {filename}"); CreateCloudFileButton(filename); } } // Display cloud saves in UI IEnumerator PopulateCloudSaves() { var cloud = new ES3Cloud(serverURL, userToken); yield return StartCoroutine(cloud.DownloadFilenames()); if (!cloud.isError) { cloudSavesList.ClearItems(); foreach (string file in cloud.filenames) { cloudSavesList.AddItem(file); } } } ``` -------------------------------- ### ES3.AppendRaw - Append Raw Data to File Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Appends raw data, either as a string or byte array, to an existing file without overwriting its content. Ideal for logging, streaming data, or adding multiple entries to a file sequentially. Supports appending text log entries or binary data. ```csharp // Append log entries string logEntry = $"[{System.DateTime.Now}] Player logged in\n"; ES3.AppendRaw(logEntry, "game_log.txt"); // Append multiple entries void LogGameEvent(string eventName) { string entry = $"{System.DateTime.Now:HH:mm:ss} - {eventName}\n"; ES3.AppendRaw(entry, "events.log"); } // Append byte data byte[] additionalData = new byte[] { 0x01, 0x02, 0x03 }; ES3.AppendRaw(additionalData, "data_stream.bin"); ``` -------------------------------- ### Load Data with ES3.Load Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Retrieves saved data by its key with type safety. Provides default values if the key is not found. Can load from specific files and supports encrypted data. ```csharp // Load basic types with defaults int level = ES3.Load("playerLevel", defaultValue: 1); string name = ES3.Load("playerName", "DefaultName"); float[] scores = ES3.Load("highScores", new float[] { 0f, 0f, 0f }); // Load from custom file Vector3 pos = ES3.Load("lastPosition", "customSave.es3"); // Load with encryption var secureSettings = new ES3Settings { encryptionType = ES3.EncryptionType.AES, encryptionPassword = "mySecretKey123" }; string secret = ES3.Load("secretData", secureSettings); // Load complex objects PlayerData loadedData = ES3.Load("playerData"); Debug.Log($"Loaded: {loadedData.name}, Level {loadedData.level}"); // Check existence before loading if (ES3.KeyExists("playerLevel")) { int safeLevel = ES3.Load("playerLevel"); } ``` -------------------------------- ### Load Data into Object with ES3.LoadInto Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Loads data directly into an existing object instance, preserving object references. Useful for updating game state or loading into pre-instantiated GameObjects. ```csharp // Load into existing object public class GameManager : MonoBehaviour { public PlayerData playerData = new PlayerData(); void LoadGame() { ES3.LoadInto("playerData", playerData); // playerData now contains loaded values } } // Load into GameObject public GameObject playerObject; void LoadPlayer() { if (ES3.KeyExists("player")) { ES3.LoadInto("player", playerObject); // All components and values loaded into existing GameObject } } ``` -------------------------------- ### ES3Writer Methods Source: https://docs.moodkie.com/product/easy-save-3/es3-api/es3-methods Methods for writing data to a file using ES3Writer. ```APIDOC ## ES3Writer.Create ### Description Creates a new ES3Writer. ### Method `ES3Writer.Create(string key, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **key** (string) - Required - The key for the file to write to. ### Request Example ```csharp ES3Writer writer = ES3Writer.Create("myCustomData.dat"); ``` ### Response #### Success Response - **ES3Writer** - The created writer object. ## ES3Writer.WriteProperty ### Description Writes a property to the current ES3Writer. ### Method `ES3Writer.WriteProperty(string propertyName, object value, ...)` ### Endpoint N/A (Scripting API) ### Parameters - **propertyName** (string) - Required - The name of the property. - **value** (object) - Required - The value of the property. ### Request Example ```csharp writer.WriteProperty("health", 100); writer.WriteProperty("mana", 50); ``` ### Response #### Success Response N/A (void) ``` -------------------------------- ### Save Data with ES3.Save Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Saves various data types to a file using a unique key. Supports optional encryption, compression, and custom storage locations. Handles primitives, arrays, complex serializable objects, and Unity types. ```csharp // Save basic types ES3.Save("playerLevel", 42); ES3.Save("playerName", "Hero"); ES3.Save("highScores", new float[] { 100.5f, 95.2f, 88.7f }); // Save to custom file with settings var settings = new ES3Settings(ES3.Location.PlayerPrefs); ES3.Save("lastPosition", transform.position, "customSave.es3", settings); // Save with encryption var secureSettings = new ES3Settings { encryptionType = ES3.EncryptionType.AES, encryptionPassword = "mySecretKey123" }; ES3.Save("secretData", "classified", secureSettings); // Save complex objects [System.Serializable] public class PlayerData { public string name; public int level; public Vector3 position; } PlayerData data = new PlayerData { name = "Player1", level = 10, position = new Vector3(1, 2, 3) }; ES3.Save("playerData", data); ``` -------------------------------- ### ES3.RestoreBackup - Restore from Backup Source: https://context7.com/context7/moodkie_product_easy-save-3/llms.txt Recovers data from the most recent backup file. Can restore the default save file, a specific file, or be used within error handling blocks to recover from load failures. Supports user-initiated restores with confirmation. ```csharp // Restore from backup ES3.RestoreBackup(); // Restore specific file ES3.RestoreBackup("game_progress.es3"); // Restore with error recovery try { LoadGameData(); } catch (System.Exception e) { Debug.LogError($"Load failed: {e.Message}. Restoring backup..."); ES3.RestoreBackup(); LoadGameData(); } // User-initiated restore void RestoreLastSave() { if (ConfirmRestore()) { ES3.RestoreBackup("autosave.es3"); ReloadGame(); } } ```