コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #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);
 }
コード例 #4
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 += AssetStoreClient.DownloadProgressCallback;
             p.conn.DownloadDataCompleted   += 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);
 }
コード例 #5
0
 public static AssetStoreClient.Pending CreatePendingGetBinary(string name, string url, AssetStoreClient.DoneCallback callback)
 {
     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.DownloadProgressChanged += new DownloadProgressChangedEventHandler(AssetStoreClient.DownloadProgressCallback);
             pending.conn.DownloadDataCompleted   += new DownloadDataCompletedEventHandler(AssetStoreClient.DownloadDataCallback);
             pending.conn.DownloadDataAsync(new Uri(url), pending);
             return(true);
         }
         catch (WebException webException)
         {
             pending.ex = webException;
             flag       = false;
         }
         return(flag);
     };
     if (!pendingQueueDelegate())
     {
         pending.queueDelegate = pendingQueueDelegate;
     }
     return(pending);
 }