Exemplo n.º 1
0
 public WebServiceClient()
     : base(API_BASE_URL)
 {
     #if DEBUG
     SSLValidator.OverrideValidation();
     #endif
 }
Exemplo n.º 2
0
        public void Day7_Part2()
        {
            var input     = Utils.ReadLines("day7_data.txt");
            var validator = new SSLValidator();
            int numberOfLinesThatSupportTLS = input.Count(validator.SupportsSSL);

            Assert.That(numberOfLinesThatSupportTLS, Is.EqualTo(231));
        }
Exemplo n.º 3
0
 protected void Awake()
 {
     _CLIENT_ID     = !String.IsNullOrEmpty(_CLIENT_ID) ? _CLIENT_ID : ForgeLoaderConstants.FORGE_CLIENT_ID;
     _CLIENT_SECRET = !String.IsNullOrEmpty(_CLIENT_SECRET) ? _CLIENT_SECRET : ForgeLoaderConstants.FORGE_CLIENT_SECRET;
                 #if !UNITY_WSA
     //Debug.Log (System.Environment.Version) ; // 2.0
     //ServicePointManager.CertificatePolicy =new NoCheckCertificatePolicy () ;
     SSLValidator.OverrideValidation();
                 #else
     mb = GameObject.FindObjectOfType <MonoBehaviour> ();
                 #endif
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            // make sure no other log exchanger is running
            Process process     = Process.GetCurrentProcess();
            string  processName = process.ProcessName;

            Process[] logExchangerProcesses = Process.GetProcessesByName(processName);

            if (logExchangerProcesses.Length > 1)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SSLValidator.OverrideValidation();

            System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-GB");
            System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
            System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

            if (args.Length > 0 && args[0] == "/n")
            {
                GeneralData generalData = GetGeneralData();
                User        user        = GetUser();

                Logger logger = new Logger("LogExchanger", ConfigurationSettings.AppSettings["AppDataPath"] + "SettingsData\\OxigenDebugLE.txt");

                if (generalData != null && user != null)
                {
                    // simply try to access the network to provoke any firewall the target machine has, then exit application
                    // connect to relay
                    ServerConnectAttempt.ResponsiveServerDeterminator.GetResponsiveURI
                        (ServerConnectAttempt.ServerType.RelayLogs,
                        int.Parse(generalData.NoServers["relayLog"]),
                        int.Parse(generalData.Properties["serverTimeout"]),
                        user.GetMachineGUIDSuffix(),
                        generalData.Properties["primaryDomainName"],
                        generalData.Properties["secondaryDomainName"],
                        "UserDataMarshaller.svc", logger);
                }

                Application.Exit();
                return;
            }
            else
            {
                Exchanger exchanger = new Exchanger();
                exchanger.Execute();
            }
        }
Exemplo n.º 5
0
    /// <summary>
    /// HTMLの取得関数(SSLエラー対処済み)
    /// </summary>
    /// <param name="URL"></param>
    /// <returns></returns>
    private string getHtml(string URL)
    {
        SSLValidator.OverrideValidation();    //Avoid SSL error
        WebClient    wc   = new WebClient();
        Stream       st   = wc.OpenRead(URL);
        Encoding     enc  = Encoding.GetEncoding("utf-8");
        StreamReader sr   = new StreamReader(st, enc);
        string       html = sr.ReadToEnd();

        sr.Close();
        st.Close();
        return(html);
    }
Exemplo n.º 6
0
        public virtual void Awake()            // Awake is called before Start()
        {
#if !UNITY_WSA
            //Debug.Log (System.Environment.Version) ; // 2.0
            //ServicePointManager.CertificatePolicy =new NoCheckCertificatePolicy () ;
            SSLValidator.OverrideValidation();
#endif
            if (ProcessedNodes != null)
            {
                ProcessedNodes(this, 0.0f);
            }
            started = DateTime.Now;
            requestScene();
            Active = true;
        }
Exemplo n.º 7
0
        }                                                // The surrogate MonoBehaviour that we'll use to manage this coroutine.
