Example #1
0
 void OnRemoteStorageGetPublishedFileDetailsResult(RemoteStorageGetPublishedFileDetailsResult_t pCallback, bool bIOFailure)
 {
     Debug.Log("[" + RemoteStorageGetPublishedFileDetailsResult_t.k_iCallback + " - RemoteStorageGetPublishedFileDetailsResult] - " + pCallback.m_eResult + " -- " + pCallback.m_nPublishedFileId + " -- " + pCallback.m_nCreatorAppID + " -- " + pCallback.m_nConsumerAppID + " -- " + pCallback.m_rgchTitle + " -- " + pCallback.m_rgchDescription + " -- " + pCallback.m_hFile + " -- " + pCallback.m_hPreviewFile + " -- " + pCallback.m_ulSteamIDOwner + " -- " + pCallback.m_rtimeCreated + " -- " + pCallback.m_rtimeUpdated + " -- " + pCallback.m_eVisibility + " -- " + pCallback.m_bBanned + " -- " + pCallback.m_rgchTags + " -- " + pCallback.m_bTagsTruncated + " -- " + pCallback.m_pchFileName + " -- " + pCallback.m_nFileSize + " -- " + pCallback.m_nPreviewFileSize + " -- " + pCallback.m_rgchURL + " -- " + pCallback.m_eFileType + " -- " + pCallback.m_bAcceptedForUse);
     if (pCallback.m_eResult == EResult.k_EResultOK)
     {
         m_UGCHandle = pCallback.m_hFile;
     }
 }
Example #2
0
        // SteamAPICall_t
        public CallbackHandle GetPublishedFileDetails(PublishedFileId_t unPublishedFileId /*PublishedFileId_t*/, uint unMaxSecondsOld /*uint32*/, Action <RemoteStorageGetPublishedFileDetailsResult_t, bool> CallbackFunction = null /*Action<RemoteStorageGetPublishedFileDetailsResult_t, bool>*/)
        {
            SteamAPICall_t callback = 0;

            callback = platform.ISteamRemoteStorage_GetPublishedFileDetails(unPublishedFileId.Value, unMaxSecondsOld);

            if (CallbackFunction == null)
            {
                return(null);
            }

            return(RemoteStorageGetPublishedFileDetailsResult_t.CallResult(steamworks, callback, CallbackFunction));
        }
