public static AssetStoreClient.Pending CreatePendingUpload(string name, string path, string filepath, AssetStoreClient.DoneCallback callback)
 {
     DebugUtils.Log("CreatePendingUpload");
     AssetStoreClient.Pending p = AssetStoreClient.CreatePending(name, callback);
     AssetStoreClient.PendingQueueDelegate pendingQueueDelegate = delegate()
     {
         p.conn = AssetStoreClient.AcquireClient();
         if (p.conn == null)
         {
             return(false);
         }
         try
         {
             p.conn.Headers.Set("X-Unity-Session", AssetStoreClient.ActiveOrUnauthSessionID);
             p.conn.UploadProgressChanged += AssetStoreClient.UploadProgressCallback;
             p.conn.UploadFileCompleted   += AssetStoreClient.UploadFileCallback;
             p.conn.UploadFileAsync(AssetStoreClient.APIUri(path), "PUT", filepath, p);
         }
         catch (WebException ex)
         {
             p.ex = ex;
             return(false);
         }
         return(true);
     };
     if (!pendingQueueDelegate())
     {
         p.queueDelegate = pendingQueueDelegate;
     }
     return(p);
 }
 public void Open()
 {
     try
     {
         this.RequestFileStream = new FileStream(this.FilePath, FileMode.Open, FileAccess.Read);
         this.Request           = (HttpWebRequest)WebRequest.Create(AssetStoreClient.APIUri(this.URI, this.m_extraParams));
         this.Request.AllowWriteStreamBuffering = false;
         this.Request.Timeout = 36000000;
         this.Request.Headers.Set("X-Unity-Session", AssetStoreClient.ActiveOrUnauthSessionID);
         this.Request.KeepAlive     = false;
         this.Request.ContentLength = this.RequestFileStream.Length;
         this.Request.Method        = "PUT";
         this.BytesToSend           = this.RequestFileStream.Length;
         this.BytesSent             = 0L;
         this.RequestStream         = this.Request.GetRequestStream();
         if (this.Buffer == null)
         {
             this.Buffer = new byte[32768];
         }
     }
     catch (Exception ex)
     {
         AssetStoreResponse job = AssetStoreClient.parseAssetStoreResponse(null, null, ex, null);
         this.RequestDoneCallback(job);
         this.Close();
         throw ex;
     }
 }
 public static AssetStoreClient.Pending CreatePendingPost(string name, string path, NameValueCollection param, AssetStoreClient.DoneCallback callback)
 {
     AssetStoreClient.Pending p = AssetStoreClient.CreatePending(name, callback);
     AssetStoreClient.PendingQueueDelegate pendingQueueDelegate = delegate()
     {
         p.conn = AssetStoreClient.AcquireClient();
         if (p.conn == null)
         {
             return(false);
         }
         try
         {
             p.conn.Headers.Set("X-Unity-Session", AssetStoreClient.ActiveOrUnauthSessionID);
             p.conn.UploadProgressChanged += AssetStoreClient.UploadProgressCallback;
             p.conn.UploadValuesCompleted += AssetStoreClient.UploadValuesCallback;
             p.conn.UploadValuesAsync(AssetStoreClient.APIUri(path), "POST", param, p);
         }
         catch (WebException ex)
         {
             p.ex = ex;
             return(false);
         }
         return(true);
     };
     if (!pendingQueueDelegate())
     {
         p.queueDelegate = pendingQueueDelegate;
     }
     return(p);
 }
 private static Uri APIUri(string path)
 {
     return(AssetStoreClient.APIUri(path, null));
 }