Exemplo n.º 1
0
 public static AssetStoreClient.Pending CreatePendingGetBinary(string name, string url, 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.DownloadProgressChanged += new DownloadProgressChangedEventHandler(AssetStoreClient.DownloadProgressCallback);
             p.conn.DownloadDataCompleted   += new DownloadDataCompletedEventHandler(AssetStoreClient.DownloadDataCallback);
             p.conn.DownloadDataAsync(new Uri(url), p);
         }
         catch (WebException ex)
         {
             p.ex = ex;
             return(false);
         }
         return(true);
     };
     if (!pendingQueueDelegate())
     {
         p.queueDelegate = pendingQueueDelegate;
     }
     return(p);
 }
Exemplo n.º 2
0
 public static AssetStoreClient.Pending CreatePendingPost(string name, string path, string postData, 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 += new UploadProgressChangedEventHandler(AssetStoreClient.UploadProgressCallback);
             p.conn.UploadStringCompleted += new UploadStringCompletedEventHandler(AssetStoreClient.UploadStringCallback);
             p.conn.UploadStringAsync(AssetStoreClient.APIUri(path), "POST", postData, p);
         }
         catch (WebException ex)
         {
             p.ex = ex;
             return(false);
         }
         return(true);
     };
     if (!pendingQueueDelegate())
     {
         p.queueDelegate = pendingQueueDelegate;
     }
     return(p);
 }
Exemplo n.º 3
0
 public static AssetStoreClient.Pending CreatePendingUpload(string name, string path, string filepath, AssetStoreClient.DoneCallback callback)
 {
     DebugUtils.Log("CreatePendingUpload");
     AssetStoreClient.Pending pending = AssetStoreClient.CreatePending(name, callback);
     AssetStoreClient.PendingQueueDelegate pendingQueueDelegate = () =>
     {
         bool flag;
         pending.conn = AssetStoreClient.AcquireClient();
         if (pending.conn == null)
         {
             return(false);
         }
         try
         {
             pending.conn.Headers.Set("X-Unity-Session", AssetStoreClient.ActiveOrUnauthSessionID);
             pending.conn.UploadProgressChanged += new UploadProgressChangedEventHandler(AssetStoreClient.UploadProgressCallback);
             pending.conn.UploadFileCompleted   += new UploadFileCompletedEventHandler(AssetStoreClient.UploadFileCallback);
             pending.conn.UploadFileAsync(AssetStoreClient.APIUri(path), "PUT", filepath, pending);
             return(true);
         }
         catch (WebException webException)
         {
             pending.ex = webException;
             flag       = false;
         }
         return(flag);
     };
     if (!pendingQueueDelegate())
     {
         pending.queueDelegate = pendingQueueDelegate;
     }
     return(pending);
 }