Esempio n. 1
0
        private void NameLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (e.Link.LinkData == null)
            {
                return;
            }
            var    plr = (Tuple <Int64, string>)e.Link.LinkData;
            string region;

            if (!LeagueRegions.TryGetValue(MainSettings.Instance.Region, out region))
            {
                StaticLogger.Info("Region " + MainSettings.Instance.Region + " is not supported");
                return;
            }

            string url = null;

            if (e.Button == MouseButtons.Left)
            {
                url = string.Format("http://www.lolking.net/summoner/{0}/{1}", region, plr.Item1);
            }
            else if (e.Button == MouseButtons.Middle)
            {
                url = string.Format("http://bladecoding.com/lolnotes/leagueofstats.php?name={0}", plr.Item2);
            }

            if (url != null)
            {
                Process.Start(url);
                e.Link.Visited = true;
            }
        }
Esempio n. 2
0
        public static void CleanAndRestart()
        {
            UpdatePowershellScripts();

            if (!EditorUtility.DisplayDialog("Clean caches and restart",
                                             "This will force reimporting the project, make sure you have saved everything first.",
                                             "Continue",
                                             "Cancel"))
            {
                return;
            }

            string arguments = "-ExecutionPolicy Bypass -File WhateverDevsScripts/CleanUpAndRestart.ps1 \""
                               + EditorApplication.applicationPath
                               + "\"";

            StaticLogger.Info(arguments);

            ProcessStartInfo startInfo =
                new ProcessStartInfo("powershell.exe", arguments)
            {
                WorkingDirectory = Environment.CurrentDirectory,
                UseShellExecute  = true
            };

            Process process = new Process {
                StartInfo = startInfo
            };

            process.Start();
        }
Esempio n. 3
0
        private void ViewOwnedSkins_Click(object sender, EventArgs e)
        {
            ViewOwnedSkins.Enabled = false;
            ViewOwnedSkins.Text    = "Saving...";

            List <int> ownedSkinIds = new List <int>();

            foreach (var champ in Champions)
            {
                foreach (var skin in champ.ChampionSkins)
                {
                    if (skin.Owned)
                    {
                        ownedSkinIds.Add(skin.SkinId);
                    }
                }
            }

            string skinSaveId = SaveOwnedSkins(ownedSkinIds);

            Process.Start("http://elophant.com/skins-owned/" + skinSaveId);
            StaticLogger.Info("Process started: http://elophant.com/skins-owned/" + skinSaveId);

            ViewOwnedSkins.Text = "Saved";
        }
Esempio n. 4
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            SetTitle("(Checking)");
            Task.Factory.StartNew(GetGeneral);
            TrackingQueue.Enqueue("startup");

            Settings_Loaded(this, new EventArgs());
            UpdateIcon();

            //Add this after otherwise it will save immediately due to RegionList.SelectedIndex
            Settings.PropertyChanged += Settings_PropertyChanged;

            //Start after the form is shown otherwise Invokes will fail
            Connection.Start();
            Injector.Start();
            launcher.Start();

            //Fixes the team controls size on start as they keep getting messed up in the WYSIWYG
            MainForm_Resize(this, new EventArgs());

            try
            {
                var filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "lolbans", "LoLLoader.dll");
                if (File.Exists(filename))
                {
                    StaticLogger.Info("Uninstalling old loader");

                    var shortfilename = AppInit.GetShortPath(filename);

                    var dlls = AppInit.AppInitDlls32;
                    if (dlls.Contains(shortfilename))
                    {
                        dlls.Remove(AppInit.GetShortPath(shortfilename));
                        AppInit.AppInitDlls32 = dlls;
                    }

                    if (File.Exists(filename))
                    {
                        File.Delete(filename);
                    }
                }
            }
            catch (SecurityException se)
            {
                StaticLogger.Warning(se);
            }
            catch (Exception ex)
            {
                StaticLogger.Error("Failed to uninstall " + ex);
            }
        }
