private void OnFileReadComplete(RemoteStorageFileReadAsyncComplete_t resultData, bool result) { byte[] byteData = new byte[GetSaveSize()]; SteamRemoteStorage.FileReadAsyncComplete(resultData.m_hFileReadAsync, byteData, resultData.m_cubRead); string jsonData = Encoding.UTF8.GetString(byteData); File.WriteAllText(SaveSystem.GetFilePath(localSaveName, localSaveExtension), jsonData); SaveSystem.LoadAll(saveName: localSaveName, FileType.JSON, decompress: false); }
// SteamAPICall_t public CallbackHandle FileReadAsync(string pchFile /*const char **/, uint nOffset /*uint32*/, uint cubToRead /*uint32*/, Action <RemoteStorageFileReadAsyncComplete_t, bool> CallbackFunction = null /*Action<RemoteStorageFileReadAsyncComplete_t, bool>*/) { SteamAPICall_t callback = 0; callback = platform.ISteamRemoteStorage_FileReadAsync(pchFile, nOffset, cubToRead); if (CallbackFunction == null) { return(null); } return(RemoteStorageFileReadAsyncComplete_t.CallResult(steamworks, callback, CallbackFunction)); }
private void OnSteamCloudDataLoaded(RemoteStorageFileReadAsyncComplete_t pCallback, bool bIOFailure) { print("Data loaded, success: " + bIOFailure); if (pCallback.m_eResult == EResult.k_EResultOK) { byte[] data = new byte[pCallback.m_cubRead]; if (SteamRemoteStorage.FileReadAsyncComplete(pCallback.m_hFileReadAsync, data, pCallback.m_cubRead)) { string m_Message = System.Text.Encoding.UTF8.GetString(data, (int)pCallback.m_nOffset, (int)pCallback.m_cubRead); Debug.LogWarning("RemoteStorageFileReadAsyncComplete: Got data from SteamCloud: " + m_Message); } } }
void OnRemoteStorageFileReadAsyncComplete(RemoteStorageFileReadAsyncComplete_t pCallback, bool bIOFailure) { Debug.Log("[" + RemoteStorageFileReadAsyncComplete_t.k_iCallback + " - RemoteStorageFileReadAsyncComplete] - " + pCallback.m_hFileReadAsync + " -- " + pCallback.m_eResult + " -- " + pCallback.m_nOffset + " -- " + pCallback.m_cubRead); if (pCallback.m_eResult == EResult.k_EResultOK) { byte[] Data = new byte[40]; bool ret = SteamRemoteStorage.FileReadAsyncComplete(pCallback.m_hFileReadAsync, Data, pCallback.m_cubRead); print("FileReadAsyncComplete(m_FileReadAsyncHandle, Data, pCallback.m_cubRead) : " + ret); if (ret) { m_Message = System.Text.Encoding.UTF8.GetString(Data, (int)pCallback.m_nOffset, (int)pCallback.m_cubRead); } } }
public void HandleFileReadAsyncComplete(RemoteStorageFileReadAsyncComplete_t param, bool bIOFailure) { result = param.m_eResult; //If the request result was okay fetch the binary data if (result == EResult.k_EResultOK) { binaryData = new byte[address.fileSize]; if (!SteamRemoteStorage.FileReadAsyncComplete(param.m_hFileReadAsync, binaryData, (uint)binaryData.Length)) { //If we failed to read the binary data update the result to fail result = EResult.k_EResultFail; } else if (linkedLibrary != null) { linkedLibrary.activeFile = this; WriteToLibrary(linkedLibrary); } } if (Complete != null) { Complete.Invoke(this); } }