Esempio n. 1
0
 internal void SteamFileWrite()
 {//step 2 正在上传iso主体文件到steam workshop;
     try
     {
         ShowMsg(ExportStep.RealFileSending);
         if (!SteamRemoteStorage.FileWrite(_FileName, _Data, _Data.Length))
         {
             throw new Exception("File write failed. File Name:" + _FileName);
         }
         SteamAPICall_t handler = new SteamAPICall_t();
         //step 3、正在为其他玩家共享iso;
         _step = ExportStep.Shareing;
         ShowMsg(_step);
         handler = SteamRemoteStorage.FileShare(_FileName);
         _handler.Add(handler);
         RemoteStorageFileShareResult.Set(handler);
     }
     catch (Exception)
     {
         if (CallBackSteamUploadResult != null)
         {
             CallBackSteamUploadResult(_ID, false, _hashCode);
         }
         SteamRemoteStorage.FileDelete(_PreFileName);
         //step 6 导出失败
         _step = ExportStep.ExportFailed;
         ShowMsg(_step);
     }
 }
Esempio n. 2
0
 private static void UploadFile(string name, byte[] data)
 {
     if (!SteamRemoteStorage.FileWrite(name, data, data.Length))
     {
         throw new Exception("Cannot upload " + name);
     }
 }
Esempio n. 3
0
        public static void WriteSaveData(string saveData, string playerID, bool forcelocal = false)
        {
            var pchFile = BASE_SAVE_FILE_NAME + playerID + SAVE_FILE_EXT;

            if (!forcelocal || !PlatformAPISettings.Running)
            {
                var bytes = Encoding.UTF8.GetBytes(saveData);
                if (!SteamRemoteStorage.FileWrite(pchFile, bytes, bytes.Length))
                {
                    Console.WriteLine("Failed to write to steam");
                }
                try
                {
                    Utils.SafeWriteToFile(saveData, Standalone_FolderPath + pchFile);
                }
                catch (Exception ex)
                {
                    Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                }
            }
            else
            {
                Utils.SafeWriteToFile(saveData, Standalone_FolderPath + pchFile);
            }
        }
Esempio n. 4
0
    private bool UploadFile(string fileName, string fileData)
    {
        byte[] Data = new byte[System.Text.Encoding.UTF8.GetByteCount(fileData)];
        System.Text.Encoding.UTF8.GetBytes(fileData, 0, fileData.Length, Data, 0);
        bool ret = SteamRemoteStorage.FileWrite(fileName, Data, Data.Length);

        return(ret);
    }
Esempio n. 5
0
 public unsafe static bool FileWrite(string name, byte[] data, int length)
 {
     if (!_initialized)
     {
         return(false);
     }
     return(data != null && data.Length != 0 && SteamRemoteStorage.FileWrite(name, data, length));
 }
Esempio n. 6
0
 public override void WriteFileData(string filename, byte[] data)
 {
     if (!PlatformAPISettings.Running || SteamRemoteStorage.FileWrite(this.PathPrefix + filename, data, data.Length))
     {
         return;
     }
     Console.WriteLine("Failed to write to steam");
 }
Esempio n. 7
0
        private static async Task <string> UploadFileAndShare(string name, string hash, byte[] data)
        {
            if (!SteamRemoteStorage.FileWrite(name, data, data.Length))
            {
                throw new Exception("Cannot upload " + name);
            }
            var sharer = new FileSharer(name, hash);

            return(await sharer.Share());
        }
Esempio n. 8
0
        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: 0x060017D4 RID: 6100 RVA: 0x000884C8 File Offset: 0x000868C8
 public bool write(string path, byte[] data, int size)
 {
     if (path == null)
     {
         throw new ArgumentNullException("path");
     }
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     return(SteamRemoteStorage.FileWrite(path, data, size));
 }
Esempio n. 10
0
 public static bool WriteFileUGC(string path, string steamPath)
 {
     if (!SteamInitialized)
     {
         return(false);
     }
     if (!File.Exists(path))
     {
         return(false);
     }
     byte[] data = File.ReadAllBytes(path);
     return(SteamRemoteStorage.FileWrite(steamPath, data, data.Length));
 }