Esempio n. 5
0
        private static BuildProcessorHookLibrary LoadHookLibrary(string mode)
        {
            StaticLogger.Info("Loading " + mode + " hook library...");

            BuildProcessorHookLibrary hookLibrary =
                AssetDatabase.LoadAssetAtPath <BuildProcessorHookLibrary>("Assets/Data/BuildProcessorHooks.asset");

            StaticLogger
            .Info(hookLibrary == null
                         ? "No hook library found. No custom build " + mode + " hooks added."
                         : "Loaded custom build " + mode + " hooks.");

            return(hookLibrary);
        }
Esempio n. 6
0
        [PostProcessBuild(0)] // First to be called after build.
        public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
        {
            bool buildSuccessful = true;
            // ReSharper disable once PossibleNullReferenceException
            string buildFolder = Directory.GetParent(pathToBuiltProject).FullName;

            if (target == BuildTarget.StandaloneWindows ||
                target == BuildTarget.StandaloneWindows64 ||
                target == BuildTarget.StandaloneLinux64 ||
                target == BuildTarget.StandaloneOSX)
            {
                try
                {
                    CopyConfigFolder(buildFolder);
                }
                catch (Exception e)
                {
                    buildSuccessful = false;
                    StaticLogger.Error("Exception!", e);
                }
            }
            else
            {
                StaticLogger.Info("Target is not standalone, skipping config copy.");
            }

            BuildProcessorHookLibrary hookLibrary = LoadHookLibrary("postprocessing");

            if (hookLibrary != null)
            {
                for (int i = 0; i < hookLibrary.PostProcessorHooks.Length; ++i)
                {
                    if (!hookLibrary.PostProcessorHooks[i].RunHook(pathToBuiltProject))
                    {
                        buildSuccessful = false;
                    }
                }
            }

            if (buildSuccessful)
            {
                StaticLogger.Info("Successfully postprocessed build in " + buildFolder + ".");
            }
            else
            {
                StaticLogger.Error("There was an error postprocessing the build, check the console.");
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Checks if the singleton is a DontDestroyOnLoad and sets it up if it isn't.
        /// </summary>
        private static void CheckDontDestroyOnLoad()
        {
            if (instance == null)
            {
                return;
            }
            if (instance.transform.parent != null)
            {
                return;
            }
            if (instance.gameObject.IsDontDestroyOnLoad())
            {
                return;
            }

            StaticLogger.Info(instance.name + " is not DontDestroyOnLoad so setting it up.");

            DontDestroyOnLoad(instance);
        }
Esempio n. 8
0
        /// <summary>
        /// Copies the configuration folder to the build if it exists.
        /// </summary>
        /// <param name="buildPath">The path of the build.</param>
        private static void CopyConfigFolder(string buildPath)
        {
            if (Directory.Exists(buildPath + "/Configuration"))
            {
                Utils.DeleteDirectory(buildPath + "/Configuration");
            }

            if (Directory.Exists("Configuration"))
            {
                StaticLogger.Info("Configuration folder found, copying it to build.");
            }
            else
            {
                StaticLogger.Info("No configuration folder found, skipping config copy.");
                return;
            }

            Utils.CopyFilesRecursively(new DirectoryInfo("Configuration"),
                                       new DirectoryInfo(buildPath + "/Configuration"));
        }
Esempio n. 9
0
 protected void CheckLoop()
 {
     while (CheckThread != null)
     {
         if (CurrentProcess == null || CurrentProcess.HasExited)
         {
             IsInjected     = false;
             CurrentProcess = Process.GetProcessesByName(ProcessName).FirstOrDefault();
             if (CurrentProcess != null)
             {
                 try
                 {
                     Inject();
                     IsInjected = true;
                 }
                 catch (FileNotFoundException fe)
                 {
                     //LoLClient does not have ws2_32 yet. Lets try again in 1 second.
                     StaticLogger.Trace(fe.Message);
                     CurrentProcess = null;
                     Thread.Sleep(1000);
                     continue;
                 }
                 catch (WarningException we)
                 {
                     IsInjected = true;
                     StaticLogger.Info(we.Message);
                 }
                 catch (NotSupportedException nse)
                 {
                     StaticLogger.Warning(nse);
                 }
                 catch (Exception ex)
                 {
                     StaticLogger.Error(new Exception(string.Format("{0} [{1}]", ex.Message, From), ex));
                 }
             }
         }
         Thread.Sleep(500);
     }
 }
Esempio n. 10
0
        protected virtual void OnAccept(IAsyncResult ar)
        {
            ProxyClient client = null;

            try
            {
                if (!IsListening)
                {
                    return;
                }

                client = NewClient(Listener.EndAcceptTcpClient(ar));
                Listener.BeginAcceptTcpClient(OnAccept, null);

                lock (Clients)
                    Clients.Add(client);

                client.Start(RemoteAddress, RemotePort);

                if (client.SourceTcp.Client != null)
                {
                    StaticLogger.Info(string.Format("Client {0} connected", client.SourceTcp.Client.RemoteEndPoint));
                }
            }
            catch (Exception ex)
            {
                if (client != null)
                {
                    OnException(client, ex);
                }
                else
                {
                    //Ignore objectdisposed, happens when stopping
                    if (!(ex is ObjectDisposedException))
                    {
                        StaticLogger.Error(ex);
                    }
                }
            }
        }
Esempio n. 11
0
        public MainForm()
        {
            InitializeComponent();

            Logger.Instance.Register(new DefaultListener(Levels.All, OnLog));
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.ThreadException += Application_ThreadException;
            StaticLogger.Info(string.Format("Version {0}", Version));

            Settings.Load(SettingsFile);

            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.EUNE, new CertificateHolder("prod.eun1.lol.riotgames.com", Resources.prod_eun1_lol_riotgames_com) },
                { LeagueRegion.BR, new CertificateHolder("prod.br.lol.riotgame.com", Resources.prod_br_lol_riotgames_com) }
            };
            ModuleResolvers = new Dictionary <ProcessInjector.GetModuleFrom, RadioButton>
            {
                { ProcessInjector.GetModuleFrom.Toolhelp32Snapshot, ToolHelpRadio },
                { ProcessInjector.GetModuleFrom.ProcessClass, ProcessRadio },
                { ProcessInjector.GetModuleFrom.Mirroring, MirrorRadio }
            };
            foreach (var kv in ModuleResolvers)
            {
                kv.Value.Click += moduleresolvers_Click;
            }

            RegionsFullText = new Dictionary <LeagueRegion, string>
            {
                { LeagueRegion.NA, "North America" },
                { LeagueRegion.EUW, "Europe West" },
                { LeagueRegion.EUNE, "Europe Nordic & East" },
                { LeagueRegion.BR, "Brazil" }
            };

            //Database = Db4oEmbedded.OpenFile(CreateConfig(), "db.yap");

            var cert = Certificates.FirstOrDefault(kv => kv.Key == Settings.Region).Value;

            if (cert == null)
            {
                cert = Certificates.First().Value;
            }

            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;

            //Recorder must be initiated after Reader.ObjectRead as
            //the last event handler is called first
            //Recorder = new GameStorage(Database, Connection);

            Connection.CallResult += Connection_Call;
            Connection.Notify     += Connection_Notify;


            foreach (var kv in Certificates)
            {
                RegionList.Items.Add(RegionsFullText[kv.Key]);
            }
            int idx = RegionList.Items.IndexOf(RegionsFullText[Settings.Region]);

            //StaticLogger.Info("Index: " + idx);
            RegionList.SelectedIndex = idx != -1 ? idx : 0;              //This ends up calling UpdateRegion so no reason to initialize the connection here.

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

            TrackingQueue.Process += TrackingQueue_Process;
            launcher.ProcessFound += launcher_ProcessFound;

#if DEBUG
            button1.Visible = true;
#endif

            StaticLogger.Info("Startup Completed");
        }
