public RtmpsProxyClient(IProxyHost host, TcpClient src)
			: base(host, src)
		{
			if (!(host is RtmpsProxyHost))
				throw new ArgumentException("Expected RtmpsProxyHost, got " + host.GetType());

			Host = (RtmpsProxyHost)host;
		}
        public RtmpsProxyClient(IProxyHost host, TcpClient src)
            : base(host, src)
        {
            if (!(host is RtmpsProxyHost))
            {
                throw new ArgumentException("Expected RtmpsProxyHost, got " + host.GetType());
            }

            Host = (RtmpsProxyHost)host;
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            /*
             * Logging
            DefaultListener listener = new DefaultListener(Levels.All,
                    (LogHandler)delegate(Levels level, object log)
                    {
                        System.IO.File.AppendAllText("output.log", level.ToString() + " > " + log.ToString() + Environment.NewLine);
                        //WriteLine(log.ToString());
                    });

            StaticLogger.Register(listener);
             */

            /*
             * Intercepting + listening to LoL
             */
            Certificates = new Dictionary<LeagueRegion, CertificateHolder>
                                {
                                    {LeagueRegion.NA, new CertificateHolder("prod.na1.lol.riotgames.com", Resources.prod_na1_lol_riotgames_com)},
                                    {LeagueRegion.EUW, new CertificateHolder("prod.eu.lol.riotgames.com", Resources.prod_eu_lol_riotgames_com)},
                                    {LeagueRegion.EUN, new CertificateHolder("prod.eun1.lol.riotgames.com", Resources.prod_eun1_lol_riotgames_com)},
                                    {LeagueRegion.GARENA, new CertificateHolder("prod.lol.garenanow.com", Resources.prod_lol_garenanow_com)},
             			                    };

            var cert = Certificates[LeagueRegion.NA];

            Injector = new ProcessInjector("lolclient");
            Connection = new RtmpsProxyHost(2099, cert.Domain, 2099, cert.Certificate);
            Reader = new MessageReader(Connection);

            Connection.Connected += Connection_Connected;

            Injector.Injected += Injector_Injected;

            Reader.ObjectRead += Reader_ObjectRead;

            Installer = new CertificateInstaller(Certificates.Select(c => c.Value.Certificate).ToArray());
            //Install the ssl certificates
            if (!Installer.IsInstalled)
            {
                Installer.Install();
            }

            try
            {
                Injector.Start();
                Connection.Start();
            }
            catch (Exception e23)
            {
                int done = 1;
            }

            /*
             * Jack in
             */
            webControl1.LoadURL(TerminalUrl);
            webControl1.LoadCompleted += new EventHandler(webControl1_LoadCompleted);

            //Awesomium.Core.
            //WebSession session = WebCore.CreateWebSession("C:\\SessionDataPath", WebPreferences.Default);

            /*
             * Setup the form
             */
            System.Windows.Forms.Timer repositionOverlay = new System.Windows.Forms.Timer();
            repositionOverlay.Interval = 100;
            repositionOverlay.Tick += new EventHandler(repositionOverlay_Tick);
            repositionOverlay.Start();

            Hook.KeyPressed += new EventHandler<KeyPressedEventArgs>(Hook_KeyPressed);

            Hook.RegisterHotKey(GG_TerminalOverlay.ModifierKeys.None, Keys.F1);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            /*
             * Logging
            DefaultListener listener = new DefaultListener(Levels.All,
                    (LogHandler)delegate(Levels level, object log)
                    {
                        System.IO.File.AppendAllText("output.log", level.ToString() + " > " + log.ToString() + Environment.NewLine);
                        //WriteLine(log.ToString());
                    });

            StaticLogger.Register(listener);
             */

            if (!Wow.IsAdministrator)
            {
                MessageBox.Show("You must run GG Terminal as an administrator!");
                Application.Exit();
                return;
            }

            /*
             * Intercepting + listening to LoL
             */
            Certificates = LoadCertificates(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Certificates"));
            if (Certificates.Count < 1)
            {
                MessageBox.Show("Unable to load any certificates, do you have the 'Certificates' folder alongside this executable?!");
                Application.Exit();
                return;
            }

            var cert = Certificates["NA"];

            Injector = new ProcessInjector("lolclient");
            Connection = new RtmpsProxyHost(2099, cert.Domain, 2099, cert.Certificate);
            Reader = new MessageReader(Connection);

            Connection.Connected += Connection_Connected;
            Injector.Injected += Injector_Injected;
            Reader.ObjectRead += Reader_ObjectRead;

            Installer = new CertificateInstaller(Certificates.Select(c => c.Value.Certificate).ToArray());

            if (!Installer.IsInstalled)
            {
                Installer.Install();
            }

            Connection.Start();
            Injector.Start();

            /*
             * Jack in
             */
            webControl1.LoadURL(new Uri(TerminalUrl));
            webControl1.LoadingFrameComplete += new FrameEventHandler(webControl1_LoadCompleted);

            //webControl1.java += new JSConsoleMessageAddedEventHandler(webControl1_JSConsoleMessageAdded);

            //Awesomium.Core.
            //WebSession session = WebCore.CreateWebSession("C:\\SessionDataPath", WebPreferences.Default);

            /*
             * Setup the form
             */
            System.Windows.Forms.Timer repositionOverlay = new System.Windows.Forms.Timer();
            repositionOverlay.Interval = 100;
            repositionOverlay.Tick += new EventHandler(repositionOverlay_Tick);
            repositionOverlay.Start();

            Hook.KeyPressed += new EventHandler<KeyPressedEventArgs>(Hook_KeyPressed);

            Hook.RegisterHotKey(GG_TerminalOverlay.ModifierKeys.None, Keys.F1);
        }