Esempio n. 11
0
 public async Task <bool> UploadFile(string filePath)
 {
     byte[] data;
     try
     {
         data = File.ReadAllBytes(filePath);
     }
     catch (Exception)
     {
         throw new Exception("Couldn't read the file");
     }
     return(await Task.Run(new Func <bool>(() => SteamRemoteStorage.FileWrite(System.IO.Path.GetFileName(filePath), data, data.Length))));
 }
Esempio n. 12
0
 private static void WritePersistentBytes(string path, byte[] bytes, bool flush = true)
 {
     if (SteamManager.Initialized)
     {
         try
         {
             SteamRemoteStorage.FileWrite(path, bytes, bytes.Length);
         }
         catch (Exception exception)
         {
             Debug.LogException(exception);
         }
     }
 }
Esempio n. 13
0
 public static void Save(T instance, string saveName, int slot = 0)
 {
                 #if STEAM
     string json  = JsonUtility.ToJson(instance);
     byte[] bytes = System.Text.Encoding.UTF8.GetBytes(json);
     bool   resp  = SteamRemoteStorage.FileWrite(saveName + "" + slot, bytes, bytes.Length);
                 #elif UNITY_EDITOR
     string path = Application.dataPath + "/" + saveName + "" + slot + ".json";
     File.WriteAllText(path, JsonUtility.ToJson(instance, true));
                 #else
     PlayerPrefs.SetString(saveName + "" + slot, JsonUtility.ToJson(instance));
     PlayerPrefs.Save();
                 #endif
 }
Esempio n. 14
0
    internal void SteamPreFileWrite()
    {//step 1 正在上传预览文件到steam workshop
        try
        {
            if (_PreData != null && _PreData.Length > 0)
            {
                _step = ExportStep.PreFileSending;
                ShowMsg(_step);
                if (!IsShared(FileName))
                {
                    if (!IsWorking(FileName))
                    {
                        if (!SteamRemoteStorage.FileWrite(_PreFileName, _PreData, _PreData.Length))
                        {
                            throw new Exception("File write failed. File Name: " + _PreFileName);
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    OnFileShared();
                }

                SteamAPICall_t handler = SteamRemoteStorage.FileShare(_PreFileName);
                _handler.Add(handler);
                RemoteStoragePreFileShareResult.Set(handler);
            }
            else
            {
                throw new Exception("Invalid file data. File Name: " + _PreFileName);
            }
        }
        catch (Exception)
        {
            if (CallBackSteamUploadResult != null)
            {
                CallBackSteamUploadResult(_ID, false, _hashCode);
            }
            //step 6 导出失败
            _step = ExportStep.ExportFailed;
            ShowMsg(_step);
        }
    }
Esempio n. 15
0
    public bool SteamSave()
    {
        if (SteamManager.Initialized && SteamRemoteStorage.IsCloudEnabledForAccount())
        {
            string text = JsonUtility.ToJson(prefs, true);

            var bytes     = System.Text.Encoding.ASCII.GetBytes(text);
            var byteCount = System.Text.Encoding.ASCII.GetByteCount(text);

            Debug.Log("Writing Prefs to SteamCloud!");
            return(SteamRemoteStorage.FileWrite(_fileName, bytes, byteCount));
        }
        else
        {
            return(false);
        }
    }
Esempio n. 16
0
 private static void WriteSteam()
 {
     if (SteamManager.Initialized)
     {
         try
         {
             string text  = JsonUtility.ToJson(savedState);
             byte[] array = new byte[Encoding.UTF8.GetByteCount(text)];
             Encoding.UTF8.GetBytes(text, 0, text.Length, array, 0);
             bool flag = SteamRemoteStorage.FileWrite("progress.txt", array, array.Length);
         }
         catch (Exception exception)
         {
             Debug.LogException(exception);
         }
     }
 }
Esempio n. 17
0
        public void Save()
        {
            foreach (string varName in DevConsole.GetVariablesWithFlags(ConVarFlags.UserSetting))
            {
                UpdateUserSetting(varName, DevConsole.GetVariableAsString(varName));
            }

            SaveBinds();

            var filePath = Path.Combine(Application.persistentDataPath, _settingFileName);

            _config.SaveToFile(filePath);

            if (SteamClient.IsValid)
            {
                var bytes = Encoding.UTF8.GetBytes(File.ReadAllText(filePath));
                SteamRemoteStorage.FileWrite(_settingFileName, bytes);
            }
        }
Esempio n. 18
0
 private void WriteProgress()
 {
     byte[] array = customLevelsProgressData.ToBytes();
     SteamRemoteStorage.FileWrite("Progress.bin", array, array.Length);
 }
Esempio n. 19
0
    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)");
            }
        }
    }
