コード例 #1
0
        public static void GetHttpDnsIP(string strUrl, System.Action <string, string> onComplete)
        {
            string url = string.Format("http://119.29.29.29/d?dn={0}", strUrl); System.Action <CRequest> onEnd = delegate(CRequest req) {
                string   text   = req.data.ToString();
                string[] strIps = text.Split(';');
                string   strIp  = strIps[0];
                onComplete(strUrl, strIp);
            };

            Debug.Log("ResourcesLoader.HttpRequest:" + url);
            ResourcesLoader.HttpRequest(url, null, typeof(string), onEnd, null, null);
        }
コード例 #2
0
        bool _Update()
        {
            string url = HttpDns.GetUrl(cRequest.url); // get dsn ip

            if (string.IsNullOrEmpty(url))
            {
                return(true); //wait for ip
            }

            if (url != cRequest.url)
            {
                cRequest.overrideHost = cRequest.uri.Host;// set host
                cRequest.overrideUrl  = url;
                // request
                Debug.LogFormat("request ip {0}  override host {1} ", url, cRequest.overrideHost);
                ResourcesLoader.HttpRequest(cRequest);
            }
            else if (originalOperation != null)
            {
                Debug.LogFormat(" dns resolve fail request url {0}   ", url);
                ResourcesLoader.ProcessFinishedOperation(originalOperation);
            }
            else
            {
                Debug.LogFormat("dns resolve fail , complete request url {0} ", url);

                cRequest.DispatchEnd();

                if (cRequest.group != null)
                {
                    cRequest.group.Complete(cRequest, true);
                }

                cRequest.ReleaseToPool();
            }

            return(false);
        }