#endif

        #endregion

        #region Constructors
        public RestClient(Uri _uri, Hashtable _headers = null)
        {
#if !UNITY_WSA
            //Debug.Log (System.Environment.Version) ; // 2.0
            //ServicePointManager.CertificatePolicy =new NoCheckCertificatePolicy () ;
            SSLValidator.OverrideValidation();
#endif

            state   = RequestStatus.eNew;
            uri     = _uri;
            headers = (_headers == null ? new Hashtable() : _headers);
#if UNITY_WSA
            mb = GameObject.FindObjectOfType <MonoBehaviour> ();
#endif
        }
Exemplo n.º 8
0
        }                                                // The surrogate MonoBehaviour that we'll use to manage this coroutine.
#endif

        #endregion

        #region Constructors
        public oAuth2Legged(Hashtable _headers = null)
        {
#if !UNITY_WSA
            //Debug.Log (System.Environment.Version) ; // 2.0
            //ServicePointManager.CertificatePolicy =new NoCheckCertificatePolicy () ;
            SSLValidator.OverrideValidation();
#endif

            state   = RequestStatus.eNew;
            uri     = new Uri(ForgeLoaderConstants._forgeoAuth2legged);
            headers = (_headers == null ? new Hashtable() : _headers);
#if UNITY_WSA || COROUTINE
            mb = GameObject.FindObjectOfType <MonoBehaviour> ();
#endif
        }
Exemplo n.º 9
0
        }                                                // The surrogate MonoBehaviour that we'll use to manage this coroutine.
#endif

        #endregion

        #region Constructors
        public oAuth2Legged(string clientID = null, string clientSecret = null, Hashtable _headers = null)
        {
#if !UNITY_WSA
            //Debug.Log (System.Environment.Version) ; // 2.0
            //ServicePointManager.CertificatePolicy =new NoCheckCertificatePolicy () ;
            SSLValidator.OverrideValidation();
#endif
            state         = RequestStatus.eNew;
            uri           = new Uri(ForgeLoaderConstants._forgeoAuth2legged);
            CLIENT_ID     = !String.IsNullOrEmpty(clientID) ? clientID : ForgeLoaderConstants.FORGE_CLIENT_ID;
            CLIENT_SECRET = !String.IsNullOrEmpty(clientSecret) ? clientSecret : ForgeLoaderConstants.FORGE_CLIENT_SECRET;

            headers = (_headers == null ? new Hashtable() : _headers);
#if UNITY_WSA || COROUTINE
            mb = GameObject.FindObjectOfType <MonoBehaviour> ();
#endif
        }
