Helper class to generate form data to post to web servers using the WWW class.

        public IEnumerator SendCoroutine()
        {
            AddDefaultParameters();

            WWWForm requestForm = new WWWForm ();
            requestForm.AddField ("name", this.eventName);
            requestForm.AddField ("data", this.data.ToString ());
            if (!this.customData.IsNull) {
                requestForm.AddField ("customData", this.customData.Print(false));
            } else {
                requestForm.AddField ("customData", "{}");
            }

            requestForm.AddField ("ts", "1470057439857");
            requestForm.AddField ("queued", 0);
            requestForm.AddField ("debugMode", "true");

            WWW request = new WWW ("https://apptracker.spilgames.com/v1/native-events/event/android/" + Spil.BundleIdEditor + "/" + this.eventName, requestForm);
            yield return request;
            //			while (!request.isDone);
            if (request.error != null) {
                Debug.LogError ("Error getting data: " + request.error);
                Debug.LogError ("Error getting data: " + request.text);
            } else {
                JSONObject serverResponse = new JSONObject (request.text);
                Debug.Log ("Data returned: " + serverResponse.ToString());
                ResponseEvent.Build(serverResponse);
            }
        }
Esempio n. 2
0
    static int Post(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                string arg0 = ToLua.CheckString(L, 1);
                UnityEngine.WWWForm arg1 = (UnityEngine.WWWForm)ToLua.CheckObject <UnityEngine.WWWForm>(L, 2);
                WWWOperation        o    = WWWUtil.Post(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3)
            {
                string arg0 = ToLua.CheckString(L, 1);
                UnityEngine.WWWForm arg1 = (UnityEngine.WWWForm)ToLua.CheckObject <UnityEngine.WWWForm>(L, 2);
                UnityEngine.Events.UnityAction <float> arg2 = (UnityEngine.Events.UnityAction <float>)ToLua.CheckDelegate <UnityEngine.Events.UnityAction <float> >(L, 3);
                WWWOperation o = WWWUtil.Post(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: WWWUtil.Post"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
// fields

// properties
    static void WWWForm_headers(JSVCall vc)
    {
        UnityEngine.WWWForm _this = (UnityEngine.WWWForm)vc.csObj;
        var result = _this.headers;

        JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
    }
Esempio n. 4
0
        /// <summary>
        /// Set or overwrite the internal form. Remarks: on WP8 it doesn't supported!
        /// </summary>
        public void SetFields(UnityEngine.WWWForm wwwForm)
        {
#if !UNITY_WP8
            FormUsage = HTTPFormUsage.Unity;
            FormImpl  = new UnityForm(wwwForm);
#endif
        }
Esempio n. 5
0
        public IEnumerator Authenticate(string gameId, string hostname, int httpPort, string username, string password, Success success, Error error)
        {
            string prefix;
            if (NetworkSettings.instance.httpUseSSL) {
                prefix = "https://";
            } else {
                prefix = "http://";
            }

            string uri = prefix + hostname + ":" + httpPort + "/api/client/login/" + gameId;
            //Debug.Log ("Authenticating via " + uri);
            var form = new WWWForm ();
            form.AddField ("username", username);
            form.AddField ("password", password);
            WWW www = new WWW (uri, form.data, form.headers);
            yield return www;

            if (www.error != null) {
                Debug.Log(www.error);
                error (www.error);
            } else {
                //Debug.Log(www.text);
                Dictionary<string, string> values = JsonConvert.DeserializeObject<Dictionary<string, string>> (www.text);
                success (values);
            }
        }
Esempio n. 6
0
 static public int get_headers(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.headers);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Esempio n. 7
0
 /**
  * Creates a new player account
  */
 public void Register(string name, string pass, Action<JSONObject> success, Action<string> error)
 {
     WWWForm form = new WWWForm();
     form.AddField("name", name);
     form.AddField("pass", Util.Encrypt(pass));
     t.Post("player/register", form, success, error);
 }
Esempio n. 8
0
 // 如果想通过HTTP传递二进制流的话 可以使用 下面的方法。
 public void sendBinaryData(string url, string str)
 {
     WWWForm wwwForm = new WWWForm();
     byte[] byteStream = System.Text.Encoding.Default.GetBytes(str);
     wwwForm.AddBinaryData("post", byteStream);
     WWW www = new WWW(url, wwwForm);
 }
Esempio n. 9
0
 static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.WWWForm o;
         o = new UnityEngine.WWWForm();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 public WWW GET(string url,WWWForm _form,Action<WWW> action)
 {
     CancelFlag = false;
     WWW www = new WWW(url,_form);
     EditorCoroutine.start(ProcessRequest(www,action));
     return www;
 }
Esempio n. 11
0
 static int QPYX_Post_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 2)
         {
             string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             UnityEngine.WWWForm QPYX_arg1_YXQP = (UnityEngine.WWWForm)ToLua.CheckObject <UnityEngine.WWWForm>(L_YXQP, 2);
             WWWOperation        QPYX_o_YXQP    = WWWUtil.Post(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 3)
         {
             string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             UnityEngine.WWWForm QPYX_arg1_YXQP = (UnityEngine.WWWForm)ToLua.CheckObject <UnityEngine.WWWForm>(L_YXQP, 2);
             UnityEngine.Events.UnityAction <float> QPYX_arg2_YXQP = (UnityEngine.Events.UnityAction <float>)ToLua.CheckDelegate <UnityEngine.Events.UnityAction <float> >(L_YXQP, 3);
             WWWOperation QPYX_o_YXQP = WWWUtil.Post(QPYX_arg0_YXQP, QPYX_arg1_YXQP, QPYX_arg2_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else
         {
             return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: WWWUtil.Post"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Esempio n. 12
0
        IEnumerator GetNewTrades()
        {
            WWWForm form = new WWWForm();
            form.AddField("_Token", APIKey); //The token
            form.AddField("Symbols", symbols); //The Symbols you want
            DateTimeOffset currentTimeEST = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, easternZone);

            
            form.AddField("StartDateTime", lastUpdatedEST.ToString(timeFormat)); //The proper DateTime in the proper format
            form.AddField("EndDateTime", currentTimeEST.AddTicks(-1000000).ToString(timeFormat)); //The proper DateTime in the proper format
            var url = "http://ws.nasdaqdod.com/v1/NASDAQTrades.asmx/GetTrades HTTP/1.1";

            WWW www = new WWW(url, form);
            yield return www;
            if (www.error == null)
            {
                //Sucessfully loaded the JSON string
                Debug.Log("Loaded following JSON string" + www.text);

            }
            else
            {
                Debug.Log("ERROR: " + www.error);
            }
        }
Esempio n. 13
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.WWWForm o;
     o = new UnityEngine.WWWForm();
     pushObject(l, o);
     return(1);
 }
Esempio n. 14
0
        public void Post(string url, Action<JSONObject> success, Action<string> error)
        {
            WWWForm form = new WWWForm();
            WWW www = new WWW(api + url, form);

            StartCoroutine(WaitForRequest(www, success, error));
        }
Esempio n. 15
0
		private WWWForm AddParams()
		{
			WWWForm form = new WWWForm();
			form.AddField( GameConstants.REQUEST_KEY_API_KEY, Encryption.API_KEY);
			form.AddField( GameConstants.REQUEST_KEY_TIMESTAMP, "" + (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond));
			return form;
		}
Esempio n. 16
0
 public HttpPostRequestProtected(string host, string filePath, string user, string password, WWWForm wwwForm)
     : base(host, filePath)
 {
     this.wwwForm = wwwForm;
     this.user = user;
     this.password = password;
 }
Esempio n. 17
0
		public void UpdateWWWForm(ref WWWForm data)
		{
			if (fieldType == eFieldType.Verify)
				return;

			data.AddField(serverfield, value);
		}
Esempio n. 18
0
        public void Login(string username, string password)
        {
            WWWForm form = new WWWForm();
            form.AddField("username", username);
            form.AddField("password", password);

            httpService.HttpPost(LOGIN_URL, form, LoginCallback);
        }
Esempio n. 19
0
		public BaseRequest (String method, String url, SuccessCallback successCallback, ErrorCallback errorCallback):base(method, url)
		{
			this.completedCallback = delegate(Request request) { onCompleteCallback(request); };;
			this.successCallback = successCallback;
			this.errorCallback = errorCallback;

			form = AddParams();
		}
 private void Queue(WWWForm data, int frame, float time)
 {
     Log log = new Log();
     log.postData = data;
     log.frame = frame;
     log.time = time;
     logs.AddLast(log);
 }
Esempio n. 21
0
 private IEnumerator HttpPostCoroutine(string location, WWWForm form, Action<WWW> callback)
 {
     WWW request = new WWW(HTTP_SERVER_URI + location, form);
     yield return request;
     Debug.Log(String.Format("HTTP POST Result: {0}", request.text));
     if (callback != null)
         callback(request);
 }
 public void Request(
     Uri url,
     HttpMethod method,
     WWWForm query = null,
     FacebookDelegate<IGraphResult> callback = null)
 {
     AsyncRequestString.Request(url, method, query, callback);
 }
 public static void Request(string url , WWWForm form , byte[] byteData , Hashtable headers ,
     System.Action<string> callback , System.Action<string,System.Action,System.Action> error_callback)
 {
     GameObject obj = new GameObject("HttpRequest");
     HttpRequest loader = obj.AddComponent<HttpRequest>();
     loader.m_eState = STATE.START;
     loader.StartCoroutine(loader.request(url , form , byteData , headers , callback , error_callback));
 }
Esempio n. 24
0
        /**
         * Post form
         */
        public static IEnumerator PostForm(string url, WWWForm formData, Action<WWW> callback)
        {
            WWW request = new WWW(url, formData);

            yield return request;

            callback(request);
        }
Esempio n. 25
0
 /**
  * Adds a new game to the network
  */
 public void Register(string name, string dev, string url, Action<JSONObject> success, Action<string> error)
 {
     WWWForm form = new WWWForm();
     form.AddField("name", name);
     form.AddField("dev", dev);
     form.AddField("url", url);
     t.Post("game/register", form, success, error);
 }
Esempio n. 26
0
        public HttpPostRequestProtected(string host, string filePath, string user, string password)
            : base(host, filePath)
        {
            this.user = user;
            this.password = password;

            wwwForm = new WWWForm();
        }
Esempio n. 27
0
 public Request(string uri, WWWForm form)
 {
     this.method = "POST";
     this.uri = new Uri (uri);
     this.bytes = form.data;
     foreach (string k in form.headers.Keys) {
         headers.Set (k, (string)form.headers [k]);
     }
 }
        public void Register(string username, string password, string email)
        {
            WWWForm form = new WWWForm();
            form.AddField("username", username);
            form.AddField("password", password);
            form.AddField("email", email);

            httpService.HttpPost(REGISTRATION_URL, form, RegistrationCallback);
        }
Esempio n. 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hellgate.Http"/> class.
 /// </summary>
 /// <param name="mB">MonoBehaviour.</param>
 /// <param name="u">Url.</param>
 /// <param name="param">Parameter.</param>
 public Http(MonoBehaviour mB, string u, string param)
 {
     mono = mB;
     url = u + param;
     mHeaders = new Dictionary<string, string> ();
     wWWFrom = new WWWForm ();
     timeOut = DEFAULT_TIMEOUT;
     mDisposed = false;
 }
Esempio n. 30
0
		/// <summary>Requests a file over the internet and posts form data to it.</summary>
		/// <param name="url">The url to request.</param>
		/// <param name="onDone">A method to call with the result.</param>
		/// <param name="form">A http form to send with the request.</param>
		public static void Request(string url,OnHttpEvent onDone,WWWForm form){
			HttpRequest request=new HttpRequest(url,onDone);
			
			if(form!=null){
				request.AttachForm(form);
			}
			
			request.Send();
		}
    static int Post(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> >(L, 2))
            {
                string arg0 = ToLua.CheckString(L, 1);
                System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> arg1 = (System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection>)ToLua.ToObject(L, 2);
                UnityEngine.Networking.UnityWebRequest o = UnityEngine.Networking.UnityWebRequest.Post(arg0, arg1);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <System.Collections.Generic.Dictionary <string, string> >(L, 2))
            {
                string arg0 = ToLua.CheckString(L, 1);
                System.Collections.Generic.Dictionary <string, string> arg1 = (System.Collections.Generic.Dictionary <string, string>)ToLua.ToObject(L, 2);
                UnityEngine.Networking.UnityWebRequest o = UnityEngine.Networking.UnityWebRequest.Post(arg0, arg1);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <string>(L, 2))
            {
                string arg0 = ToLua.CheckString(L, 1);
                string arg1 = ToLua.ToString(L, 2);
                UnityEngine.Networking.UnityWebRequest o = UnityEngine.Networking.UnityWebRequest.Post(arg0, arg1);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <UnityEngine.WWWForm>(L, 2))
            {
                string arg0 = ToLua.CheckString(L, 1);
                UnityEngine.WWWForm arg1 = (UnityEngine.WWWForm)ToLua.ToObject(L, 2);
                UnityEngine.Networking.UnityWebRequest o = UnityEngine.Networking.UnityWebRequest.Post(arg0, arg1);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 3)
            {
                string arg0 = ToLua.CheckString(L, 1);
                System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> arg1 = (System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection>));
                byte[] arg2 = ToLua.CheckByteBuffer(L, 3);
                UnityEngine.Networking.UnityWebRequest o = UnityEngine.Networking.UnityWebRequest.Post(arg0, arg1, arg2);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Networking.UnityWebRequest.Post"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 32
0
		/// <summary>Converts this form data to a unity form.</summary>
		/// <returns>A Unity WWWForm suitable for web posting.</returns>
		public WWWForm ToUnityForm(){
			WWWForm result=new WWWForm();
			if(RawFields!=null){
				foreach(KeyValuePair<string,string> kvp in RawFields){
					result.AddField(kvp.Key,kvp.Value);
				}
			}
			return result;
		}
Esempio n. 33
0
 /// <summary>
 /// <para>Creates a WWW request with the given URL.</para>
 /// </summary>
 /// <param name="url">The url to download. Must be '%' escaped.</param>
 /// <param name="form">A WWWForm instance containing the form data to post.</param>
 /// <returns>
 /// <para>A new WWW object. When it has been downloaded, the results can be fetched from the returned object.</para>
 /// </returns>
 public WWW(string url, WWWForm form)
 {
     string[] headers = FlattenedHeadersFrom(form.headers);
     if (this.enforceWebSecurityRestrictions())
     {
         CheckSecurityOnHeaders(headers);
     }
     this.InitWWW(url, form.data, headers);
 }
Esempio n. 34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hellgate.Http"/> class.
 /// </summary>
 /// <param name="mB">MonoBehaviour.</param>
 /// <param name="u">Url.</param>
 /// <param name="time">Time.</param>
 public Http(MonoBehaviour mB, string u, float time)
 {
     mono = mB;
     url = u;
     mHeaders = new Dictionary<string, string> ();
     wWWFrom = new WWWForm ();
     timeOut = time;
     mDisposed = false;
 }
Esempio n. 35
0
        public Request( string method, string uri, WWWForm form )
        {
			this.method = method;
			this.uri = new Uri (uri);
			this.bytes = form.data;
            foreach ( KeyValuePair<string, string> entry in form.headers )
            {
                this.AddHeader( (string)entry.Key, (string)entry.Value );
            }
        }
Esempio n. 36
0
        public static string GetRequestHeader(WWWForm wwwForm)
        {
            string header = "";
            foreach (KeyValuePair<string,string> item in wwwForm.headers)
            {
                header += item.Key + ": " + item.Value + "\n";
            }

            return header;
        }
 static int QPYX_Post_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> >(L_YXQP, 2))
         {
             string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> QPYX_arg1_YXQP = (System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection>)ToLua.ToObject(L_YXQP, 2);
             UnityEngine.Networking.UnityWebRequest QPYX_o_YXQP = UnityEngine.Networking.UnityWebRequest.Post(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <System.Collections.Generic.Dictionary <string, string> >(L_YXQP, 2))
         {
             string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             System.Collections.Generic.Dictionary <string, string> QPYX_arg1_YXQP = (System.Collections.Generic.Dictionary <string, string>)ToLua.ToObject(L_YXQP, 2);
             UnityEngine.Networking.UnityWebRequest QPYX_o_YXQP = UnityEngine.Networking.UnityWebRequest.Post(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <string>(L_YXQP, 2))
         {
             string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             string QPYX_arg1_YXQP = ToLua.ToString(L_YXQP, 2);
             UnityEngine.Networking.UnityWebRequest QPYX_o_YXQP = UnityEngine.Networking.UnityWebRequest.Post(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <UnityEngine.WWWForm>(L_YXQP, 2))
         {
             string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             UnityEngine.WWWForm QPYX_arg1_YXQP = (UnityEngine.WWWForm)ToLua.ToObject(L_YXQP, 2);
             UnityEngine.Networking.UnityWebRequest QPYX_o_YXQP = UnityEngine.Networking.UnityWebRequest.Post(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 3)
         {
             string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> QPYX_arg1_YXQP = (System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection>)ToLua.CheckObject(L_YXQP, 2, typeof(System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection>));
             byte[] QPYX_arg2_YXQP = ToLua.CheckByteBuffer(L_YXQP, 3);
             UnityEngine.Networking.UnityWebRequest QPYX_o_YXQP = UnityEngine.Networking.UnityWebRequest.Post(QPYX_arg0_YXQP, QPYX_arg1_YXQP, QPYX_arg2_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else
         {
             return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.Networking.UnityWebRequest.Post"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static public int get_data(IntPtr l)
 {
     try {
         UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
         pushValue(l, self.data);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 39
0
 static public int get_data(IntPtr l)
 {
     try {
         UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
         pushValue(l, self.data);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.WWWForm o;
         o = new UnityEngine.WWWForm();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 41
0
 static public int get_headers(IntPtr l)
 {
     try {
         UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.headers);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 42
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.WWWForm o;
         o = new UnityEngine.WWWForm();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 43
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.WWWForm o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.WWWForm();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
    static void WWWForm_data(JSVCall vc)
    {
        UnityEngine.WWWForm _this = (UnityEngine.WWWForm)vc.csObj;
        var result = _this.data;
        var arrRet = result;

        for (int i = 0; arrRet != null && i < arrRet.Length; i++)
        {
            JSApi.setByte((int)JSApi.SetType.SaveAndTempTrace, arrRet[i]);
            JSApi.moveSaveID2Arr(i);
        }
        JSApi.setArrayS((int)JSApi.SetType.Rval, (arrRet != null ? arrRet.Length : 0), true);
    }
Esempio n. 45
0
    static int _CreateUnityEngine_WWW(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.WWW.ctor");
#endif
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                string          arg0 = ToLua.CheckString(L, 1);
                UnityEngine.WWW obj  = new UnityEngine.WWW(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <UnityEngine.WWWForm>(L, 2))
            {
                string arg0 = ToLua.CheckString(L, 1);
                UnityEngine.WWWForm arg1 = (UnityEngine.WWWForm)ToLua.ToObject(L, 2);
                UnityEngine.WWW     obj  = new UnityEngine.WWW(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <byte[]>(L, 2))
            {
                string          arg0 = ToLua.CheckString(L, 1);
                byte[]          arg1 = ToLua.CheckByteBuffer(L, 2);
                UnityEngine.WWW obj  = new UnityEngine.WWW(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 3)
            {
                string arg0 = ToLua.CheckString(L, 1);
                byte[] arg1 = ToLua.CheckByteBuffer(L, 2);
                System.Collections.Generic.Dictionary <string, string> arg2 = (System.Collections.Generic.Dictionary <string, string>)ToLua.CheckObject(L, 3, typeof(System.Collections.Generic.Dictionary <string, string>));
                UnityEngine.WWW obj = new UnityEngine.WWW(arg0, arg1, arg2);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.WWW.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 46
0
        static int __CreateInstance(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                if (LuaAPI.lua_gettop(L) == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
                {
                    string url = LuaAPI.lua_tostring(L, 2);

                    UnityEngine.WWW __cl_gen_ret = new UnityEngine.WWW(url);
                    translator.Push(L, __cl_gen_ret);

                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable <UnityEngine.WWWForm>(L, 3))
                {
                    string url = LuaAPI.lua_tostring(L, 2);
                    UnityEngine.WWWForm form = (UnityEngine.WWWForm)translator.GetObject(L, 3, typeof(UnityEngine.WWWForm));

                    UnityEngine.WWW __cl_gen_ret = new UnityEngine.WWW(url, form);
                    translator.Push(L, __cl_gen_ret);

                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
                {
                    string url      = LuaAPI.lua_tostring(L, 2);
                    byte[] postData = LuaAPI.lua_tobytes(L, 3);

                    UnityEngine.WWW __cl_gen_ret = new UnityEngine.WWW(url, postData);
                    translator.Push(L, __cl_gen_ret);

                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && translator.Assignable <System.Collections.Generic.Dictionary <string, string> >(L, 4))
                {
                    string url      = LuaAPI.lua_tostring(L, 2);
                    byte[] postData = LuaAPI.lua_tobytes(L, 3);
                    System.Collections.Generic.Dictionary <string, string> headers = (System.Collections.Generic.Dictionary <string, string>)translator.GetObject(L, 4, typeof(System.Collections.Generic.Dictionary <string, string>));

                    UnityEngine.WWW __cl_gen_ret = new UnityEngine.WWW(url, postData, headers);
                    translator.Push(L, __cl_gen_ret);

                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.WWW constructor!"));
        }
Esempio n. 47
0
 static public int AddBinaryData(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 3)
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Byte[] a2;
             checkArray(l, 3, out a2);
             self.AddBinaryData(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Byte[] a2;
             checkArray(l, 3, out a2);
             System.String a3;
             checkType(l, 4, out a3);
             self.AddBinaryData(a1, a2, a3);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 5)
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Byte[] a2;
             checkArray(l, 3, out a2);
             System.String a3;
             checkType(l, 4, out a3);
             System.String a4;
             checkType(l, 5, out a4);
             self.AddBinaryData(a1, a2, a3, a4);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 48
0
    public void AccountLoginCorrect(string username, string pwd)
    {
        string salt             = "";
        string CorrectHashedPwd = "";
        string answer           = "";

        password = pwd;

        UnityEngine.WWWForm form = new UnityEngine.WWWForm();
        form.AddField("Command", "GetHashSalt");
        form.AddField("acctName", username);
        WWWLoader.instance.myDelegate += OnGetHashAndSalt;
        WWWLoader.Load("http://unitytowerdefense.com/WebService.php", form);
    }
Esempio n. 49
0
    static int _CreateUnityEngine_WWW(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                string          arg0 = ToLua.CheckString(L, 1);
                UnityEngine.WWW obj  = new UnityEngine.WWW(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(byte[])))
            {
                string          arg0 = ToLua.CheckString(L, 1);
                byte[]          arg1 = ToLua.CheckByteBuffer(L, 2);
                UnityEngine.WWW obj  = new UnityEngine.WWW(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(UnityEngine.WWWForm)))
            {
                string arg0 = ToLua.CheckString(L, 1);
                UnityEngine.WWWForm arg1 = (UnityEngine.WWWForm)ToLua.CheckObject(L, 2, typeof(UnityEngine.WWWForm));
                UnityEngine.WWW     obj  = new UnityEngine.WWW(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(byte[]), typeof(System.Collections.Generic.Dictionary <string, string>)))
            {
                string arg0 = ToLua.CheckString(L, 1);
                byte[] arg1 = ToLua.CheckByteBuffer(L, 2);
                System.Collections.Generic.Dictionary <string, string> arg2 = (System.Collections.Generic.Dictionary <string, string>)ToLua.CheckObject(L, 3, typeof(System.Collections.Generic.Dictionary <string, string>));
                UnityEngine.WWW obj = new UnityEngine.WWW(arg0, arg1, arg2);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.WWW.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 50
0
 static public int AddField(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(string), typeof(int)))
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             self.AddField(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (matchType(l, argc, 2, typeof(string), typeof(string)))
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.String a2;
             checkType(l, 3, out a2);
             self.AddField(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.String a2;
             checkType(l, 3, out a2);
             System.Text.Encoding a3;
             checkType(l, 4, out a3);
             self.AddField(a1, a2, a3);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 51
0
 static public int AddBinaryData(IntPtr l)
 {
     try{
         if (matchType(l, 2, typeof(string), typeof(System.Byte[]), typeof(string)))
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Byte[] a2;
             checkType(l, 3, out a2);
             System.String a3;
             checkType(l, 4, out a3);
             self.AddBinaryData(a1, a2, a3);
             return(0);
         }
         else if (matchType(l, 2, typeof(string), typeof(System.Byte[])))
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Byte[] a2;
             checkType(l, 3, out a2);
             self.AddBinaryData(a1, a2);
             return(0);
         }
         else if (matchType(l, 2, typeof(string), typeof(System.Byte[]), typeof(string), typeof(string)))
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Byte[] a2;
             checkType(l, 3, out a2);
             System.String a3;
             checkType(l, 4, out a3);
             System.String a4;
             checkType(l, 5, out a4);
             self.AddBinaryData(a1, a2, a3, a4);
             return(0);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 52
0
 static int RequestHttpPOST(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         LuaFramework.WWWManager obj = (LuaFramework.WWWManager)ToLua.CheckObject <LuaFramework.WWWManager>(L, 1);
         string arg0 = ToLua.CheckString(L, 2);
         UnityEngine.WWWForm arg1 = (UnityEngine.WWWForm)ToLua.CheckObject <UnityEngine.WWWForm>(L, 3);
         LuaFunction         arg2 = ToLua.CheckLuaFunction(L, 4);
         obj.RequestHttpPOST(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 53
0
    static int get_headers(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.WWWForm obj = (UnityEngine.WWWForm)o;
            System.Collections.Generic.Dictionary <string, string> ret = obj.headers;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index headers on a nil value"));
        }
    }
Esempio n. 54
0
    static int get_data(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.WWWForm obj = (UnityEngine.WWWForm)o;
            byte[] ret = obj.data;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index data on a nil value"));
        }
    }
 static int QPYX__CreateUnityEngine_WWW_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 1)
         {
             string          QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             UnityEngine.WWW QPYX_obj_YXQP  = new UnityEngine.WWW(QPYX_arg0_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_obj_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <byte[]>(L_YXQP, 2))
         {
             string          QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             byte[]          QPYX_arg1_YXQP = ToLua.CheckByteBuffer(L_YXQP, 2);
             UnityEngine.WWW QPYX_obj_YXQP  = new UnityEngine.WWW(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_obj_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <UnityEngine.WWWForm>(L_YXQP, 2))
         {
             string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             UnityEngine.WWWForm QPYX_arg1_YXQP = (UnityEngine.WWWForm)ToLua.ToObject(L_YXQP, 2);
             UnityEngine.WWW     QPYX_obj_YXQP  = new UnityEngine.WWW(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_obj_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 3)
         {
             string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1);
             byte[] QPYX_arg1_YXQP = ToLua.CheckByteBuffer(L_YXQP, 2);
             System.Collections.Generic.Dictionary <string, string> QPYX_arg2_YXQP = (System.Collections.Generic.Dictionary <string, string>)ToLua.CheckObject(L_YXQP, 3, typeof(System.Collections.Generic.Dictionary <string, string>));
             UnityEngine.WWW QPYX_obj_YXQP = new UnityEngine.WWW(QPYX_arg0_YXQP, QPYX_arg1_YXQP, QPYX_arg2_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_obj_YXQP);
             return(1);
         }
         else
         {
             return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to ctor method: UnityEngine.WWW.New"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Esempio n. 56
0
    static bool WWW_WWW2(JSVCall vc, int argc)
    {
        int _this = JSApi.getObject((int)JSApi.GetType.Arg);

        JSApi.attachFinalizerObject(_this);
        --argc;

        int len = argc;

        if (len == 2)
        {
            System.String       arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg);
            UnityEngine.WWWForm arg1 = (UnityEngine.WWWForm)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            JSMgr.addJSCSRel(_this, new UnityEngine.WWW(arg0, arg1));
        }

        return(true);
    }
 static int PostToUrl(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         LuaFramework.SDKManager obj = (LuaFramework.SDKManager)ToLua.CheckObject <LuaFramework.SDKManager>(L, 1);
         string arg0 = ToLua.CheckString(L, 2);
         UnityEngine.WWWForm            arg1 = (UnityEngine.WWWForm)ToLua.CheckObject <UnityEngine.WWWForm>(L, 3);
         LuaFunction                    arg2 = ToLua.CheckLuaFunction(L, 4);
         System.Collections.IEnumerator o    = obj.PostToUrl(arg0, arg1, arg2);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 58
0
 static public int AddField(IntPtr l)
 {
     try{
         if (matchType(l, 2, typeof(string), typeof(string)))
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.String a2;
             checkType(l, 3, out a2);
             self.AddField(a1, a2);
             return(0);
         }
         else if (matchType(l, 2, typeof(string), typeof(string), typeof(System.Text.Encoding)))
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.String a2;
             checkType(l, 3, out a2);
             System.Text.Encoding a3;
             checkType(l, 4, out a3);
             self.AddField(a1, a2, a3);
             return(0);
         }
         else if (matchType(l, 2, typeof(string), typeof(int)))
         {
             UnityEngine.WWWForm self = (UnityEngine.WWWForm)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             self.AddField(a1, a2);
             return(0);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 59
-1
 /**
  * Authenticated resource which returns the current balance of the player in Bitcoins
  */
 public void Balance(string name, string pass, Action<JSONObject> success, Action<string> error)
 {
     WWWForm form = new WWWForm();
     form.AddField("name", name);
     form.AddField("pass", Util.Encrypt(pass));
     t.Get("player/balance", form, success, error);
 }
Esempio n. 60
-1
 /**
  * Authenticated resource which returns the current balance of the developer in Bitcoins
  */
 public void Balance(string email, string pass, Action<JSONObject> success, Action<string> error)
 {
     WWWForm form = new WWWForm();
     form.AddField("email", email);
     form.AddField("pass", Util.Encrypt(pass));
     t.Get("developer/balance", form, success, error);
 }