Esempio n. 12
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            TrackingQueue.Enqueue("startup");

            Settings_Loaded(this, new EventArgs());
            UpdateStatus();

            //Add this after otherwise it will save immediately due to RegionList.SelectedIndex
            Settings.PropertyChanged += Settings_PropertyChanged;

            Settings.ModuleResolver = "Toolhelp32Snapshot";

            VersionLabel.Text = "v" + Version;

            //Start after the form is shown otherwise Invokes will fail
            Connection.Start();
            Injector.Start();
            launcher.Start();

            //Fixes the team controls size on start as they keep getting messed up in the WYSIWYG
            MainForm_Resize(this, new EventArgs());

            try
            {
                RegistryKey installed_versions = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP");
                string[]    version_names      = installed_versions.GetSubKeyNames();
                //version names start with 'v', eg, 'v3.5' which needs to be trimmed off before conversion
                double framework = Convert.ToDouble(version_names[version_names.Length - 1].Remove(0, 1), CultureInfo.InvariantCulture);

                if (framework < 4.0)
                {
                    if (MessageBox.Show("The Elophant Client requires the .NET Framework 4.0 Full version. Would you like to download it?", ".NET Framework 4.0 Full Not Found", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Process.Start("http://www.microsoft.com/en-us/download/details.aspx?id=17718");
                    }

                    MessageBox.Show("The Elophant Client will now close.");
                    Process.GetCurrentProcess().Kill();
                    return;
                }
            }
            catch (Exception ex)
            {
                StaticLogger.Error(ex.ToString());
                MessageBox.Show("An unknown exception has occurred. Check the log for more information.");
                Process.GetCurrentProcess().Kill();
                return;
            }

            try
            {
                var filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "lolbans", "LoLLoader.dll");
                if (File.Exists(filename))
                {
                    StaticLogger.Info("Uninstalling old loader.");

                    var shortfilename = AppInit.GetShortPath(filename);

                    var dlls = AppInit.AppInitDlls32;
                    if (dlls.Contains(shortfilename))
                    {
                        dlls.Remove(AppInit.GetShortPath(shortfilename));
                        AppInit.AppInitDlls32 = dlls;
                    }

                    if (File.Exists(filename))
                    {
                        File.Delete(filename);
                    }
                }
            }
            catch (SecurityException se)
            {
                StaticLogger.Warning(se);
            }
            catch (Exception ex)
            {
                StaticLogger.Error("Failed to uninstall. Message: " + ex);
            }

            // NOT SURE IF THIS WORKS - TRYING TO AVOID THE USE OF AN INSTALL BUTTON
            try
            {
                if (!Installer.IsInstalled)
                {
                    if (!Wow.IsAdministrator)
                    {
                        MessageBox.Show("Please run the Elophant Client as the Administrator to install it.");
                        Process.GetCurrentProcess().Kill();
                        return;
                    }
                    try
                    {
                        Installer.Install();
                    }
                    catch (UnauthorizedAccessException uaex)
                    {
                        MessageBox.Show("Unable to fully install/uninstall. Make sure LoL is not running.");
                        StaticLogger.Warning(uaex);
                    }
                    //InstallButton.Text = Installer.IsInstalled ? "Uninstall" : "Install";
                    UpdateStatus();
                }
            }
            catch
            {
            }

            TryToCheckForUpdates();
        }
