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"); }
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"); }
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"); }