/// <summary>Reads a user data file. (Standalone Application)</summary> public static void ReadFile_Standalone(string filePath, ReadFileCallback callback) { Debug.Assert(!string.IsNullOrEmpty(filePath)); Debug.Assert(callback != null); byte[] data = null; data = IOUtilities.LoadBinaryFile(filePath); callback.Invoke(true, data); }
// --- File I/O --- /// <summary>Reads a file.</summary> public void ReadFile(string relativePath, ReadFileCallback callback) { Debug.Assert(!string.IsNullOrEmpty(relativePath)); Debug.Assert(callback != null); string path = IOUtilities.CombinePath(this.userDir, relativePath); byte[] data; bool success = this.ReadFile(path, out data); callback.Invoke(relativePath, success, data); }
/// <summary>Loads the user data file. (Facepunch.Steamworks)</summary> public static void ReadFile_Facepunch(string filePath, ReadFileCallback callback) { Debug.Assert(!string.IsNullOrEmpty(filePath)); Debug.Assert(callback != null); byte[] data = null; if (Steamworks.SteamRemoteStorage.FileExists(filePath)) { data = Steamworks.SteamRemoteStorage.FileRead(filePath); } callback.Invoke(true, data); }
// --- File I/O --- /// <summary>Reads a file.</summary> public void ReadFile(string relativePath, ReadFileCallback callback) { Debug.Assert(!string.IsNullOrEmpty(relativePath)); Debug.Assert(callback != null); string path = IOUtilities.CombinePath(this.userDir, relativePath); byte[] data = null; if (Steamworks.SteamRemoteStorage.FileExists(path)) { data = Steamworks.SteamRemoteStorage.FileRead(path); } callback.Invoke(relativePath, (data != null), data); }
/// <summary>Reads a user data file. (Steamworks.NET)</summary> public static void ReadFile_SteamworksNET(string filePath, ReadFileCallback callback) { Debug.Assert(!string.IsNullOrEmpty(filePath)); Debug.Assert(callback != null); byte[] data = null; if (Steamworks.SteamRemoteStorage.FileExists(filePath)) { int fileSize = Steamworks.SteamRemoteStorage.GetFileSize(filePath); if (fileSize > 0) { data = new byte[fileSize]; Steamworks.SteamRemoteStorage.FileRead(filePath, data, fileSize); } } callback.Invoke(true, data); }
// --- File I/O --- /// <summary>Reads a file.</summary> public void ReadFile(string relativePath, ReadFileCallback callback) { Debug.Assert(!string.IsNullOrEmpty(relativePath)); Debug.Assert(callback != null); string path = IOUtilities.CombinePath(this.UserDirectory, relativePath); byte[] data = null; if (Steamworks.SteamRemoteStorage.FileExists(path)) { int fileSize = Steamworks.SteamRemoteStorage.GetFileSize(path); if (fileSize > 0) { data = new byte[fileSize]; Steamworks.SteamRemoteStorage.FileRead(path, data, fileSize); } } callback.Invoke(relativePath, (data != null), data); }