Exemplo n.º 10
0
    private void RetrieveTable(string tableURL)
    {
        try
        {
            SSLValidator.OverrideValidation();

            var request = (HttpWebRequest)WebRequest.Create(tableURL);
            request.Method  = WebRequestMethods.Http.Get;
            request.Timeout = REQUEST_TIMEOUT;
            var response = (HttpWebResponse)request.GetResponse();
            var reader   = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8);
            var rows     = new List <string>(reader.ReadToEnd().Split((char)10));

            foreach (var row in rows)
            {
                string key = row.Split(',')[0];
                if (cachedText.ContainsKey(key))
                {
                    continue;
                }
                string value = row
                               .Replace(key + ',', string.Empty)
                               .Replace("\"", string.Empty)
                               .Replace("<br>", System.Environment.NewLine);
                cachedText.Add(key, value);
            }
        }
        catch (Exception e)
        {
            ServiceLocator.Logger.Log(e.Message);
            Thread.Sleep(500);
            RetrieveTable(tableURL);
            return;
        }

        downloadProgress += .144f;
        if (downloadProgress > 1)
        {
            downloadProgress = 1;
            Events.RaiseTextUpdated();
        }
    }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            // make sure no other content exchanger is running
            Process process     = Process.GetCurrentProcess();
            string  processName = process.ProcessName;

            Process[] contentExchangerProcesses = Process.GetProcessesByName(processName);

            if (contentExchangerProcesses.Length > 1)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SSLValidator.OverrideValidation();

            System.Globalization.CultureInfo systemCultureInfo = System.Globalization.CultureInfo.CurrentCulture;
            System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-GB");
            System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
            System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

            if (args.Length > 0)
            {
                if (args[0] == "/v")
                {
                    Application.Run(new VerboseRunForm(systemCultureInfo));
                    return;
                }

                if (args[0] == "/s")
                {
                    Application.Run(new SafeModeForm());
                    return;
                }
            }
            else
            {
                Exchanger exchanger = new Exchanger();

                ExchangeStatus status = exchanger.Execute();

                CELog log = new CELog(DateTime.Now, status.ContentDownloaded, status.ExitWithError);
                log.SaveLog();

                if (status.LowDiskSpace)
                {
                    MessageBox.Show(Resources.LowDiskSpaceText, Resources.LowDiskSpaceHeader);

                    return;
                }

                if (status.LowAssetSpace)
                {
                    MessageBox.Show(Resources.LowAssetSpaceText, Resources.LowAssetSpaceHeader);

                    return;
                }
            }
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            // Put main thread on hold for a second. This is for when the application restarts itself with elevated privileges
            // to perform the software update.
            // immediately after this line there is a check to see if there is a software updater already running and exit if
            // there is. As the software updater starts a new instance of itself if elevated privileges are needed and THEN
            // the first instance exits, it is possible that the second instance will start the check before the first instance
            // exits and that will exit too.
            // Sleeping the thread for 1 sec doesn't guarantee that the first instance won't exit in time but
            // the chances of both instances exiting are minuscule as the first instance starts the second just right before
            // it exits.
            System.Threading.Thread.Sleep(1000);

            // make sure no other software updater is running
            Process process     = Process.GetCurrentProcess();
            string  processName = process.ProcessName;

            Process[] processes = Process.GetProcessesByName(processName);

            if (processes.Length > 1)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SSLValidator.OverrideValidation();

            System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-GB");
            System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
            System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

            string appDataPath = System.Configuration.ConfigurationSettings.AppSettings["AppDataPath"];

            if (args.Length > 0)
            {
                // network access mode to provoke the client's firewall
                if (args[0] == "/n")
                {
                    GeneralData generalData = GetGeneralData();
                    User        user        = GetUser();

                    if (generalData != null && user != null)
                    {
                        ResponsiveServerDeterminator.GetResponsiveURI
                            (ServerType.RelayLogs,
                            int.Parse(generalData.NoServers["relayChannelAssets"]),
                            int.Parse(generalData.Properties["serverTimeout"]),
                            user.GetMachineGUIDSuffix(),
                            generalData.Properties["primaryDomainName"],
                            generalData.Properties["secondaryDomainName"],
                            "UserDataMarshaller.svc");
                    }

                    Application.Exit();
                    return;
                }

                // verbose mode: pop up form.
                if (args[0] == "/v")
                {
                    AppDataSingleton.Instance.IsVerboseMode = true;
                    VerboseModeForm form = new VerboseModeForm(appDataPath);
                    Application.Run(form);
                }
            }

            // This if will be true if user has restarted the application to gain Admin privileges.
            // Application does not need Admin privileges if it's only checking for new updates but only
            // if it has determined that they exist and needs to download them.
            if (HasAdminRights() && System.IO.Directory.Exists(appDataPath) &&
                System.IO.File.Exists(appDataPath + "\\SettingsData\\components.dat"))
            {
                // update app.config with any new parameters
                UpdateConfig();

                if (CanDeserialize(appDataPath + "\\SettingsData\\components.dat"))
                {
                    Application.Run(new ProgressForm());
                    return;
                }
                else
                {
                    File.Delete(appDataPath + "\\SettingsData\\components.dat");
                }
            }

            if (args.Length == 0)
            {
                // Code that will execute if user run app as non-admin.
                // it will check for updates and ask for elevated privileges.
                ComponentListRetriever clr = new ComponentListRetriever();
                clr.Retrieve();

                UpdatePrompter prompter = new UpdatePrompter(clr, appDataPath);
                prompter.PromptForUpdateIfExists();
            }
        }