private static string UpdateLargeFilesUpload()
        {
            if (AssetStoreClient.s_UploadingLargeFile == null)
            {
                if (AssetStoreClient.s_PendingLargeFiles.Count == 0)
                {
                    return(null);
                }
                AssetStoreClient.s_UploadingLargeFile = AssetStoreClient.s_PendingLargeFiles[0];
                try
                {
                    AssetStoreClient.s_UploadingLargeFile.Open();
                }
                catch (Exception ex)
                {
                    DebugUtils.LogError("Unable to start uploading:" + AssetStoreClient.s_UploadingLargeFile.FilePath + " Reason: " + ex.Message);
                    AssetStoreClient.s_PendingLargeFiles.Remove(AssetStoreClient.s_UploadingLargeFile);
                    AssetStoreClient.s_PendingLargeFiles = null;
                    return(null);
                }
            }
            AssetStoreClient.LargeFilePending largeFilePending = AssetStoreClient.s_UploadingLargeFile;
            StreamReader streamReader = null;
            WebResponse  webResponse  = null;

            try
            {
                if (largeFilePending == null || largeFilePending.Request == null)
                {
                    return(null);
                }
                byte[] buffer = largeFilePending.Buffer;
                int    num    = 0;
                for (int i = 0; i < 2; i++)
                {
                    num = largeFilePending.RequestFileStream.Read(buffer, 0, buffer.Length);
                    if (num == 0)
                    {
                        break;
                    }
                    largeFilePending.RequestStream.Write(buffer, 0, num);
                    largeFilePending.BytesSent += (long)num;
                }
                if (num != 0)
                {
                    try
                    {
                        double num2  = (double)largeFilePending.BytesSent;
                        double num3  = (double)largeFilePending.BytesToSend;
                        double pctUp = num2 / num3 * 100.0;
                        if (largeFilePending.RequestProgressCallback != null)
                        {
                            largeFilePending.RequestProgressCallback(pctUp, 0.0);
                        }
                    }
                    catch (Exception ex2)
                    {
                        DebugUtils.LogWarning("Progress update error " + ex2.Message);
                    }
                    return(null);
                }
                AssetStoreClient.s_PendingLargeFiles.Remove(largeFilePending);
                AssetStoreClient.s_UploadingLargeFile = null;
                DebugUtils.Log("Finished Uploading: " + largeFilePending.Id);
                webResponse = largeFilePending.Request.GetResponse();
                Stream responseStream = webResponse.GetResponseStream();
                string text;
                try
                {
                    streamReader = new StreamReader(responseStream);
                    text         = streamReader.ReadToEnd();
                    streamReader.Close();
                }
                catch (Exception ex3)
                {
                    DebugUtils.LogError("StreamReader sr");
                    throw ex3;
                }
                AssetStoreResponse job = AssetStoreClient.parseAssetStoreResponse(text, null, null, webResponse.Headers);
                largeFilePending.Close();
                largeFilePending.RequestDoneCallback(job);
                return(text);
            }
            catch (Exception ex4)
            {
                DebugUtils.LogError("UploadingLarge Files Exception:" + ex4.Source);
                if (streamReader != null)
                {
                    streamReader.Close();
                }
                AssetStoreResponse job2 = AssetStoreClient.parseAssetStoreResponse(null, null, ex4, (webResponse == null) ? null : webResponse.Headers);
                largeFilePending.RequestDoneCallback(job2);
                largeFilePending.Close();
                AssetStoreClient.s_PendingLargeFiles.Remove(largeFilePending);
            }
            return(null);
        }
 public static void UploadLargeFile(string path, string filepath, Dictionary <string, string> extraParams, AssetStoreClient.DoneCallback callback, AssetStoreClient.ProgressCallback progressCallback)
 {
     AssetStoreClient.LargeFilePending item = new AssetStoreClient.LargeFilePending(path, filepath, extraParams, callback, progressCallback);
     AssetStoreClient.s_PendingLargeFiles.Add(item);
 }