Exemple #1
0
 /// <summary>
 /// 分配一个实例空间,并开启请求
 /// </summary>
 /// <param name="url"></param>
 /// <param name="postDataByteArr"></param>
 /// <param name="headers"></param>
 /// <param name="callback"></param>
 /// <param name="progress"></param>
 /// <param name="args"></param>
 public static void Post(string url, byte[] postDataByteArr, Dictionary <string, string> headers = null,
                         Action <string, long, byte[], object[]> callback = null, Action <float> progress = null, params object[] args)
 {
     if (NetEventTmpSave.HasEventByteArr(NetEventTmpSave.EventType.POST, url))
     {
         NetEventTmpSave.AddEvent(NetEventTmpSave.EventType.POST, url, callback);
     }
     else
     {
         NetEventTmpSave.AddEvent(NetEventTmpSave.EventType.POST, url, callback);
         Action <string, long, byte[], object[]> callbackt = (uurl, code, content, aargs) =>
         {
             NetEventTmpSave.Invoke(NetEventTmpSave.EventType.POST, uurl, code, content, aargs);
         };
         NetPostRequest request = NetPostRequest.Allocate(url, postDataByteArr, headers, callbackt, progress, args);
         Instance.StartCoroutine(request.IEnumStart());
     }
 }
Exemple #2
0
 /// <summary>
 /// DELETE 返回字节数组
 /// </summary>
 /// <param name="url"></param>
 /// <param name="headers"></param>
 /// <param name="callbackByteArr"></param>
 /// <param name="progress"></param>
 public static void DeleteByteArr(string url, Dictionary <string, string> headers         = null,
                                  Action <string, long, byte[], object[]> callbackByteArr = null, Action <float> progress = null, params object[] args)
 {
     if (NetEventTmpSave.HasEventByteArr(NetEventTmpSave.EventType.DELETE, url))
     {
         NetEventTmpSave.AddEvent(NetEventTmpSave.EventType.DELETE, url, callbackByteArr);
     }
     else
     {
         NetEventTmpSave.AddEvent(NetEventTmpSave.EventType.DELETE, url, callbackByteArr);
         Action <string, long, byte[], object[]> callback = (uurl, code, bs, aargs) =>
         {
             NetEventTmpSave.Invoke(NetEventTmpSave.EventType.DELETE, uurl, code, bs, aargs);
         };
         NetDeleteRequest request = NetDeleteRequest.Allocate(url, headers, callback, progress, args);
         Instance.StartCoroutine(request.IEnumStart());
     }
 }