コード例 #1
0
ファイル: GAApi.cs プロジェクト: jok886/6020FD772C01DD09
        private static void post(string postData)
        {
            if (EditorConfig.TELEMETRY)
            {
                byte[] data = new System.Text.ASCIIEncoding().GetBytes(postData);

                try
                {
                    System.Net.ServicePointManager.ServerCertificateValidationCallback = Util.Helper.RemoteCertificateValidationCallback;

                    using (System.Net.WebClient client = new Util.CTWebClient())
                    {
                        client.Headers[System.Net.HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                        client.Headers[System.Net.HttpRequestHeader.UserAgent]   = "Mozilla/5.0 (" + userAgent() + ")";

                        client.UploadData("https://www.google-analytics.com/collect", data);

                        if (Util.Constants.DEV_DEBUG)
                        {
                            Debug.Log("Data uploaded: " + postData);
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    if (Util.Constants.DEV_DEBUG)
                    {
                        Debug.LogError("Could not upload GA-data: " + System.Environment.NewLine + ex);
                    }
                }
            }
        }
コード例 #2
0
        private static void post(string postData)
        {
            byte[] data = new System.Text.ASCIIEncoding().GetBytes(postData);

            try
            {
                System.Net.ServicePointManager.ServerCertificateValidationCallback = Util.BaseHelper.RemoteCertificateValidationCallback;

                using (System.Net.WebClient client = new Util.CTWebClient())
                {
                    client.Headers[System.Net.HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                    client.Headers[System.Net.HttpRequestHeader.UserAgent]   = "Mozilla/5.0 (" + userAgent() + ")";

                    client.UploadData("tcelloc/moc.scitylana-elgoog.www//:sptth".CTReverse(), data);

                    if (Util.BaseConstants.DEV_DEBUG)
                    {
                        Debug.Log("Data uploaded: " + postData);
                    }
                }
            }
            catch (System.Exception ex)
            {
                if (Util.BaseConstants.DEV_DEBUG)
                {
                    Debug.LogError("Could not upload GA-data: " + System.Environment.NewLine + ex);
                }
            }
        }
コード例 #3
0
        private static string[] readData()
        {
            string[] data = null;

#if !UNITY_WSA || UNITY_EDITOR
            try
            {
                System.Net.ServicePointManager.ServerCertificateValidationCallback = Util.Helper.RemoteCertificateValidationCallback;

                using (System.Net.WebClient client = new Util.CTWebClient())
                {
                    string content = client.DownloadString(Util.Constants.ASSET_UPDATE_CHECK_URL);

                    foreach (string line in Util.Helper.SplitStringToLines(content))
                    {
                        if (line.StartsWith(Util.Constants.ASSET_UID.ToString()))
                        {
                            data = line.Split(splitChar, System.StringSplitOptions.RemoveEmptyEntries);

                            if (data != null && data.Length >= 3)
                            { //valid record?
                                break;
                            }
                            else
                            {
                                data = null;
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                Debug.LogError("Could not load update file: " + System.Environment.NewLine + ex);
            }
#endif
            return(data);
        }