Example #1
0
        static void Main(string[] args)
        {
            //var test = new _004.Median_of_Two_Sorted_Arrays();
            //var re = test.FindMedianSortedArrays(new int[] { 1, 2 }, new int[] { 3, 4 });

            //int[] a = { 1, 2, 3, 4, 5, 6, 7, 9, 1, 2, 3, 4, 5, 6, 7, 9, 12 };
            //int r = a[0];
            //for (int i = 1; i < a.Length; i++)
            //{
            //    r = r ^ a[i];
            //}
            //Console.WriteLine(r.ToString());
            testobj t = new testobj();

            t.s = "new";
            add(t);

            Console.WriteLine(t.s);

            Console.ReadLine();
        }
Example #2
0
    public IEnumerator Testing()
    {
        testobj a = new testobj();

        a.name = "asas";
        a.blog = "asasdadad";

        WWWForm form = new WWWForm();

        form.AddField("", "{" + JsonUtility.ToJson(a).ToString() + "}");
        Debug.Log(form.ToString());


        //var request = new UnityWebRequest("http://129.118.39.57/api/buser/create.php", "POST");
        //byte[] bodyRaw = Encoding.UTF8.GetBytes(JsonUtility.ToJson(a).ToString());
        //request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bodyRaw);
        //request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
        //request.SetRequestHeader("Content-Type", "application/json");
        //yield return request.SendWebRequest();
        //Debug.Log("Status Code: " + request.responseCode);

        UnityWebRequest www = UnityWebRequest.Post("http://129.118.39.57/api/buser/create.php", form);

        www.SetRequestHeader("Content-Type", "application/json");

        using (www)
        {
            yield return(www.SendWebRequest());

            Debug.Log(www.downloadHandler.text);
            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
            }
            else
            {
                Debug.Log(www.downloadHandler.text);
            }
        }
    }
Example #3
0
 public static void add(testobj t)
 {
     t.s = t.s + "add";
 }