Esempio n. 13
0
        protected void CheckLoop()
        {
            bool showedError = false;

            while (CheckThread != null)
            {
                if (CurrentProcess != null)
                {
                    try
                    {
                        if (CurrentProcess.HasExited)
                        {
                            CurrentProcess = null;
                            IsInjected     = false;                         // update icon
                        }
                    }
                    catch (Exception ex)
                    {
                        if (!showedError)
                        {
                            ErrorMessage = "Privilege of LoLNotes must be greater or equal to that of the LoLClient.\n\nSituations where LoLClient is run as admin and LoLNotes is not are no good.";
                            showedError  = true;
                        }
                        StaticLogger.Error(ex);
                        CurrentProcess = null;
                        IsInjected     = false;                     // update icon
                    }
                }

                if (CurrentProcess == null)
                {
                    CurrentProcess = Process.GetProcessesByName(ProcessName).FirstOrDefault();
                    if (CurrentProcess != null)
                    {
                        try
                        {
                            Inject();
                            IsInjected = true;
                        }
                        catch (FileNotFoundException fe)
                        {
                            //LoLClient does not have ws2_32 yet. Lets try again in 1 second.
                            StaticLogger.Trace(fe.Message);
                            CurrentProcess = null;
                            Thread.Sleep(1000);
                            continue;
                        }
                        catch (WarningException we)
                        {
                            IsInjected = true;
                            StaticLogger.Info(we.Message);
                        }
                        catch (NotSupportedException nse)
                        {
                            StaticLogger.Warning(nse);
                        }
                        catch (Exception ex)
                        {
                            StaticLogger.Error(new Exception(string.Format("{0} [{1}]", ex.Message, From), ex));
                        }
                    }
                }
                Thread.Sleep(500);
            }
        }
