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); }
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 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); }