public TurnSignalPrefs SteamLoad() { if (SteamManager.Initialized && SteamRemoteStorage.IsCloudEnabledForAccount()) { if (SteamRemoteStorage.FileExists(_fileName)) { string text = ""; var byteCount = SteamRemoteStorage.GetFileSize(_fileName); var bytes = new byte[byteCount]; Debug.Log("Reading Prefs from SteamCloud!"); var fileC = SteamRemoteStorage.FileRead(_fileName, bytes, byteCount); if (fileC > 0) { text = System.Text.Encoding.ASCII.GetString(bytes); } var o = (TurnSignalPrefs)JsonUtility.FromJson(text, typeof(TurnSignalPrefs)); if (o != null) { return(o); } } } return(null); }
public static T Load(string saveName, int slot = 0) { #if STEAM if (SteamRemoteStorage.FileExists(saveName + "" + slot)) { byte[] bytes = new byte[1024 * 1024]; int ret = SteamRemoteStorage.FileRead(saveName + "" + slot, bytes, bytes.Length); string data = System.Text.Encoding.UTF8.GetString(bytes, 0, ret); return(JsonUtility.FromJson <T>(data)); } #elif UNITY_EDITOR string path = Application.dataPath + "/" + saveName + "" + slot + ".json"; if (File.Exists(path)) { string result = File.ReadAllText(path); return(JsonUtility.FromJson <T>(result)); } #else string result = PlayerPrefs.GetString(saveName + "" + slot, ""); if (!string.IsNullOrEmpty(result)) { return(JsonUtility.FromJson <T>(result)); } #endif return(Activator.CreateInstance <T>()); }
public static Stream GetSaveReadStream(string playerID, bool forceLocal = false) { var pchFile = BASE_SAVE_FILE_NAME + playerID + SAVE_FILE_EXT; if (!forceLocal && PlatformAPISettings.Running) { var cubDataToRead = 2000000; var numArray = new byte[cubDataToRead]; if (!SteamRemoteStorage.FileExists(pchFile)) { return(null); } var count = SteamRemoteStorage.FileRead(pchFile, numArray, cubDataToRead); if (count == 0) { return(null); } Encoding.UTF8.GetString(numArray); return(new MemoryStream(numArray, 0, count)); } if (File.Exists(Standalone_FolderPath + pchFile)) { return(TitleContainer.OpenStream(Standalone_FolderPath + pchFile)); } return(null); }
public override bool HasFile(string path) { lock (ioLock) { return(SteamRemoteStorage.FileExists(path)); } }
private void ReadProgressFile(string fileName, ProgressData progressData) { if (SteamRemoteStorage.FileExists(fileName)) { try { byte[] array = new byte[SteamRemoteStorage.GetFileSize(fileName)]; int num = SteamRemoteStorage.FileRead(fileName, array, array.Length); MemoryStream memoryStream = new MemoryStream(array); BinaryReader binaryReader = new BinaryReader(memoryStream); int num2 = binaryReader.ReadInt32(); int num3 = binaryReader.ReadInt32(); List <ulong> list = new List <ulong>(); List <uint> list2 = new List <uint>(); for (int i = 0; i < num3; i++) { list.Add(binaryReader.ReadUInt64()); list2.Add(binaryReader.ReadUInt32()); } for (int j = 0; j < list.Count; j++) { progressData.Add(list[j], list2[j]); } binaryReader.Close(); memoryStream.Close(); } catch (Exception ex) { Debug.LogError("Error loading " + fileName + ": " + ex); } } }
public static Stream GetSaveReadStream(string playerID, bool forceLocal = false) { string pchFile = RemoteSaveStorage.BASE_SAVE_FILE_NAME + playerID + RemoteSaveStorage.SAVE_FILE_EXT; if (!forceLocal && PlatformAPISettings.Running) { int cubDataToRead = 2000000; byte[] numArray = new byte[cubDataToRead]; if (!SteamRemoteStorage.FileExists(pchFile)) { return((Stream)null); } int count = SteamRemoteStorage.FileRead(pchFile, numArray, cubDataToRead); if (count == 0) { return((Stream)null); } Encoding.UTF8.GetString(numArray); return((Stream) new MemoryStream(numArray, 0, count)); } if (File.Exists(RemoteSaveStorage.Standalone_FolderPath + pchFile)) { return((Stream)File.OpenRead(RemoteSaveStorage.Standalone_FolderPath + pchFile)); } return((Stream)null); }
public override bool FileExists(string filename) { if (!PlatformAPISettings.Running) { return(false); } return(SteamRemoteStorage.FileExists(this.PathPrefix + filename)); }
public unsafe static bool FileExists(string name) { if (!_initialized) { return(false); } return(SteamRemoteStorage.FileExists(name)); }
// Token: 0x060017D6 RID: 6102 RVA: 0x00088510 File Offset: 0x00086910 public bool exists(string path, out bool exists) { if (path == null) { throw new ArgumentNullException("path"); } exists = SteamRemoteStorage.FileExists(path); return(true); }
public static bool CanLoad(string playerID) { var pchFile = BASE_SAVE_FILE_NAME + playerID + SAVE_FILE_EXT; if (PlatformAPISettings.Running) { return(SteamRemoteStorage.FileExists(pchFile)); } return(File.Exists(Standalone_FolderPath + pchFile)); }
public static bool FileExists(string playerID, bool forceLocal = false) { var pchFile = BASE_SAVE_FILE_NAME + playerID + SAVE_FILE_EXT; if (!forceLocal && PlatformAPISettings.Running) { return(SteamRemoteStorage.FileExists(pchFile)); } return(File.Exists(Standalone_FolderPath + pchFile)); }
public static void UploadWorkshopLevel() { if (SteamAPI.IsSteamRunning() && instance.IsRunning) { string path = Level.CurrentLevelButton.Path; string name = Level.CurrentLevelButton.Name; bool fileExists = SteamRemoteStorage.FileExists(name); if (instance.myLevels.Contains(name.ToLower())) { MessageBox.StatusMessage = new MessageBox("Level was already published! Delete it in Steam first", new Vector2(217, 190), 120); } else { MessageBox.StatusMessage = new MessageBox("Publishing to the workshop...", new Vector2(217, 190), 999999); instance.IsPublishing = true; Console.WriteLine("Fetching file data..."); string levelData = File.ReadAllText(path + "/LevelData.xml"); // Upload level data byte[] Data = new byte[Encoding.UTF8.GetByteCount(levelData)]; Encoding.UTF8.GetBytes(levelData, 0, levelData.Length, Data, 0); Console.WriteLine("Starting file upload..."); bool isSuccess = SteamRemoteStorage.FileWrite(name, Data, Data.Length); // Upload preview image Data = File.ReadAllBytes(LevelSaver.CustomLevelsPath + "/Preview.png"); Console.WriteLine("Starting preview file upload..."); string previewFileName = name + "_thumbnail"; isSuccess = isSuccess && SteamRemoteStorage.FileWrite(previewFileName, Data, Data.Length); Console.WriteLine("Finished file upload.. success = " + isSuccess.ToString()); if (isSuccess) { string[] tags = new string[0]; string workshopName = name; string workshopDescription = name; // Publish to workshop SteamAPICall_t handle = SteamRemoteStorage.PublishWorkshopFile(name, previewFileName, SteamUtils.GetAppID(), workshopName, workshopDescription, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic, tags, EWorkshopFileType.k_EWorkshopFileTypeCommunity); Console.WriteLine("Started the workshop upload..."); instance.RemoteStoragePublishFileResult.Set(handle); instance.myLevels.Add(name.ToLower()); } else { instance.IsPublishing = false; System.Windows.Forms.MessageBox.Show( "An unexpected error occured while uploading the level data", "Failed to publish workshop file"); } } } }
// Token: 0x06000B00 RID: 2816 RVA: 0x003CC5DC File Offset: 0x003CA7DC public override bool HasFile(string path) { object obj = this.ioLock; bool result; lock (obj) { result = SteamRemoteStorage.FileExists(path); } return(result); }
private bool DownloadCloudSave() { if (SteamManager.Instance.Initialized && SteamRemoteStorage.FileExists(cloudSaveName)) { SteamAPICall_t fileReadHandle = SteamRemoteStorage.FileReadAsync(cloudSaveName, 0, GetSaveSize()); OnFileReadCallback.Set(fileReadHandle); return(true); } return(false); }
public void Load() { var filePath = Path.Combine(Application.persistentDataPath, _settingFileName); try { if (SteamClient.IsValid && SteamRemoteStorage.FileExists(_settingFileName)) { var str = Encoding.UTF8.GetString(SteamRemoteStorage.FileRead(_settingFileName)); _config = Configuration.LoadFromString(str); } else if (File.Exists(filePath)) { _config = Configuration.LoadFromFile(filePath); } } catch (Exception e) { Debug.LogError(e.Message); } if (_config == null) { _config = new Configuration(); _config.Add("Binds"); _config.Add("UserSettings"); ExecuteDefaultSettings(); Save(); } try { ExecuteUserSettings(); } catch (Exception e) { Debug.LogError(e.ToString()); } try { ExecuteConfigBinds(); } catch (Exception e) { Debug.LogError(e.ToString()); } }
private static void DeletePersistentFile(string path, bool flush) { if (SteamManager.Initialized) { try { if (SteamRemoteStorage.FileExists(path)) { SteamRemoteStorage.FileDelete(path); } } catch (Exception exception) { Debug.LogException(exception); } } }
public override bool HasFile(string path) { bool flag = false; object ioLock; try { Monitor.Enter(ioLock = this.ioLock, ref flag); return(SteamRemoteStorage.FileExists(path)); } finally { if (flag) { Monitor.Exit(ioLock); } } }
public override Stream GetFileReadStream(string filename) { if (!PlatformAPISettings.Running) { return((Stream)null); } int cubDataToRead = 2000000; byte[] numArray = new byte[cubDataToRead]; if (!SteamRemoteStorage.FileExists(this.PathPrefix + filename)) { return((Stream)null); } int count = SteamRemoteStorage.FileRead(this.PathPrefix + filename, numArray, cubDataToRead); Encoding.UTF8.GetString(numArray); return((Stream) new MemoryStream(numArray, 0, count)); }
private static bool TestExistsPersistent(string path) { if (!SteamManager.Initialized) { return(false); } try { if (SteamRemoteStorage.FileExists(path)) { return(true); } } catch (Exception exception) { Debug.LogException(exception); } return(false); }
public static bool ListSaveHeaderFilePatch_changeSaveCount(ref SteamPlatform __instance, ref GameSaveType Type, ref List <PathOfWuxiaSaveHeader> __result) { Heluo.Logger.LogError("ListSaveHeaderFilePatch_changeSaveCount start"); List <PathOfWuxiaSaveHeader> list = new List <PathOfWuxiaSaveHeader>(); string format = (Type == GameSaveType.Auto) ? "PathOfWuxia_{0:00}.autosave" : "PathOfWuxia_{0:00}.save"; int startIndex = 0; int endIndex = saveCount.Value; if (pagination.Value) { startIndex = (currentPage - 1) * countPerPage.Value; endIndex = Math.Min(currentPage * countPerPage.Value, saveCount.Value); } Heluo.Logger.LogError("startIndex:" + startIndex); Heluo.Logger.LogError("endIndex:" + endIndex); for (int i = startIndex; i < endIndex; i++) { PathOfWuxiaSaveHeader pathOfWuxiaSaveHeader = null; string text = string.Format(format, i); if (SteamRemoteStorage.FileExists(text)) { __instance.GetSaveFileHeader(text, ref pathOfWuxiaSaveHeader); } else { pathOfWuxiaSaveHeader = new PathOfWuxiaSaveHeader(); } if (pathOfWuxiaSaveHeader == null) { pathOfWuxiaSaveHeader = new PathOfWuxiaSaveHeader(); } list.Add(pathOfWuxiaSaveHeader); } __result = list; Heluo.Logger.LogError("list.count:" + list.Count); Heluo.Logger.LogError("ListSaveHeaderFilePatch_changeSaveCount end"); return(false); }
private static byte[] ReadPersistentBytes(string path) { if (!SteamManager.Initialized) { return(null); } try { if (SteamRemoteStorage.FileExists(path)) { byte[] array = new byte[SteamRemoteStorage.GetFileSize(path)]; int num = SteamRemoteStorage.FileRead(path, array, array.Length); return(array); } } catch (Exception exception) { Debug.LogException(exception); } return(null); }
private static void ReadSteam() { if (SteamManager.Initialized) { try { if (SteamRemoteStorage.FileExists("progress.txt")) { byte[] array = new byte[SteamRemoteStorage.GetFileSize("progress.txt")]; int count = SteamRemoteStorage.FileRead("progress.txt", array, array.Length); string @string = Encoding.UTF8.GetString(array, 0, count); if (@string.Length > 0) { GameSaveState gameSaveState = savedState = JsonUtility.FromJson <GameSaveState>(@string); } } } catch (Exception exception) { Debug.LogException(exception); } } }
/// <summary> /// This functions saves a file to the workshop. /// Make sure file size doesn't pass the steamworks limit on your app settings. /// </summary> /// <param name="fileName">File Name (actual physical file) example: map.txt</param> /// <param name="fileData">File Data (actual file data)</param> /// <param name="workshopTitle">Workshop Item Title</param> /// <param name="workshopDescription">Workshop Item Description</param> /// <param name="tags">Tags</param> public void SaveToWorkshop(string fileName, string fileData, string workshopTitle, string workshopDescription, string[] tags, string imageLoc) { lastFileName = fileName; bool fileExists = SteamRemoteStorage.FileExists(fileName); if (fileExists) { Debug.Log("Item with that filename already exists"); } else { bool upload = UploadFile(fileName, fileData); if (!upload) { Debug.Log("Upload cannot be completed"); } else { //pass in the image location of the file to a global variable so that it doesn't have to be passed in again and again thisUploadsIamgeLoc = imageLoc; UploadToWorkshop(fileName, workshopTitle, workshopDescription, tags); } } }
public static bool CloudFileExist(string filename) { return(SteamManager.Initialized && SteamRemoteStorage.FileExists(filename)); }
public static void UpdateStorageMethodsFromSourcesToLatest() { var num = -1; for (var index = 0; index < StorageMethods.Count; ++index) { if (StorageMethods[index].DidDeserialize) { num = index; break; } } if (num == -1) { var saveFileManifest1 = ReadOldSysemSteamCloudSaveManifest(); var saveFileManifest2 = ReadOldSysemLocalSaveManifest(); if (saveFileManifest1 == null && saveFileManifest2 == null) { Console.WriteLine("New Game Detected!"); } else { var manifest = new SaveFileManifest(); var utcNow = DateTime.UtcNow; var flag = false; if (saveFileManifest2 != null) { for (var index = 0; index < saveFileManifest2.Accounts.Count; ++index) { var str = RemoteSaveStorage.Standalone_FolderPath + RemoteSaveStorage.BASE_SAVE_FILE_NAME + saveFileManifest2.Accounts[index].FileUsername + RemoteSaveStorage.SAVE_FILE_EXT; if (File.Exists(str)) { var fileInfo = new FileInfo(str); if (fileInfo.Length > 100L) { manifest.AddUser(saveFileManifest2.Accounts[index].Username, saveFileManifest2.Accounts[index].Password, fileInfo.LastWriteTimeUtc, str); } } } for (var index = 0; index < manifest.Accounts.Count; ++index) { if (saveFileManifest2.LastLoggedInUser.Username == manifest.Accounts[index].Username) { manifest.LastLoggedInUser = manifest.Accounts[index]; } } if (manifest.LastLoggedInUser.Username == null) { var index = manifest.Accounts.Count - 1; if (index >= 0) { manifest.LastLoggedInUser = manifest.Accounts[index]; flag = true; } } } if (saveFileManifest1 != null) { for (var index1 = 0; index1 < saveFileManifest1.Accounts.Count; ++index1) { try { var str = RemoteSaveStorage.BASE_SAVE_FILE_NAME + saveFileManifest1.Accounts[index1].FileUsername + RemoteSaveStorage.SAVE_FILE_EXT; if (SteamRemoteStorage.FileExists(str)) { if (SteamRemoteStorage.GetFileSize(str) > 100) { var index2 = -1; for (var index3 = 0; index3 < manifest.Accounts.Count; ++index3) { if (manifest.Accounts[index3].Username == saveFileManifest1.Accounts[index1].Username) { index2 = index3; break; } } if (index2 >= 0) { if (new DateTime(1970, 1, 1, 0, 0, 0) + TimeSpan.FromSeconds(SteamRemoteStorage.GetFileTimestamp(str)) > manifest.Accounts[index2].LastWriteTime) { var saveReadStream = RemoteSaveStorage.GetSaveReadStream(str, false); if (saveReadStream != null) { var saveData = new StreamReader(saveReadStream).ReadToEnd(); saveReadStream.Close(); saveReadStream.Dispose(); RemoteSaveStorage.WriteSaveData(saveData, str, true); } else { MainMenu.AccumErrors = MainMenu.AccumErrors + "WARNING: Cloud account " + saveFileManifest1.Accounts[index1].Username + " failed to convert over to new secure account system.\nRestarting your computer and Hacknet may resolve this issue."; } } } else { var filepath = RemoteSaveStorage.Standalone_FolderPath + RemoteSaveStorage.BASE_SAVE_FILE_NAME + saveFileManifest1.Accounts[index1].Username + RemoteSaveStorage.SAVE_FILE_EXT; var saveReadStream = RemoteSaveStorage.GetSaveReadStream( saveFileManifest1.Accounts[index1].Username, false); if (saveReadStream != null) { RemoteSaveStorage.WriteSaveData( Utils.ReadEntireContentsOfStream(saveReadStream), saveFileManifest1.Accounts[index1].Username, true); manifest.AddUser(saveFileManifest1.Accounts[index1].Username, saveFileManifest1.Accounts[index1].Password, utcNow, filepath); } else { MainMenu.AccumErrors = MainMenu.AccumErrors + "WARNING: Cloud account " + saveFileManifest1.Accounts[index1].Username + " failed to convert over to new secure account system.\nRestarting your computer and Hacknet may resolve this issue."; } } } } } catch (Exception ex) { MainMenu.AccumErrors = MainMenu.AccumErrors + "WARNING: Error upgrading account #" + (index1 + 1) + ":\r\n" + Utils.GenerateReportFromException(ex); if (!HasSentErrorReport) { var extraData = "cloudAccounts: " + (saveFileManifest1 == null ? "NULL" : string.Concat(saveFileManifest1.Accounts.Count)) + " vs localAccounts " + (saveFileManifest2 == null ? "NULL" : string.Concat(saveFileManifest2.Accounts.Count)); Utils.SendThreadedErrorReport(ex, "AccountUpgrade_Error", extraData); HasSentErrorReport = true; } } } if (flag) { for (var index = 0; index < manifest.Accounts.Count; ++index) { if (saveFileManifest2.LastLoggedInUser.Username == manifest.Accounts[index].Username) { manifest.LastLoggedInUser = manifest.Accounts[index]; } } } } var systemStorageMethod = new OldSystemStorageMethod(manifest); for (var index = 0; index < StorageMethods.Count; ++index) { StorageMethods[index].UpdateDataFromOtherManager(systemStorageMethod); } } } else { for (var index = 1; index < StorageMethods.Count; ++index) { StorageMethods[0].UpdateDataFromOtherManager(StorageMethods[index]); } } }
public void RenderOnGUI() { GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height)); GUILayout.Label("Variables:"); GUILayout.Label("m_Message:"); m_Message = GUILayout.TextField(m_Message, 40); GUILayout.Label("m_FileCount: " + m_FileCount); GUILayout.Label("m_FileSize: " + m_FileSize); GUILayout.Label("m_TotalBytes: " + m_TotalBytes); GUILayout.Label("m_FileSizeInBytes: " + m_FileSizeInBytes); GUILayout.Label("m_CloudEnabled: " + m_CloudEnabled); GUILayout.Label("m_FileStream: " + m_FileStream); GUILayout.Label("m_UGCHandle: " + m_UGCHandle); GUILayout.Label("m_PublishedFileId: " + m_PublishedFileId); GUILayout.Label("m_PublishedFileUpdateHandle: " + m_PublishedFileUpdateHandle); GUILayout.Label("m_FileReadAsyncHandle: " + m_FileReadAsyncHandle); GUILayout.EndArea(); GUILayout.BeginVertical("box"); m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33)); if (GUILayout.Button("FileWrite(MESSAGE_FILE_NAME, Data, Data.Length)")) { if ((ulong)System.Text.Encoding.UTF8.GetByteCount(m_Message) > m_TotalBytes) { print("Remote Storage: Quota Exceeded! - Bytes: " + System.Text.Encoding.UTF8.GetByteCount(m_Message) + " - Max: " + m_TotalBytes); } else { byte[] Data = new byte[System.Text.Encoding.UTF8.GetByteCount(m_Message)]; System.Text.Encoding.UTF8.GetBytes(m_Message, 0, m_Message.Length, Data, 0); bool ret = SteamRemoteStorage.FileWrite(MESSAGE_FILE_NAME, Data, Data.Length); print("FileWrite(" + MESSAGE_FILE_NAME + ", Data, " + Data.Length + ") - " + ret); } } if (GUILayout.Button("FileRead(MESSAGE_FILE_NAME, Data, Data.Length)")) { if (m_FileSize > 40) { byte[] c = { 0 }; Debug.Log("RemoteStorage: File was larger than expected. . ."); SteamRemoteStorage.FileWrite(MESSAGE_FILE_NAME, c, 1); } else { byte[] Data = new byte[40]; int ret = SteamRemoteStorage.FileRead(MESSAGE_FILE_NAME, Data, Data.Length); m_Message = System.Text.Encoding.UTF8.GetString(Data, 0, ret); print("FileRead(" + MESSAGE_FILE_NAME + ", Data, " + Data.Length + ") - " + ret); } } if (GUILayout.Button("FileWriteAsync(MESSAGE_FILE_NAME, Data, (uint)Data.Length)")) { byte[] Data = new byte[System.Text.Encoding.UTF8.GetByteCount(m_Message)]; System.Text.Encoding.UTF8.GetBytes(m_Message, 0, m_Message.Length, Data, 0); SteamAPICall_t handle = SteamRemoteStorage.FileWriteAsync(MESSAGE_FILE_NAME, Data, (uint)Data.Length); OnRemoteStorageFileWriteAsyncCompleteCallResult.Set(handle); print("SteamRemoteStorage.FileWriteAsync(" + MESSAGE_FILE_NAME + ", " + Data + ", " + (uint)Data.Length + ") : " + handle); } if (GUILayout.Button("FileReadAsync(MESSAGE_FILE_NAME, Data, (uint)Data.Length)")) { if (m_FileSize > 40) { Debug.Log("RemoteStorage: File was larger than expected. . ."); } else { m_FileReadAsyncHandle = SteamRemoteStorage.FileReadAsync(MESSAGE_FILE_NAME, 0, (uint)m_FileSize); OnRemoteStorageFileReadAsyncCompleteCallResult.Set(m_FileReadAsyncHandle); print("FileReadAsync(" + MESSAGE_FILE_NAME + ", 0, " + (uint)m_FileSize + ") - " + m_FileReadAsyncHandle); } } //SteamRemoteStorage.FileReadAsyncComplete() // Must be called from the RemoteStorageFileReadAsyncComplete_t CallResult. if (GUILayout.Button("FileForget(MESSAGE_FILE_NAME)")) { bool ret = SteamRemoteStorage.FileForget(MESSAGE_FILE_NAME); print("SteamRemoteStorage.FileForget(" + MESSAGE_FILE_NAME + ") : " + ret); } if (GUILayout.Button("FileDelete(MESSAGE_FILE_NAME)")) { bool ret = SteamRemoteStorage.FileDelete(MESSAGE_FILE_NAME); print("SteamRemoteStorage.FileDelete(" + MESSAGE_FILE_NAME + ") : " + ret); } if (GUILayout.Button("FileShare(MESSAGE_FILE_NAME)")) { SteamAPICall_t handle = SteamRemoteStorage.FileShare(MESSAGE_FILE_NAME); OnRemoteStorageFileShareResultCallResult.Set(handle); print("SteamRemoteStorage.FileShare(" + MESSAGE_FILE_NAME + ") : " + handle); } if (GUILayout.Button("SetSyncPlatforms(MESSAGE_FILE_NAME, ERemoteStoragePlatform.k_ERemoteStoragePlatformAll)")) { bool ret = SteamRemoteStorage.SetSyncPlatforms(MESSAGE_FILE_NAME, ERemoteStoragePlatform.k_ERemoteStoragePlatformAll); print("SteamRemoteStorage.SetSyncPlatforms(" + MESSAGE_FILE_NAME + ", " + ERemoteStoragePlatform.k_ERemoteStoragePlatformAll + ") : " + ret); } if (GUILayout.Button("FileWriteStreamOpen(MESSAGE_FILE_NAME)")) { m_FileStream = SteamRemoteStorage.FileWriteStreamOpen(MESSAGE_FILE_NAME); print("SteamRemoteStorage.FileWriteStreamOpen(" + MESSAGE_FILE_NAME + ") : " + m_FileStream); } if (GUILayout.Button("FileWriteStreamWriteChunk(m_FileStream, Data, Data.Length)")) { if ((ulong)System.Text.Encoding.UTF8.GetByteCount(m_Message) > m_TotalBytes) { print("Remote Storage: Quota Exceeded! - Bytes: " + System.Text.Encoding.UTF8.GetByteCount(m_Message) + " - Max: " + m_TotalBytes); } else { byte[] Data = new byte[System.Text.Encoding.UTF8.GetByteCount(m_Message)]; System.Text.Encoding.UTF8.GetBytes(m_Message, 0, m_Message.Length, Data, 0); bool ret = SteamRemoteStorage.FileWriteStreamWriteChunk(m_FileStream, Data, Data.Length); print("FileWriteStreamWriteChunk(" + m_FileStream + ", Data, " + Data.Length + ") - " + ret); } } if (GUILayout.Button("FileWriteStreamClose(m_FileStream)")) { bool ret = SteamRemoteStorage.FileWriteStreamClose(m_FileStream); print("SteamRemoteStorage.FileWriteStreamClose(" + m_FileStream + ") : " + ret); } if (GUILayout.Button("FileWriteStreamCancel(m_FileStream)")) { bool ret = SteamRemoteStorage.FileWriteStreamCancel(m_FileStream); print("SteamRemoteStorage.FileWriteStreamCancel(" + m_FileStream + ") : " + ret); } GUILayout.Label("FileExists(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.FileExists(MESSAGE_FILE_NAME)); GUILayout.Label("FilePersisted(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.FilePersisted(MESSAGE_FILE_NAME)); GUILayout.Label("GetFileSize(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.GetFileSize(MESSAGE_FILE_NAME)); GUILayout.Label("GetFileTimestamp(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.GetFileTimestamp(MESSAGE_FILE_NAME)); GUILayout.Label("GetSyncPlatforms(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.GetSyncPlatforms(MESSAGE_FILE_NAME)); { m_FileCount = SteamRemoteStorage.GetFileCount(); GUILayout.Label("GetFileCount() : " + m_FileCount); } for (int i = 0; i < m_FileCount; ++i) { int FileSize = 0; string FileName = SteamRemoteStorage.GetFileNameAndSize(i, out FileSize); GUILayout.Label("GetFileNameAndSize(i, out FileSize) : " + FileName + " -- " + FileSize); if (FileName == MESSAGE_FILE_NAME) { m_FileSize = FileSize; } } { ulong AvailableBytes; bool ret = SteamRemoteStorage.GetQuota(out m_TotalBytes, out AvailableBytes); GUILayout.Label("GetQuota(out m_TotalBytes, out AvailableBytes) : " + ret + " -- " + m_TotalBytes + " -- " + AvailableBytes); } GUILayout.Label("IsCloudEnabledForAccount() : " + SteamRemoteStorage.IsCloudEnabledForAccount()); { m_CloudEnabled = SteamRemoteStorage.IsCloudEnabledForApp(); GUILayout.Label("IsCloudEnabledForApp() : " + m_CloudEnabled); } if (GUILayout.Button("SetCloudEnabledForApp(!m_CloudEnabled)")) { SteamRemoteStorage.SetCloudEnabledForApp(!m_CloudEnabled); print("SteamRemoteStorage.SetCloudEnabledForApp(" + !m_CloudEnabled + ")"); } if (GUILayout.Button("UGCDownload(m_UGCHandle, 0)")) { SteamAPICall_t handle = SteamRemoteStorage.UGCDownload(m_UGCHandle, 0); OnRemoteStorageDownloadUGCResultCallResult.Set(handle); print("SteamRemoteStorage.UGCDownload(" + m_UGCHandle + ", " + 0 + ") : " + handle); } { int BytesDownloaded; int BytesExpected; bool ret = SteamRemoteStorage.GetUGCDownloadProgress(m_UGCHandle, out BytesDownloaded, out BytesExpected); GUILayout.Label("GetUGCDownloadProgress(m_UGCHandle, out BytesDownloaded, out BytesExpected) : " + ret + " -- " + BytesDownloaded + " -- " + BytesExpected); } // Spams warnings if called with an empty handle if (m_UGCHandle != (UGCHandle_t)0) { AppId_t AppID; string Name; CSteamID SteamIDOwner; bool ret = SteamRemoteStorage.GetUGCDetails(m_UGCHandle, out AppID, out Name, out m_FileSizeInBytes, out SteamIDOwner); GUILayout.Label("GetUGCDetails(m_UGCHandle, out AppID, Name, out FileSizeInBytes, out SteamIDOwner) : " + ret + " -- " + AppID + " -- " + Name + " -- " + m_FileSizeInBytes + " -- " + SteamIDOwner); } else { GUILayout.Label("GetUGCDetails(m_UGCHandle, out AppID, Name, out FileSizeInBytes, out SteamIDOwner) : "); } if (GUILayout.Button("UGCRead(m_UGCHandle, Data, m_FileSizeInBytes, 0, EUGCReadAction.k_EUGCRead_Close)")) { byte[] Data = new byte[m_FileSizeInBytes]; int ret = SteamRemoteStorage.UGCRead(m_UGCHandle, Data, m_FileSizeInBytes, 0, EUGCReadAction.k_EUGCRead_Close); print("SteamRemoteStorage.UGCRead(" + m_UGCHandle + ", " + Data + ", " + m_FileSizeInBytes + ", " + 0 + ", " + EUGCReadAction.k_EUGCRead_Close + ") : " + ret); } GUILayout.Label("GetCachedUGCCount() : " + SteamRemoteStorage.GetCachedUGCCount()); GUILayout.Label("GetCachedUGCHandle(0) : " + SteamRemoteStorage.GetCachedUGCHandle(0)); //SteamRemoteStorage.GetFileListFromServer() // PS3 Only. //SteamRemoteStorage.FileFetch() // PS3 Only. //SteamRemoteStorage.FilePersist() // PS3 Only. //SteamRemoteStorage.SynchronizeToClient() // PS3 Only. //SteamRemoteStorage.SynchronizeToServer() // PS3 Only. //SteamRemoteStorage.ResetFileRequestState() // PS3 Only. if (GUILayout.Button("PublishWorkshopFile(MESSAGE_FILE_NAME, null, SteamUtils.GetAppID(), \"Title!\", \"Description!\", ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic, Tags, EWorkshopFileType.k_EWorkshopFileTypeCommunity)")) { string[] Tags = { "Test1", "Test2", "Test3" }; SteamAPICall_t handle = SteamRemoteStorage.PublishWorkshopFile(MESSAGE_FILE_NAME, null, SteamUtils.GetAppID(), "Title!", "Description!", ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic, Tags, EWorkshopFileType.k_EWorkshopFileTypeCommunity); OnRemoteStoragePublishFileProgressCallResult.Set(handle); print("SteamRemoteStorage.PublishWorkshopFile(" + MESSAGE_FILE_NAME + ", " + null + ", " + SteamUtils.GetAppID() + ", " + "\"Title!\"" + ", " + "\"Description!\"" + ", " + ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic + ", " + Tags + ", " + EWorkshopFileType.k_EWorkshopFileTypeCommunity + ") : " + handle); } if (GUILayout.Button("CreatePublishedFileUpdateRequest(m_PublishedFileId)")) { m_PublishedFileUpdateHandle = SteamRemoteStorage.CreatePublishedFileUpdateRequest(m_PublishedFileId); print("SteamRemoteStorage.CreatePublishedFileUpdateRequest(" + m_PublishedFileId + ") : " + m_PublishedFileUpdateHandle); } if (GUILayout.Button("UpdatePublishedFileFile(m_PublishedFileUpdateHandle, MESSAGE_FILE_NAME)")) { bool ret = SteamRemoteStorage.UpdatePublishedFileFile(m_PublishedFileUpdateHandle, MESSAGE_FILE_NAME); print("SteamRemoteStorage.UpdatePublishedFileFile(" + m_PublishedFileUpdateHandle + ", " + MESSAGE_FILE_NAME + ") : " + ret); } if (GUILayout.Button("UpdatePublishedFilePreviewFile(m_PublishedFileUpdateHandle, null)")) { bool ret = SteamRemoteStorage.UpdatePublishedFilePreviewFile(m_PublishedFileUpdateHandle, null); print("SteamRemoteStorage.UpdatePublishedFilePreviewFile(" + m_PublishedFileUpdateHandle + ", " + null + ") : " + ret); } if (GUILayout.Button("UpdatePublishedFileTitle(m_PublishedFileUpdateHandle, \"New Title\")")) { bool ret = SteamRemoteStorage.UpdatePublishedFileTitle(m_PublishedFileUpdateHandle, "New Title"); print("SteamRemoteStorage.UpdatePublishedFileTitle(" + m_PublishedFileUpdateHandle + ", " + "\"New Title\"" + ") : " + ret); } if (GUILayout.Button("UpdatePublishedFileDescription(m_PublishedFileUpdateHandle, \"New Description\")")) { bool ret = SteamRemoteStorage.UpdatePublishedFileDescription(m_PublishedFileUpdateHandle, "New Description"); print("SteamRemoteStorage.UpdatePublishedFileDescription(" + m_PublishedFileUpdateHandle + ", " + "\"New Description\"" + ") : " + ret); } if (GUILayout.Button("UpdatePublishedFileVisibility(m_PublishedFileUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic)")) { bool ret = SteamRemoteStorage.UpdatePublishedFileVisibility(m_PublishedFileUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic); print("SteamRemoteStorage.UpdatePublishedFileVisibility(" + m_PublishedFileUpdateHandle + ", " + ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic + ") : " + ret); } if (GUILayout.Button("UpdatePublishedFileTags(m_PublishedFileUpdateHandle, new string[] {\"First\", \"Second\", \"Third\"})")) { bool ret = SteamRemoteStorage.UpdatePublishedFileTags(m_PublishedFileUpdateHandle, new string[] { "First", "Second", "Third" }); print("SteamRemoteStorage.UpdatePublishedFileTags(" + m_PublishedFileUpdateHandle + ", " + new string[] { "First", "Second", "Third" } +") : " + ret); } if (GUILayout.Button("CommitPublishedFileUpdate(m_PublishedFileUpdateHandle)")) { SteamAPICall_t handle = SteamRemoteStorage.CommitPublishedFileUpdate(m_PublishedFileUpdateHandle); OnRemoteStorageUpdatePublishedFileResultCallResult.Set(handle); print("SteamRemoteStorage.CommitPublishedFileUpdate(" + m_PublishedFileUpdateHandle + ") : " + handle); } if (GUILayout.Button("GetPublishedFileDetails(m_PublishedFileId, 0)")) { SteamAPICall_t handle = SteamRemoteStorage.GetPublishedFileDetails(m_PublishedFileId, 0); OnRemoteStorageGetPublishedFileDetailsResultCallResult.Set(handle); print("SteamRemoteStorage.GetPublishedFileDetails(" + m_PublishedFileId + ", " + 0 + ") : " + handle); } if (GUILayout.Button("DeletePublishedFile(m_PublishedFileId)")) { SteamAPICall_t handle = SteamRemoteStorage.DeletePublishedFile(m_PublishedFileId); OnRemoteStorageDeletePublishedFileResultCallResult.Set(handle); print("SteamRemoteStorage.DeletePublishedFile(" + m_PublishedFileId + ") : " + handle); } if (GUILayout.Button("EnumerateUserPublishedFiles(0)")) { SteamAPICall_t handle = SteamRemoteStorage.EnumerateUserPublishedFiles(0); OnRemoteStorageEnumerateUserPublishedFilesResultCallResult.Set(handle); print("SteamRemoteStorage.EnumerateUserPublishedFiles(" + 0 + ") : " + handle); } if (GUILayout.Button("SubscribePublishedFile(m_PublishedFileId)")) { SteamAPICall_t handle = SteamRemoteStorage.SubscribePublishedFile(m_PublishedFileId); OnRemoteStorageSubscribePublishedFileResultCallResult.Set(handle); print("SteamRemoteStorage.SubscribePublishedFile(" + m_PublishedFileId + ") : " + handle); } if (GUILayout.Button("EnumerateUserSubscribedFiles(0)")) { SteamAPICall_t handle = SteamRemoteStorage.EnumerateUserSubscribedFiles(0); OnRemoteStorageEnumerateUserSubscribedFilesResultCallResult.Set(handle); print("SteamRemoteStorage.EnumerateUserSubscribedFiles(" + 0 + ") : " + handle); } if (GUILayout.Button("UnsubscribePublishedFile(m_PublishedFileId)")) { SteamAPICall_t handle = SteamRemoteStorage.UnsubscribePublishedFile(m_PublishedFileId); OnRemoteStorageUnsubscribePublishedFileResultCallResult.Set(handle); print("SteamRemoteStorage.UnsubscribePublishedFile(" + m_PublishedFileId + ") : " + handle); } if (GUILayout.Button("UpdatePublishedFileSetChangeDescription(m_PublishedFileUpdateHandle, \"Changelog!\")")) { bool ret = SteamRemoteStorage.UpdatePublishedFileSetChangeDescription(m_PublishedFileUpdateHandle, "Changelog!"); print("SteamRemoteStorage.UpdatePublishedFileSetChangeDescription(" + m_PublishedFileUpdateHandle + ", " + "\"Changelog!\"" + ") : " + ret); } if (GUILayout.Button("GetPublishedItemVoteDetails(m_PublishedFileId)")) { SteamAPICall_t handle = SteamRemoteStorage.GetPublishedItemVoteDetails(m_PublishedFileId); OnRemoteStorageGetPublishedItemVoteDetailsResultCallResult.Set(handle); print("SteamRemoteStorage.GetPublishedItemVoteDetails(" + m_PublishedFileId + ") : " + handle); } if (GUILayout.Button("UpdateUserPublishedItemVote(m_PublishedFileId, true)")) { SteamAPICall_t handle = SteamRemoteStorage.UpdateUserPublishedItemVote(m_PublishedFileId, true); OnRemoteStorageUpdateUserPublishedItemVoteResultCallResult.Set(handle); print("SteamRemoteStorage.UpdateUserPublishedItemVote(" + m_PublishedFileId + ", " + true + ") : " + handle); } if (GUILayout.Button("GetUserPublishedItemVoteDetails(m_PublishedFileId)")) { SteamAPICall_t handle = SteamRemoteStorage.GetUserPublishedItemVoteDetails(m_PublishedFileId); OnRemoteStorageGetPublishedItemVoteDetailsResultCallResult.Set(handle); print("SteamRemoteStorage.GetUserPublishedItemVoteDetails(" + m_PublishedFileId + ") : " + handle); } if (GUILayout.Button("EnumerateUserSharedWorkshopFiles(SteamUser.GetSteamID(), 0, null, null)")) { SteamAPICall_t handle = SteamRemoteStorage.EnumerateUserSharedWorkshopFiles(SteamUser.GetSteamID(), 0, null, null); OnRemoteStorageEnumerateUserPublishedFilesResultCallResult.Set(handle); print("SteamRemoteStorage.EnumerateUserSharedWorkshopFiles(" + SteamUser.GetSteamID() + ", " + 0 + ", " + null + ", " + null + ") : " + handle); } if (GUILayout.Button("PublishVideo(EWorkshopVideoProvider.k_EWorkshopVideoProviderYoutube, \"William Hunter\", \"Rmvb4Hktv7U\", null, SteamUtils.GetAppID(), \"Test Video\", \"Desc\", ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic, null)")) { SteamAPICall_t handle = SteamRemoteStorage.PublishVideo(EWorkshopVideoProvider.k_EWorkshopVideoProviderYoutube, "William Hunter", "Rmvb4Hktv7U", null, SteamUtils.GetAppID(), "Test Video", "Desc", ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic, null); OnRemoteStoragePublishFileProgressCallResult.Set(handle); print("SteamRemoteStorage.PublishVideo(" + EWorkshopVideoProvider.k_EWorkshopVideoProviderYoutube + ", " + "\"William Hunter\"" + ", " + "\"Rmvb4Hktv7U\"" + ", " + null + ", " + SteamUtils.GetAppID() + ", " + "\"Test Video\"" + ", " + "\"Desc\"" + ", " + ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic + ", " + null + ") : " + handle); } if (GUILayout.Button("SetUserPublishedFileAction(m_PublishedFileId, EWorkshopFileAction.k_EWorkshopFileActionPlayed)")) { SteamAPICall_t handle = SteamRemoteStorage.SetUserPublishedFileAction(m_PublishedFileId, EWorkshopFileAction.k_EWorkshopFileActionPlayed); OnRemoteStorageSetUserPublishedFileActionResultCallResult.Set(handle); print("SteamRemoteStorage.SetUserPublishedFileAction(" + m_PublishedFileId + ", " + EWorkshopFileAction.k_EWorkshopFileActionPlayed + ") : " + handle); } if (GUILayout.Button("EnumeratePublishedFilesByUserAction(EWorkshopFileAction.k_EWorkshopFileActionPlayed, 0)")) { SteamAPICall_t handle = SteamRemoteStorage.EnumeratePublishedFilesByUserAction(EWorkshopFileAction.k_EWorkshopFileActionPlayed, 0); OnRemoteStorageEnumeratePublishedFilesByUserActionResultCallResult.Set(handle); print("SteamRemoteStorage.EnumeratePublishedFilesByUserAction(" + EWorkshopFileAction.k_EWorkshopFileActionPlayed + ", " + 0 + ") : " + handle); } if (GUILayout.Button("EnumeratePublishedWorkshopFiles(EWorkshopEnumerationType.k_EWorkshopEnumerationTypeRankedByVote, 0, 3, 0, null, null)")) { SteamAPICall_t handle = SteamRemoteStorage.EnumeratePublishedWorkshopFiles(EWorkshopEnumerationType.k_EWorkshopEnumerationTypeRankedByVote, 0, 3, 0, null, null); OnRemoteStorageEnumerateWorkshopFilesResultCallResult.Set(handle); print("SteamRemoteStorage.EnumeratePublishedWorkshopFiles(" + EWorkshopEnumerationType.k_EWorkshopEnumerationTypeRankedByVote + ", " + 0 + ", " + 3 + ", " + 0 + ", " + null + ", " + null + ") : " + handle); } //SteamRemoteStorage.UGCDownloadToLocation() // There is absolutely no documentation on how to use this function GUILayout.EndScrollView(); GUILayout.EndVertical(); }
public static CloudItem GetCloudData() { if (!SteamRemoteStorage.FileExists("CloudInfo.bson")) { throw new Exception("There's no CloudInfo.bson, but it should exist. " + "Check your Cloud Manager inside TTS."); } if (!SteamRemoteStorage.FileExists("CloudFolder.bson")) { throw new Exception("There's no CloudFolder.bson, but it should exist. " + "Check your Cloud Manager inside TTS."); } var data = GetFile("CloudInfo.bson"); BackupFile("CloudInfo.bson", data); var cloud_info = ParseBson <Dictionary <string, CloudData> >(data); if (cloud_info == null) { throw new Exception("There's something weird with your CloudInfo.bson, " + "which is in your local folder. Please, save it and report it to the github page:"); } var folders = new Dictionary <string, CloudItem>(); var folder_tree_root = new CloudItem("", "root"); folders.Add("", folder_tree_root); var cloud_info_list = cloud_info.Values.OrderBy(d => string.IsNullOrWhiteSpace(d.Folder) ? 0 : d.Folder.Length); foreach (var value in cloud_info_list) { string foldername = string.IsNullOrWhiteSpace(value.Folder) ? "" : value.Folder; if (!folders.ContainsKey(foldername)) { if (foldername.Contains('\\')) { int lastindex = foldername.LastIndexOf('\\'); string father = foldername.Substring(0, lastindex); string child = foldername.Substring(lastindex + 1); folders[foldername] = new CloudItem(foldername, child); if (!folders.ContainsKey(father)) { CreateFather(father, folders); } folders[father].AddChildren(folders[foldername]); } else if (foldername.Length > 0) { folders[foldername] = new CloudItem(foldername, foldername); folders[""].AddChildren(folders[foldername]); } } var item = new CloudItem(foldername, value.Name); item.data = value; item.cloud_url = value.URL; folders[foldername].AddChildren(item); } return(folder_tree_root); }
public bool FileExists(string path) { return(SteamRemoteStorage.FileExists(path)); }
public unsafe bool FileExists(string name) { return(SteamRemoteStorage.FileExists(name)); }
private void RenderPageOne() { if (GUILayout.Button("FileWrite(MESSAGE_FILE_NAME, Data, Data.Length)")) { if (System.Text.Encoding.UTF8.GetByteCount(m_Message) > m_TotalBytes) { print("Remote Storage: Quota Exceeded! - Bytes: " + System.Text.Encoding.UTF8.GetByteCount(m_Message) + " - Max: " + m_TotalBytes); } else { byte[] Data = new byte[System.Text.Encoding.UTF8.GetByteCount(m_Message)]; System.Text.Encoding.UTF8.GetBytes(m_Message, 0, m_Message.Length, Data, 0); bool ret = SteamRemoteStorage.FileWrite(MESSAGE_FILE_NAME, Data, Data.Length); print("FileWrite(" + MESSAGE_FILE_NAME + ", Data, " + Data.Length + ") - " + ret); } } if (GUILayout.Button("FileRead(MESSAGE_FILE_NAME, Data, Data.Length)")) { if (m_FileSize > 40) { byte[] c = { 0 }; Debug.Log("RemoteStorage: File was larger than expected. . ."); SteamRemoteStorage.FileWrite(MESSAGE_FILE_NAME, c, 1); } else { byte[] Data = new byte[40]; int ret = SteamRemoteStorage.FileRead(MESSAGE_FILE_NAME, Data, Data.Length); m_Message = System.Text.Encoding.UTF8.GetString(Data, 0, ret); print("FileRead(" + MESSAGE_FILE_NAME + ", Data, " + Data.Length + ") - " + ret); } } if (GUILayout.Button("FileForget(MESSAGE_FILE_NAME)")) { bool ret = SteamRemoteStorage.FileForget(MESSAGE_FILE_NAME); print("FileForget(" + MESSAGE_FILE_NAME + ") - " + ret); } if (GUILayout.Button("FileDelete(MESSAGE_FILE_NAME)")) { bool ret = SteamRemoteStorage.FileDelete(MESSAGE_FILE_NAME); print("FileDelete(" + MESSAGE_FILE_NAME + ") - " + ret); } if (GUILayout.Button("FileShare(MESSAGE_FILE_NAME)")) { SteamAPICall_t handle = SteamRemoteStorage.FileShare(MESSAGE_FILE_NAME); RemoteStorageFileShareResult.Set(handle); print("FileShare(" + MESSAGE_FILE_NAME + ") - " + handle); } if (GUILayout.Button("SetSyncPlatforms(MESSAGE_FILE_NAME, k_ERemoteStoragePlatformAll)")) { bool ret = SteamRemoteStorage.SetSyncPlatforms(MESSAGE_FILE_NAME, ERemoteStoragePlatform.k_ERemoteStoragePlatformAll); print("SetSyncPlatforms(" + MESSAGE_FILE_NAME + ", ERemoteStoragePlatform.k_ERemoteStoragePlatformAll) - " + ret); } if (GUILayout.Button("FileWriteStreamOpen(MESSAGE_FILE_NAME)")) { m_FileStream = SteamRemoteStorage.FileWriteStreamOpen(MESSAGE_FILE_NAME); print("FileWriteStreamOpen(" + MESSAGE_FILE_NAME + ") - " + m_FileStream); } if (GUILayout.Button("FileWriteStreamWriteChunk(m_FileStream, Data, Data.Length)")) { if (System.Text.Encoding.UTF8.GetByteCount(m_Message) > m_TotalBytes) { print("Remote Storage: Quota Exceeded! - Bytes: " + System.Text.Encoding.UTF8.GetByteCount(m_Message) + " - Max: " + m_TotalBytes); } else { byte[] Data = new byte[System.Text.Encoding.UTF8.GetByteCount(m_Message)]; System.Text.Encoding.UTF8.GetBytes(m_Message, 0, m_Message.Length, Data, 0); bool ret = SteamRemoteStorage.FileWriteStreamWriteChunk(m_FileStream, Data, Data.Length); print("FileWriteStreamWriteChunk(" + m_FileStream + ", Data, " + Data.Length + ") - " + ret); } } if (GUILayout.Button("FileWriteStreamClose(m_FileStream)")) { bool ret = SteamRemoteStorage.FileWriteStreamClose(m_FileStream); print("FileWriteStreamClose(" + m_FileStream + ") - " + ret); } if (GUILayout.Button("FileWriteStreamCancel(m_FileStream)")) { bool ret = SteamRemoteStorage.FileWriteStreamCancel(m_FileStream); print("FileWriteStreamCancel(" + m_FileStream + ") - " + ret); } GUILayout.Label("FileExists(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.FileExists(MESSAGE_FILE_NAME)); GUILayout.Label("FilePersisted(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.FilePersisted(MESSAGE_FILE_NAME)); GUILayout.Label("GetFileSize(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.GetFileSize(MESSAGE_FILE_NAME)); GUILayout.Label("GetFileTimestamp(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.GetFileTimestamp(MESSAGE_FILE_NAME)); GUILayout.Label("GetSyncPlatforms(MESSAGE_FILE_NAME) : " + SteamRemoteStorage.GetSyncPlatforms(MESSAGE_FILE_NAME)); m_FileCount = SteamRemoteStorage.GetFileCount(); GUILayout.Label("GetFileCount() : " + m_FileCount); for (int i = 0; i < m_FileCount; ++i) { string FileName = SteamRemoteStorage.GetFileNameAndSize(i, out m_FileSize); GUILayout.Label("GetFileNameAndSize(i, out FileSize) : " + FileName + " -- " + m_FileSize); } { int AvailableBytes; bool ret = SteamRemoteStorage.GetQuota(out m_TotalBytes, out AvailableBytes); GUILayout.Label("GetQuota(out m_TotalBytes, out AvailableBytes) : " + ret + " -- " + m_TotalBytes + " -- " + AvailableBytes); } GUILayout.Label("IsCloudEnabledForAccount() : " + SteamRemoteStorage.IsCloudEnabledForAccount()); { bool CloudEnabled = SteamRemoteStorage.IsCloudEnabledForApp(); GUILayout.Label("IsCloudEnabledForApp() : " + CloudEnabled); if (GUILayout.Button("SetCloudEnabledForApp(!CloudEnabled)")) { SteamRemoteStorage.SetCloudEnabledForApp(!CloudEnabled); print("SetCloudEnabledForApp(!CloudEnabled)"); } } }