示例#1
0
        /// <summary>
        /// The main entry point for the application
        /// </summary>
        public async Task LaunchBot()
        {
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            if (!Injected)
            {
                await CheckAndInject();

                Environment.Exit(0);
            }
            else
            {
                "Injected!!".Log(Logs.Injected);

                AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
                {
                    MessageBox.Show("A exception occured! The details were logged");
                    args.ExceptionObject.ToString().Log(Logs.Exceptions, false);
                };
                AppDomain.CurrentDomain.AssemblyResolve += DependencyLoader.CurrentDomain_AssemblyResolve;
#if DEBUG
                Debugger.Launch();
                WinImports.AllocConsole();
                DebugAssist.Init();
#endif
                await SetRealmlist();

                try
                {
                    $"Enabling the login block until the user authenticates".Log(Logs.Injected, true);
                    LoginBlock.Enable();

                    Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
                    //$"Bringing up the login window".Log(Logs.Injected, true);
                    //var authenticationView = new AuthenticationView();
                    //authenticationView.ShowDialog();
                    //var authenticationModel = (AuthenticationViewModel)authenticationView.DataContext;
                    //if (authenticationModel.Result == null || authenticationModel.Result.Value != DialogResult.OK)
                    //Environment.Exit(0);

                    $"Initialising the bot".Log(Logs.Injected, true);
                    Memory.Init();

                    $"Disabling the login block".Log(Logs.Injected, true);
                    LoginBlock.Disable();

                    $"Showing the bots mainwindow".Log(Logs.Injected, true);
                    var mainView = new MainView();
                    Current.MainWindow = mainView;
                    mainView.Closed   += (sender, args) => { Environment.Exit(0); };
                    mainView.Show();
                }
                catch (Exception e)
                {
                    e.ToString().Log(Logs.Exceptions);
                }
            }
        }
示例#2
0
        /// <summary>
        ///     The main entry point for the application.
        /// </summary>
        private static void LaunchBot()
        {
            SetPaths();
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            if (!AreWeInjected)
            {
                LogFiles.PreInjectLog.ClearLog();
                LogFiles.QuitLog.ClearLog();
                LogFiles.InjectedLog.ClearLog();
                "We are not injected yet".Log(LogFiles.PreInjectLog);
                PrepareAndInject();
                Environment.Exit(0);
            }
            else
            {
                AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
                {
                    MessageBox.Show("A exception occured! The details were logged");
                    args.ExceptionObject.ToString().Log(LogFiles.Exceptions, false);
                };
                AppDomain.CurrentDomain.AssemblyResolve += DependencyLoader.CurrentDomain_AssemblyResolve;
#if DEBUG
                Debugger.Launch();
                WinImports.AllocConsole();
                DebugAssist.Init();
#endif
                SetRealmlist();
                try
                {
                    $"Enabling the login block until the user authenticates".Log(LogFiles.InjectedLog, true);
                    LoginBlock.Enable();
                    Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
                    $"Bringing up the login window".Log(LogFiles.InjectedLog, true);
                    var loginWindow = new LoginWindow();
                    loginWindow.ShowDialog();
                    var loginModel = (LoginViewModel)loginWindow.DataContext;
                    if (loginModel.Result == null || loginModel.Result.Value != DialogResult.OK)
                    {
                        Environment.Exit(0);
                    }
                    $"Initialising the bot".Log(LogFiles.InjectedLog, true);
                    Memory.Init();
                    $"Disabling the login block".Log(LogFiles.InjectedLog, true);
                    LoginBlock.Disable();
                    $"Showing the bots mainwindow".Log(LogFiles.InjectedLog, true);
                    var mainWindow = new MainWindow();
                    Current.MainWindow = mainWindow;
                    mainWindow.Closed += (sender, args) => { Environment.Exit(0); };
                    mainWindow.Show();
                }
                catch (Exception e)
                {
                    e.ToString().Log(LogFiles.Exceptions);
                }
            }
        }
示例#3
0
        private static void LaunchBot()
        {
            // Setting culture for float etc (. instead of ,)
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (!AreWeInjected)
            {
                //var attForm = new AttachForm();
                //attForm.ShowDialog();
                //switch (attForm.Result)
                //{
                //    case AttachFormResult.Fresh:
                PrepareAndInject();
                //        break;

                //    case AttachFormResult.Attach:
                //        PrepareAndInject(attForm.AttachTo.PID);
                //        break;
                //}
            }
            else
            {
                if (debugMode)
                {
                    Debugger.Launch();
                    WinImports.AllocConsole();
                    Logger.Append("DEBUG BUILD");
                    DebugAssist.Init();
                }

                SetPaths();
                SetRealmlist();
                try
                {
                    GuiCore.MainForm     = new Forms.GraphicalMainForm();
                    GuiCore.SettingsForm = new Forms.GraphicalSettingsForm();

                    Application.Run(GuiCore.MainForm);
                }
                catch (Exception e)
                {
                    Logger.Append("Startup: " + e.Message + "\r\n", Logger.LogType.Console, "Exceptions.txt");
                }
            }
            Environment.Exit(0);
        }
示例#4
0
        /// <summary>
        ///     The main entry point for the application.
        /// </summary>
        private static void LaunchBot()
        {
            SetPaths();
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            if (!AreWeInjected)
            {
                LogFiles.PreInjectLog.ClearLog();
                LogFiles.QuitLog.ClearLog();
                LogFiles.InjectedLog.ClearLog();
                "We are not injected yet".Log(LogFiles.PreInjectLog);
                PrepareAndInject();
                Environment.Exit(0);
            }
            else
            {
                AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
                {
                    MessageBox.Show("A exception occured! The details were logged");
                    args.ExceptionObject.ToString().Log(LogFiles.Exceptions, false);
                };
                AppDomain.CurrentDomain.AssemblyResolve += DependencyLoader.CurrentDomain_AssemblyResolve;
#if DEBUG
                Debugger.Launch();
                WinImports.AllocConsole();
                DebugAssist.Init();
#endif
                SetRealmlist();
                try
                {
                    $"Initialising the bot".Log(LogFiles.InjectedLog, true);
                    Memory.Init();
                    $"Showing the bots mainwindow".Log(LogFiles.InjectedLog, true);
                    var mainWindow = new MainWindow();
                    Current.MainWindow = mainWindow;
                    mainWindow.Closed += (sender, args) => { Environment.Exit(0); };
                    mainWindow.Show();
                }
                catch (Exception e)
                {
                    e.ToString().Log(LogFiles.Exceptions);
                }
            }
        }
示例#5
0
        private static void LaunchBot()
        {
            // Setting culture for float etc (. instead of ,)
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (!AreWeInjected)
            {
                //var attForm = new AttachForm();
                //attForm.ShowDialog();
                //switch (attForm.Result)
                //{
                //    case AttachFormResult.Fresh:
                PrepareAndInject();
                //        break;

                //    case AttachFormResult.Attach:
                //        PrepareAndInject(attForm.AttachTo.PID);
                //        break;
                //}
            }
            else
            {
#if DEBUG
                WinImports.AllocConsole();
                Logger.Append("DEBUG BUILD");
                DebugAssist.Init();
#endif
                SetPaths();
                SetRealmlist();
                try
                {
                    Application.Run(new Main());
                }
                catch (Exception e)
                {
                    Logger.Append(e.Message, "Exceptions.txt");
                }
            }
            Environment.Exit(0);
        }
示例#6
0
 void Awake()
 {
     Instance          = this;
     waveController    = GetComponent <WaveController>();
     statsText.enabled = isDebugMode;
 }