示例#1
0
文件: Main.cs 项目: rockerdsk/Oxide
        private bool lua_PostWebRequest(string url, string postdata, LuaFunction func)
        {
            if (webrequests.Count > 3)
            {
                return(false);
            }
            AsyncWebRequest req = new AsyncWebRequest(url, postdata);

            webrequests.Add(req);
            Plugin callerplugin = Plugin.CurrentPlugin;

            req.OnResponse += (r) =>
            {
                try
                {
                    func.Call(r.ResponseCode, r.Response);
                }
                catch (Exception ex)
                {
                    //Debug.LogError(string.Format("Error in webrequest callback: {0}", ex));
                    Logger.Error(string.Format("Error in webrequest callback ({0})", callerplugin), ex);
                }
            };
            return(true);
        }
示例#2
0
文件: Main.cs 项目: NikSan2003/1.18
        private bool lua_SendWebRequest(string url, LuaFunction func)
        {
            AsyncWebRequest req = new AsyncWebRequest(url);

            webrequestQueue.Enqueue(req);
            Plugin callerplugin = Plugin.CurrentPlugin;

            req.OnResponse += (r) =>
            {
                try
                {
                    func.Call(r.ResponseCode, r.Response);
                }
                catch (Exception ex)
                {
                    //Debug.LogError(string.Format("Error in webrequest callback: {0}", ex));
                    Logger.Error(string.Format("Error in webrequest callback ({0})", callerplugin), ex);
                }
            };
            return(true);
        }
示例#3
0
文件: Main.cs 项目: khwoo1004/Oxide
 private bool lua_SendWebRequest(string url, LuaFunction func)
 {
     if (webrequests.Count > 3)
     {
         return false;
     }
     AsyncWebRequest req = new AsyncWebRequest(url);
     webrequests.Add(req);
     Plugin callerplugin = Plugin.CurrentPlugin;
     req.OnResponse += (r) =>
     {
         try
         {
             func.Call(r.ResponseCode, r.Response);
         }
         catch (Exception ex)
         {
             //Debug.LogError(string.Format("Error in webrequest callback: {0}", ex));
             Logger.Error(string.Format("Error in webrequest callback ({0})", callerplugin), ex);
         }
     };
     return true;
 }
示例#4
0
文件: Main.cs 项目: ReizeiMako/Oxide
 private bool lua_PostWebRequest(string url, string postdata, LuaFunction func)
 {
     AsyncWebRequest req = new AsyncWebRequest(url, postdata);
     webrequestQueue.Enqueue(req);
     Plugin callerplugin = Plugin.CurrentPlugin;
     req.OnResponse += (r) =>
     {
         try
         {
             func.Call(r.ResponseCode, r.Response);
         }
         catch (Exception ex)
         {
             //Debug.LogError(string.Format("Error in webrequest callback: {0}", ex));
             Logger.Error(string.Format("Error in webrequest callback ({0})", callerplugin), ex);
         }
     };
     return true;
 }