/// <summary>Writes a JSON file.</summary> public static bool WriteJSONFile <T>(string path, T jsonObject) { bool success = false; byte[] data = IOUtilities.GenerateUTF8JSONData <T>(jsonObject); if (data != null && data.Length > 0) { success = LocalDataStorage.WriteFile(path, data); } else { Debug.LogWarning("[mod.io] Failed create JSON representation of object before writing file." + "\nFile: " + path + "\n\n"); } return(success); }
/// <summary>Function used to read a user data file.</summary> public static void WriteJSONFile <T>(string relativePath, T jsonObject, WriteFileCallback callback) { byte[] data = IOUtilities.GenerateUTF8JSONData <T>(jsonObject); if (data != null) { UserDataStorage.WriteFile(relativePath, data, callback); } else { Debug.LogWarning("[mod.io] Failed create JSON representation of object before writing file." + "\nFile: " + relativePath + "\n\n"); if (callback != null) { callback.Invoke(relativePath, false); } } }
/// <summary>Writes a JSON file.</summary> public static void WriteJSONFile <T>(string path, T jsonObject, WriteFileCallback onComplete) { byte[] data = IOUtilities.GenerateUTF8JSONData <T>(jsonObject); if (data != null && data.Length > 0) { DataStorage.PLATFORM_IO.WriteFile(path, data, onComplete); } else { Debug.LogWarning("[mod.io] Failed create JSON representation of object before writing file." + "\nFile: " + path + "\n\n"); if (onComplete != null) { onComplete.Invoke(path, false); } } }