Example #3
0
        private void OnRemoteStorageGetPublishedFileDetailsResult(RemoteStorageGetPublishedFileDetailsResult_t pCallback, bool bIOFailure)
        {
            Console.WriteLine("Got file details for " + pCallback.m_pchFileName + " with preview image " + pCallback.m_hPreviewFile);
            if (pCallback.m_eResult == EResult.k_EResultOK)
            {
                if (published.Count > 0)
                {
                    Console.WriteLine("Handling published level and downloading the next");
                    myLevels.Add(pCallback.m_pchFileName.ToLower());
                    published.Pop();
                    DownloadNextPublishedFileDetails();
                }
                else
                {
                    if (!subscribedItemButtonMap.ContainsKey(pCallback.m_hFile))
                    {
                        int x = (LevelButton.lvButtonList.Count) % 3;
                        int y = (int)Math.Floor((LevelButton.lvButtonList.Count) / 3f) % 2;
                        Texture2D thumbnail = Textures.GetCustomThumbnail();
                        Vector2 position = new Vector2((float)((220 * (x % 3)) + 80), (float)((220 * (y % 2)) + 0x69));
                        WorkshopLevelButton button = new WorkshopLevelButton(pCallback.m_pchFileName, position, thumbnail);
                        LevelButton.CalculateGroup();
                        LevelButton.lvButtonList.Add(button);

                        subscribedItemButtonMap.Add(pCallback.m_hFile, button);
                        subscribedThumbnailButtonMap.Add(pCallback.m_hPreviewFile, button);

                        levelDataStack.Push(pCallback.m_hFile);
                        levelThumbnailStack.Push(pCallback.m_hPreviewFile);
                    }
                    subscriptions.Pop();
                    if (subscriptions.Count > 0)
                    {
                        DownloadNextLevel();
                    }
                    else
                    {
                        DownloadNextLevelData();
                        DownloadNextLevelThumbnail();
                    }
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(
                    "An unexpected error occured (Get published file details result)\n" + pCallback.m_eResult, "Error");
            }
        }
Example #4
0
 void OnRemoteStorageGetPublishedFileDetailsResult(RemoteStorageGetPublishedFileDetailsResult_t pCallback, bool bIOFailure)
 {
     if (pCallback.m_eResult == EResult.k_EResultOK)
     {
         //if we were able to get the details of the subscribed item we need to check if we need to update it
         bool overWrite = false;
         if (File.Exists(pCallback.m_pchFileName))
         {
             Debug.Log("File exists so now we check if it's outdated");
             //I'm not sure how correct this is for edge cases but it seems to work.
             uint file_last_write = (uint)(File.GetLastWriteTimeUtc(pCallback.m_pchFileName).Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
             //maybe it's better to save the pCallback.m_rtimeUpdated when the file is first downloaded.
             if (pCallback.m_rtimeUpdated > file_last_write)
             {
                 //if the file on the workshop is newer then the local file
                 //we need to update
                 overWrite = true;
             }
         }
         else
         {
             Debug.Log("File doesn't exist we need to download it");
             overWrite = true;
         }
         if (overWrite)
         {
             //This is where we actually make the callback to download it
             UGCHandle = pCallback.m_hFile;
             SteamAPICall_t handle = SteamRemoteStorage.UGCDownload(UGCHandle, 0);
             RemoteStorageDownloadUGCResult.Set(handle);
         }
         else
         {
             fetchedContent = true;
             Debug.Log("File is up to date and we can now continue to the next one");
         }
     }
     else
     {
         //Unable to get details from the steamworkshop for this file
         //maybe it doesn't exist any more?
         fetchedContent = true;
     }
 }
    void OnRemoteStorageGetPublishedFileDetailsResult(RemoteStorageGetPublishedFileDetailsResult_t pCallback, bool bIOFailure)
    {    //GetPreFileDetail step 2
        try
        {
            //Debug.Log("[" + RemoteStorageGetPublishedFileDetailsResult_t.k_iCallback + " - RemoteStorageGetPublishedFileDetailsResult] - " + pCallback.m_eResult + " -- " + pCallback.m_nPublishedFileId + " -- " + pCallback.m_nCreatorAppID + " -- " + pCallback.m_nConsumerAppID + " -- " + pCallback.m_rgchTitle + " -- " + pCallback.m_rgchDescription + " -- " + pCallback.m_hFile + " -- " + pCallback.m_hPreviewFile + " -- " + pCallback.m_ulSteamIDOwner + " -- " + pCallback.m_rtimeCreated + " -- " + pCallback.m_rtimeUpdated + " -- " + pCallback.m_eVisibility + " -- " + pCallback.m_bBanned + " -- " + pCallback.m_rgchTags + " -- " + pCallback.m_bTagsTruncated + " -- " + pCallback.m_pchFileName + " -- " + pCallback.m_nFileSize + " -- " + pCallback.m_nPreviewFileSize + " -- " + pCallback.m_rgchURL + " -- " + pCallback.m_eFileType + " -- " + pCallback.m_bAcceptedForUse);
            if (pCallback.m_eResult == EResult.k_EResultOK)
            {
                _PreFileDetail.m_hFile            = pCallback.m_hFile;
                _PreFileDetail.m_hPreviewFile     = pCallback.m_hPreviewFile;
                _PreFileDetail.m_nPublishedFileId = pCallback.m_nPublishedFileId;
                _PreFileDetail.m_pchFileName      = pCallback.m_pchFileName;
                _PreFileDetail.m_rgchTitle        = pCallback.m_rgchTitle;
                _PreFileDetail.m_rgchDescription  = pCallback.m_rgchDescription;
                string[] str = pCallback.m_rgchTags.Split(',');
                if (str.Length > 0)
                {
                    _PreFileDetail.m_rgchTags = str[str.Length - 1];
                }
                //for test
                //SteamProcessMgr.Instance.DeleteFile(null,pCallback.m_pchFileName,_PublishID);

                SteamAPICall_t handle = SteamRemoteStorage.UGCDownload(pCallback.m_hPreviewFile, 0);


                remoteStorageDownloadPreUGCResult.Set(handle);
            }
            else
            {
                Finish(_PublishID, null, false);
                LogManager.Warning("OnRemoteStorageGetPublishedFileDetailsResult error");
            }
        }
        catch (Exception e)
        {
            Finish(_PublishID, null, false);
            Debug.Log("SteamGetPreFileDetailProcess OnRemoteStorageGetPublishedFileDetailsResultAllUser " + e.ToString());
        }
    }
 void OnGetFinalInfo(RemoteStorageGetPublishedFileDetailsResult_t pCallback, bool bIOFailure)
 {
     try
     {
         if (pCallback.m_eResult == EResult.k_EResultOK && pCallback.m_hFile.m_UGCHandle != 0)
         {
             AddToList(pCallback.m_hFile.m_UGCHandle, pCallback.m_nPublishedFileId.m_PublishedFileId);
             if (_getAmount == _fileIDs.Count)
             {
                 Finish(_fileIDs, _publishIDs, true);
             }
         }
         else
         {
             Finish(_fileIDs, _publishIDs, false);
         }
     }
     catch (System.Exception e)
     {
         Finish(_fileIDs, _publishIDs, false);
         Debug.LogError(e.ToString());
     }
 }