Пример #1
0
 private void InstallButton_Click(object sender, EventArgs e)
 {
     if (!Wow.IsAdministrator)
     {
         MessageBox.Show("You must run LoLNotes as admin to install/uninstall it");
         return;
     }
     try
     {
         if (Installer.IsInstalled)
         {
             Installer.Uninstall();
         }
         else
         {
             Installer.Uninstall();
             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";
     UpdateIcon();
 }
Пример #2
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");
        }