Esempio n. 20
0
        public override int Run(string[] arguments)
        {
            if (!Steam.Start(Steam.APP_ID))
            {
                Console.WriteLine("Steam client is not running...");
                return((int)Steam.ExitCodes.InitSteamFailed);
            }

            if (arguments.Length < 2)
            {
                Console.WriteLine("Argument #1\"Directory\" and #2\"ID\" are necessary.");
                return((int)Steam.ExitCodes.ArgumentsMissing);
            }

            string            directory = arguments[0];
            PublishedFileId_t ID;

            //string preview = null;
            if (!uint.TryParse(arguments[1], out uint uintID))
            {
                Console.WriteLine("ID should be a number");
                return((int)Steam.ExitCodes.InvalidArgument);
            }
            ID = new PublishedFileId_t(uintID);
            //if (arguments.Length >= 3)
            //    preview = arguments[2];

            string zip = CreateModZipFile(directory);

            byte[] content = System.IO.File.ReadAllBytes(zip);

            if (!SteamRemoteStorage.FileWrite(
                    "mod_publish_data_file.zip",
                    content,
                    content.Length))
            {
                Console.WriteLine("Upload mod content file failed. Updating aborted.");
                return((int)Steam.ExitCodes.UploadNewContentFail);
            }
            // ----------------- Real update--------------------
            var updateHandle = SteamRemoteStorage.CreatePublishedFileUpdateRequest(ID);

            if (!SteamRemoteStorage.UpdatePublishedFileFile(updateHandle, "mod_publish_data_file.zip"))
            {
                Console.WriteLine("Failed to set new content, aborted.");
                return((int)Steam.ExitCodes.SetNewContentFail);
            }

            var commitHandle = SteamRemoteStorage.CommitPublishedFileUpdate(updateHandle);

            update_result = new CallResult <RemoteStorageUpdatePublishedFileResult_t>(OnUpdateFinished);
            update_result.Set(commitHandle);
            // -------------------end----------------------------

            Steam.Run();

            do
            {
                System.Threading.Thread.Sleep(100);
            } while (!Finished);

            Steam.Stop();

            return(ExitCode);
        }
    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();
    }
Esempio n. 22
0
 public override void Close()
 {
     SteamRemoteStorage.FileWrite(file, data.ToArray());
     data.Clear();
 }
Esempio n. 23
0
 public unsafe bool FileWrite(string managedname, string manageddata)
 {
     byte[] data = Encoding.ASCII.GetBytes(manageddata);
     return(SteamRemoteStorage.FileWrite(managedname, data, data.Length));
 }
 public override bool Write(string path, byte[] data, int length)
 {
     return(SteamRemoteStorage.FileWrite(path, data, length));
 }
        public void SaveTextFile(string path, string text)
        {
            var bytes = Encoding.UTF8.GetBytes(text);

            SteamRemoteStorage.FileWrite(path, bytes, bytes.Length);
        }
Esempio n. 26
0
 public bool Write(byte[] buffer, int count)
 {
     checkParentDisposed();
     return(SteamRemoteStorage.FileWrite(Name, buffer, count));
 }
 public void SaveFile(string path, byte[] bytes)
 {
     SteamRemoteStorage.FileWrite(path, bytes, bytes.Length);
 }
Esempio n. 28
0
 public static bool CloudSave(string filename, byte[] buffer)
 {
     return(SteamManager.Initialized && SteamRemoteStorage.FileWrite(filename, buffer, buffer.Length));
 }
 public bool FileWrite(string file_name, byte[] data)
 {
     return(SteamRemoteStorage.FileWrite(file_name, data, data.Length));
 }