Ejemplo n.º 1
0
 private void PrepareForLaunch()
 {
     // GuiCore.MainForm = this;
     Enabled = false;
     SettingsManager.LoadXmlSettings();
     LoginBlock.Enable();
 }
Ejemplo n.º 2
0
 private void PrepareForLaunch()
 {
     MainForm = this;
     Enabled  = false;
     OptionManager.LoadXmlSettings();
     LoginBlock.Enable();
 }
Ejemplo n.º 3
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);
                }
            }
        }
Ejemplo n.º 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
                {
                    $"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);
                }
            }
        }
Ejemplo n.º 5
0
 internal void EndLaunchPrepare()
 {
     CCManager.LoadCCs();
     Memory.Init();
     OptionManager.LoadSettings();
     Enums.DynamicFlags.AdjustToRealm();
     MainForm.Enabled           = true;
     ChatHook.OnNewChatMessage += updateChat;
     LoginBlock.Disable();
 }
        private async Task <Captcha> GetCaptcha(LoginBlock login)
        {
            var captcha = login.Captcha;

            if (captcha.Type == "image")
            {
                var captchaElement = landingResultDocument.QuerySelector(captcha.Selector);
                if (captchaElement != null)
                {
                    var loginUrl   = ResolvePath(login.Path);
                    var captchaUrl = ResolvePath(captchaElement.GetAttribute("src"), loginUrl);

                    var request = new HttpRequestBuilder(captchaUrl.ToString())
                                  .SetCookies(landingResult.GetCookies())
                                  .SetHeader("Referer", loginUrl.AbsoluteUri)
                                  .SetEncoding(_encoding)
                                  .Build();

                    var response = await HttpClient.ExecuteProxiedAsync(request, Definition);

                    return(new Captcha
                    {
                        ContentType = response.Headers.ContentType,
                        ImageData = response.ResponseData
                    });
                }
                else
                {
                    _logger.Debug("CardigannIndexer ({0}): No captcha image found", _definition.Id);
                }
            }
            else
            {
                throw new NotImplementedException(string.Format("Captcha type \"{0}\" is not implemented", captcha.Type));
            }

            return(null);
        }
Ejemplo n.º 7
0
        internal void EndLaunchPrepare()
        {
            Memory.Init();
            SettingsManager.LoadSettings();
            CCManager.LoadCCs();

            #region set wow & bot window location and size
            Helpers.WindowInteraction.SetWowWindow();
            Helpers.WindowInteraction.SetBotWindow();
            #endregion

            #region setup world render minimize if enabled in settings
            if (Settings.Settings.MinimizeWorldRender)
            {
                Hack renderWorld = HookWardenMemScan.GetHack("RenderWorlObjectsPatch");

                //setup render world patch if unknown to us
                if (renderWorld == null)
                {
                    var RenderWorldPatch = new Hack(ZzukBot.Constants.Offsets.Hacks.RenderDisable, new byte[] { 0x00 }, "RenderWorlObjectsPatch");
                    HookWardenMemScan.AddHack(RenderWorldPatch);

                    renderWorld = HookWardenMemScan.GetHack("RenderWorlObjectsPatch");
                }

                if (!renderWorld.IsActivated && Settings.Settings.MinimizeWorldRender)
                {
                    renderWorld.Apply();
                }
            }
            #endregion
            IrcMonitor.Instance.MessageReceived += ChannelMessageRecieved;
            GuiCore.SettingsForm.SetupIrc();
            Enums.DynamicFlags.AdjustToRealm();
            GuiCore.MainForm.Enabled   = true;
            ChatHook.OnNewChatMessage += updateChat;
            LoginBlock.Disable();
        }
Ejemplo n.º 8
0
 internal void EndLaunchPrepare()
 {
     CCManager.LoadCCs();
     Memory.Init();
     OptionManager.LoadSettings();
     try
     {
         using (var wc = new WebClient())
         {
             MainForm.rtbNews.Text = wc.DownloadString("http://zzukbot.com/Hk3VEXpjfj8K/Important.txt");
         }
     }
     catch
     {
         MainForm.rtbNews.Text = "Error while fetching news";
     }
     IrcMonitor.Instance.MessageReceived += ChannelMessageRecieved;
     SetupIrc();
     Enums.DynamicFlags.AdjustToRealm();
     MainForm.Enabled           = true;
     ChatHook.OnNewChatMessage += updateChat;
     LoginBlock.Disable();
 }