Esempio n. 1
0
 private void GameSettingOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
 {
     foreach (var instance in Injection.LeagueInstances)
     {
         Injection.SendConfig(instance);
     }
 }
Esempio n. 2
0
 private void GameSettingOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
 {
     if (Injection.IsInjected)
     {
         Injection.SendConfig(IntPtr.Zero);
     }
 }
Esempio n. 3
0
        private void KeyboardHookOnOnKeyUpTrigger(int vKeyCode)
        {
            if (!Injection.IsInjected)
            {
                return;
            }

            var reloadVKey =
                KeyInterop.VirtualKeyFromKey(
                    Config.Instance.Hotkeys.SelectedHotkeys.First(h => h.Name == "Reload").Hotkey);
            var reloadAndCompileVKey =
                KeyInterop.VirtualKeyFromKey(
                    Config.Instance.Hotkeys.SelectedHotkeys.First(h => h.Name == "CompileAndReload").Hotkey);

            if (vKeyCode == reloadVKey || vKeyCode == reloadAndCompileVKey)
            {
                var targetAssemblies =
                    Config.Instance.SelectedProfile.InstalledAssemblies.Where(
                        a => a.InjectChecked || a.Type == AssemblyType.Library).ToList();

                foreach (var instance in Injection.LeagueInstances)
                {
                    foreach (var assembly in targetAssemblies)
                    {
                        Injection.UnloadAssembly(instance, assembly);
                    }
                }

                if (vKeyCode == reloadAndCompileVKey)
                {
                    //Recompile the assemblies:
                    foreach (var assembly in targetAssemblies)
                    {
                        if (assembly.Type == AssemblyType.Library)
                        {
                            assembly.Compile();
                        }
                    }

                    foreach (var assembly in targetAssemblies)
                    {
                        if (assembly.Type != AssemblyType.Library)
                        {
                            assembly.Compile();
                        }
                    }
                }

                foreach (var instance in Injection.LeagueInstances)
                {
                    foreach (var assembly in targetAssemblies)
                    {
                        Injection.LoadAssembly(instance, assembly);
                    }

                    Injection.SendConfig(instance);
                }
            }
        }
Esempio n. 4
0
 private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
 {
     if (msg == 32769)
     {
         var lhwid = wParam;
         Task.Factory.StartNew(
             () =>
         {
             Injection.SendConfig(lhwid);
             Thread.Sleep(1500);
             foreach (var assembly in Config.Instance.SelectedProfile.InstalledAssemblies.Where(a => a.InjectChecked))
             {
                 Injection.LoadAssembly(lhwid, assembly);
             }
         });
     }
     return(IntPtr.Zero);
 }
Esempio n. 5
0
        private void OnLogin(string username)
        {
            Utility.Log(LogStatus.Ok, "Login", string.Format("Succesfully signed in as {0}", username), Logs.MainLog);
            Browser.Visibility    = Visibility.Visible;
            TosBrowser.Visibility = Visibility.Visible;
            try
            {
                Utility.MapClassToXmlFile(typeof(Config), Config.Instance, Directories.ConfigFilePath);
            }
            catch
            {
                MessageBox.Show(Utility.GetMultiLanguageText("ConfigWriteError"));
            }

            if (!PathRandomizer.CopyFiles())
            {
                MessageBox.Show(Utility.GetMultiLanguageText("RandomizationFailed"));
                Environment.Exit(0);
            }

            Injection.OnInject += hwnd => Task.Factory.StartNew(
                () =>
            {
                Injection.SendLoginCredentials(hwnd, Config.Instance.Username, Config.Instance.Password);
                Injection.SendConfig(hwnd);
            });

            InjectThread = new Thread(
                () =>
            {
                while (true)
                {
                    if (Config.Instance.Install)
                    {
                        Injection.Pulse();
                    }
                    Thread.Sleep(3000);
                }
            });

            InjectThread.Start();
        }
Esempio n. 6
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            Browser.Visibility             = Visibility.Hidden;
            DataContext                    = this;
            GeneralSettingsItem.IsSelected = true;

            #region ContextMenu.DevMenu

            DevMenu.Visibility      = Config.Instance.ShowDevOptions ? Visibility.Visible : Visibility.Collapsed;
            Config.PropertyChanged += (o, args) =>
            {
                if (args.PropertyName == "ShowDevOptions")
                {
                    DevMenu.Visibility = Config.Instance.ShowDevOptions ? Visibility.Visible : Visibility.Collapsed;
                }
            };

            #endregion

            if (!File.Exists(Directories.CoreFilePath))
            {
                MessageBox.Show(string.Format("Couldn't find {0}", Path.GetFileName(Directories.CoreFilePath)));
                Environment.Exit(0);
            }

            Updater.MainWindow = this;
            CheckForUpdates(true, true, false);

            Updater.GetRepositories(
                delegate(List <string> list)
            {
                if (list.Count > 0)
                {
                    Config.Instance.KnownRepositories.Clear();
                    foreach (var repo in list)
                    {
                        Config.Instance.KnownRepositories.Add(repo);
                    }
                }
            });

            //Try to login with the saved credentials.
            if (!Auth.Login(Config.Instance.Username, Config.Instance.Password).Item1)
            {
                ShowLoginDialog();
            }
            else
            {
                OnLogin(Config.Instance.Username);
            }

            Config.Instance.FirstRun = false;

            //Used to reload the assemblies from inside the game.
            KeyboardHook.SetHook();
            KeyboardHook.OnKeyUpTrigger += KeyboardHookOnOnKeyUpTrigger;
            KeyboardHook.HookedKeys.Add(
                KeyInterop.VirtualKeyFromKey(
                    Config.Instance.Hotkeys.SelectedHotkeys.First(h => h.Name == "Reload").Hotkey));
            KeyboardHook.HookedKeys.Add(
                KeyInterop.VirtualKeyFromKey(
                    Config.Instance.Hotkeys.SelectedHotkeys.First(h => h.Name == "CompileAndReload").Hotkey));

            foreach (var hk in Config.Instance.Hotkeys.SelectedHotkeys)
            {
                hk.PropertyChanged += hk_PropertyChanged;
            }

            Injection.OnInject += hwnd => Task.Factory.StartNew(
                () =>
            {
                Injection.SendConfig(hwnd);
                Thread.Sleep(1500);
                foreach (var assembly in
                         Config.Instance.SelectedProfile.InstalledAssemblies.Where(a => a.InjectChecked))
                {
                    Injection.LoadAssembly(hwnd, assembly);
                }
            });

            InjectThread = new Thread(
                () =>
            {
                while (true)
                {
                    if (Config.Instance.Install)
                    {
                        Injection.Pulse();
                    }
                    Thread.Sleep(3000);
                }
            });

            InjectThread.Start();
            Config.Instance.PropertyChanged += ConfigOnPropertyChanged;
            foreach (var gameSetting in Config.Instance.Settings.GameSettings)
            {
                gameSetting.PropertyChanged += GameSettingOnPropertyChanged;
            }
            NewsTabItem.Visibility       = Visibility.Hidden;
            AssembliesTabItem.Visibility = Visibility.Hidden;
            SettingsTabItem.Visibility   = Visibility.Hidden;
        }