Esempio n. 14
0
        public MainForm()
        {
            InitializeComponent();

            Logger.Instance.Register(new DefaultListener(Levels.All, OnLog));
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.ThreadException += Application_ThreadException;
            StaticLogger.Info(string.Format("Version {0}", Version));

            Settings.Load(SettingsFile);

            Icons = new Dictionary <string, Icon>
            {
                { "Red", Icon.FromHandle(Resources.circle_red.GetHicon()) },
                { "Yellow", Icon.FromHandle(Resources.circle_yellow.GetHicon()) },
                { "Green", Icon.FromHandle(Resources.circle_green.GetHicon()) },
            };

            Certificates = LoadCertificates(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Content/Certificates"));
            if (Certificates.Count < 1)
            {
                MessageBox.Show("Unable to load any certificates");
                Application.Exit();
                return;
            }

            ModuleResolvers = new Dictionary <ProcessInjector.GetModuleFrom, RadioButton>
            {
                { ProcessInjector.GetModuleFrom.Toolhelp32Snapshot, ToolHelpRadio },
                { ProcessInjector.GetModuleFrom.ProcessClass, ProcessRadio },
                { ProcessInjector.GetModuleFrom.Mirroring, MirrorRadio }
            };
            foreach (var kv in ModuleResolvers)
            {
                kv.Value.Click += moduleresolvers_Click;
            }

            Database = Db4oEmbedded.OpenFile(CreateConfig(), "db.yap");

            var cert = Certificates.FirstOrDefault(kv => kv.Key == Settings.Region).Value;

            if (cert == null)
            {
                cert = Certificates.First().Value;
            }

            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;

            //Recorder must be initiated after Reader.ObjectRead as
            //the last event handler is called first
            Recorder = new GameStorage(Database, Connection);

            Connection.CallResult += Connection_Call;
            Connection.Notify     += Connection_Notify;


            foreach (var kv in Certificates)
            {
                RegionList.Items.Add(kv.Key);
            }
            int idx = RegionList.Items.IndexOf(Settings.Region);

            RegionList.SelectedIndex = idx != -1 ? idx : 0;              //This ends up calling UpdateRegion so no reason to initialize the connection here.

            DefaultGameTab.Text = Settings.DefaultGameTab;

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

            TrackingQueue.Process += TrackingQueue_Process;
            launcher.ProcessFound += launcher_ProcessFound;

#if DEBUG
            button1.Visible = true;
#endif

            StaticLogger.Info("Startup Completed");
        }
Esempio n. 15
0
        void launcher_ProcessFound(object sender, ProcessMonitor.ProcessEventArgs e)
        {
            try
            {
                if (!Settings.DeleteLeaveBuster)
                {
                    return;
                }

                var dir = Path.GetDirectoryName(e.Process.MainModule.FileName);
                if (dir == null)
                {
                    StaticLogger.Warning("Launcher module not found");
                    return;
                }

                var needle = "\\RADS\\";
                var i      = dir.LastIndexOf(needle, StringComparison.InvariantCulture);
                if (i == -1)
                {
                    StaticLogger.Warning("Launcher Rads not found");
                    return;
                }

                dir = dir.Remove(i + needle.Length);
                dir = Path.Combine(dir, "projects\\lol_air_client\\releases");

                if (!Directory.Exists(dir))
                {
                    StaticLogger.Warning("lol_air_client directory not found");
                    return;
                }

                foreach (var ver in new DirectoryInfo(dir).GetDirectories())
                {
                    var filename = Path.Combine(ver.FullName, "deploy\\preferences\\global\\global.properties");
                    if (!File.Exists(filename))
                    {
                        StaticLogger.Warning(filename + " not found");
                        continue;
                    }

                    ASObject obj = null;
                    using (var amf = new AMFReader(File.OpenRead(filename)))
                    {
                        try
                        {
                            obj = amf.ReadAMF3Data() as ASObject;
                            if (obj == null)
                            {
                                StaticLogger.Warning("Failed to read " + filename);
                                continue;
                            }
                        }
                        catch (Exception ex)
                        {
                            StaticLogger.Warning("LeaverBuster: Unable to read global.properties '" + filename + "'");
                            continue;
                        }
                    }
                    object leaver;
                    object locale;
                    if ((obj.TryGetValue("leaverData", out leaver) && leaver != null) ||
                        (obj.TryGetValue("localeData", out locale) && locale != null))
                    {
                        obj["leaverData"] = null;
                        obj["localeData"] = null;
                        using (var amf = new AMFWriter(File.Open(filename, FileMode.Create, FileAccess.Write)))
                        {
                            try
                            {
                                amf.WriteAMF3Data(obj);
                                StaticLogger.Info("Removed leaverData/localeData from global.properties");
                            }
                            catch (Exception ex)
                            {
                                StaticLogger.Warning("LeaverBuster: Unable to write global.properties '" + filename + "'");
                                continue;
                            }
                        }
                    }
                    else
                    {
                        StaticLogger.Info("leaverData/localeData already removed from global.properties");
                    }
                }
            }
            catch (Exception ex)
            {
                StaticLogger.Error(ex);
            }
        }
Esempio n. 16
0
        public MainForm()
        {
            String regionFromFileName = System.AppDomain.CurrentDomain.FriendlyName;

            Console.WriteLine(regionFromFileName);
            regionFromFileName = regionFromFileName.Replace("LoLTeamChecker", "");
            Console.WriteLine(regionFromFileName);
            regionFromFileName = regionFromFileName.Replace(".exe", "");
            Console.WriteLine(regionFromFileName);
            if (regionFromFileName.Length != 0)
            {
                Settings.Region = regionFromFileName;
            }

            InitializeComponent();
            Logger.Instance.Register(new DefaultListener(Levels.All, OnLog));
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.ThreadException += Application_ThreadException;
            //StaticLogger.Info(string.Format("Version {0}", Version));

            //Settings.Load(SettingsFile);

            Icons = new Dictionary <string, Icon>
            {
                { "Red", Icon.FromHandle(Resources.circle_red.GetHicon()) },
                { "Yellow", Icon.FromHandle(Resources.circle_yellow.GetHicon()) },
                { "Green", Icon.FromHandle(Resources.circle_green.GetHicon()) },
            };

            Certificates = LoadCertificates();
            if (Certificates.Count < 1)
            {
                MessageBox.Show("Unable to load any certificates");
                Application.Exit();
                return;
            }
            var cert = Certificates.FirstOrDefault(kv => kv.Key == Settings.Region).Value;

            if (cert == null)
            {
                cert = Certificates.First().Value;
            }

            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;

            Connection.CallResult += Connection_Call;
            Connection.Notify     += Connection_Notify;

            /*
             *          foreach (var kv in Certificates)
             *                  RegionList.Items.Add(kv.Key);
             *          int idx = RegionList.Items.IndexOf(Settings.Region);
             *          RegionList.SelectedIndex = idx != -1 ? idx : 0;	 //This ends up calling UpdateRegion so no reason to initialize the connection here.
             */
            Installer = new CertificateInstaller(Certificates.Select(c => c.Value.Certificate).ToArray());
            Installer.Uninstall();
            if (!Installer.IsInstalled)
            {
                Installer.Install();
            }

            TrackingQueue.Process += TrackingQueue_Process;
            launcher.ProcessFound += launcher_ProcessFound;

            StaticLogger.Info("Startup Completed");
        }