Пример #1
0
        static public bool GetPublishedFileDetails(IEnumerable <ulong> publishedFileIds, Action <bool, string> callback)
        {
            uint handle = HTTP.CreateHTTPRequest(HTTPMethod.POST, string.Format(m_requestFormat, "ISteamRemoteStorage", "GetPublishedFileDetails", 1));

            if (!HTTP.SetHTTPRequestGetOrPostParameter(handle, "itemcount", publishedFileIds.Count().ToString()))
            {
                MySandboxGame.Log.WriteLine(string.Format("HTTP: failed to set parameter '{0}' = '{1}'", "itemcount", publishedFileIds.Count().ToString()));
                return(false);
            }

            int i = 0;

            foreach (var id in publishedFileIds)
            {
                if (!HTTP.SetHTTPRequestGetOrPostParameter(handle, string.Format("publishedfileids[{0}]", i), id.ToString()))
                {
                    MySandboxGame.Log.WriteLine(string.Format("HTTP: failed to set parameter '{0}' = '{1}'", string.Format("publishedfileids[{0}]", i), id.ToString()));
                    return(false);
                }
                ++i;
            }

            if (!HTTP.SendHTTPRequest(handle, onRequestCompleted))
            {
                MySandboxGame.Log.WriteLine("HTTP: failed to send request");
                return(false);
            }

            m_callbacks[handle] = callback;

            return(true);
        }