private void Window_Initialized(object sender, EventArgs e)
        {
            CultureInfo.DefaultThreadCurrentCulture   = new CultureInfo("en-US");
            CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");

            if (!Directory.Exists("data"))
            {
                MessageBox.Show(Debugger.IsAttached ? @"""data"" folder and/or sqlite3.dll not found. Make sure to copy the data folder and sqlite3.dll to the output directory." : "Some files are missing, please reinstall.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                Environment.Exit(-1);
            }

            if (!Debugger.IsAttached)
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            }
            _uiManager = new UiManager();

            LoadExtensionDependencies();

            List <Assembly> assemblies = LoadExtensions();

            _extensionManager = new ExtensionManager(_uiManager, Dispatcher, ConfigDir, new FinalesFunkelnExtension());
            _extensionManager.AddAssemblies(assemblies);
            _extensionManager.InitExtensions();

            foreach (var x in _extensionManager.Extensions)
            {
                var item = new ExtensionMenuItem(x.Value);
                item.Views.AddRange(_uiManager.GetViewsByExtension(x.Value));
                ViewsMenuItem.Items.Add(item);
            }

            DockingManager.Layout.RootPanel = new LayoutPanel(_mainPane = new LayoutDocumentPane());


            foreach (var view in _uiManager.GetViews())
            {
                LayoutContent c = new DocumentViewControl(view);
                _mainPane.Children.Add(c);
            }

#if AIRDEBUG && DEBUG
            _processInjector = new ProcessInjector("adl");          //AirDebugLauncher
#elif LCU
            _processInjector = new ProcessInjector("LeagueClient"); //New LoL client
#else
            _processInjector = new ProcessInjector("lolclient");
#endif

            _processInjector.Injected      += pi_Injected;
            _processInjector.ProcessFound  += ProcessInjector_ProcessFound;
            _processInjector.ProcessExited += _processInjector_ProcessExited;
            _processInjector.Start();
        }
Beispiel #2
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);
            }
        }
Beispiel #3
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            //SetTitle("(Checking)");
            //Task.Factory.StartNew(GetGeneral, TaskCreationOptions.LongRunning);
            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();
        }
Beispiel #4
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();
        }