Exemple #1
0
        //-------------------------------------------------------------------------
        public void getAppConfig(string app_id, OnGetAppConfig handler)
        {
            if (WWWGetAppConfig != null)
            {
                return;
            }

            GetAppConfigHandler = new Action <UCenterResponseStatus, AppConfigurationResponse, UCenterError>(handler);

            string http_url = null;

            if (UCenterDomain.EndsWith("/"))
            {
                http_url = string.Format("{0}api/apps/{1}/configurations", UCenterDomain, app_id);
            }
            else
            {
                http_url = string.Format("{0}/api/apps/{1}/configurations", UCenterDomain, app_id);
            }

            WWWForm form = new WWWForm();

            form.AddField("Accept", "application/x-www-form-urlencoded");
            //form.AddField("Accept-Encoding", "gzip,deflate,sdch");
            form.AddField("Content-Type", "application/json; charset=utf-8");
            form.AddField("Content-Length", 0);
            form.AddField("Host", _getHostName());
            form.AddField("User-Agent", "");

            WWWGetAppConfig = new WWW(http_url);
        }
Exemple #2
0
    //-------------------------------------------------------------------------
    public void getIpAddress(OnGetIpAddress handler)
    {
        if (WWWGetIpAddress != null)
        {
            return;
        }

        GetIpAddressHandler = new Action <UCenterResponseStatus, IPInfoResponse, UCenterError>(handler);

        string http_url = null;

        if (UCenterDomain.EndsWith("/"))
        {
            http_url = string.Format("{0}api/appclient/ip", UCenterDomain);
        }
        else
        {
            http_url = string.Format("{0}/api/appclient/ip", UCenterDomain);
        }

        WWWForm form = new WWWForm();

        form.AddField("Accept", "application/x-www-form-urlencoded");
        form.AddField("Content-Type", "application/json; charset=utf-8");
        form.AddField("Content-Length", 0);
        form.AddField("Host", _getHostName());
        form.AddField("User-Agent", "");

        WWWGetIpAddress = new WWW(http_url, form);
    }
Exemple #3
0
        //-------------------------------------------------------------------------
        string _genUrl(string api)
        {
            string http_url = null;

            if (UCenterDomain.EndsWith("/"))
            {
                http_url = string.Format("{0}api/accounts/{1}", UCenterDomain, api);
            }
            else
            {
                http_url = string.Format("{0}/api/accounts/{1}", UCenterDomain, api);
            }

            return(http_url);
        }