public void Bot_Step_Diagnostic_Local_Chat_Window_Not_Found() { var stepResult = new Bot.Bot().Step(new Bot.BotStepInput { }); AssertStringContainedInString(SaveShipTask.LocalChatWindowNotFoundDiagnosticText, stepResult?.RenderBotStepToUIText()); }
public void Bot_Step_Retreat() { var listSurroundingsButton = new Mock <IUIElement>().Object; var infoPanelCurrentSystemMock = new Mock <IInfoPanelSystem>(); infoPanelCurrentSystemMock .Setup(infoPanel => infoPanel.ListSurroundingsButton).Returns(listSurroundingsButton); var memoryMeasurementMock = new Mock <IMemoryMeasurement>(); memoryMeasurementMock .Setup(memoryMeasurement => memoryMeasurement.InfoPanelCurrentSystem) .Returns(infoPanelCurrentSystemMock.Object); var stepResult = new Bot.Bot().Step(new BotStepInput { FromProcessMemoryMeasurement = new FromProcessMeasurement <IMemoryMeasurement>(memoryMeasurementMock.Object, 0, 0) }); Assert.That( stepResult?.OutputListTaskPath?.Any(taskPath => taskPath?.OfType <RetreatTask>()?.Any() ?? false) ?? false); Assert.That(stepResult?.ListMotion?.FirstOrDefault()?.MotionParam?.MouseListWaypoint?.FirstOrDefault() ?.UIElement == listSurroundingsButton); }
public BasicSettingsData(System.Windows.Controls.TextBox processTextfield) { var helper = new WindowInteropHelper(Application.Current.MainWindow); helper.EnsureHandle(); //get a handle witthout the need to show the window hotkeyListener = new Hotkey.HotkeyListener(helper.Handle); hotkeyListener?.RegisterHotKey(HotkeyMod1._Value | HotkeyMod2._Value, HotkeyKey._Value); this.bot = new Bot.Bot(new Input.Keyboard.User32_SendInput_VirtualKeycode()); hotkeyListener.OnHotKeyPressed += () => { if (this.IsBotRunning) { bot.Stop(); } else { bot.Start("\r" + this.HotkeyAction + "\r"); } this.IsBotRunning = !this.IsBotRunning; }; Application.Current.Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; procChecker = new Timer(checkProcess, null, -1, -1); // init timer, but don`t start processTextfield.IsVisibleChanged += DependentUIElement_IsVisibleChanged; processTextfield.KeyUp += (a, b) => { procChecker.Change(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(1)); }; }
public Manager(Bot.Bot bot) { _bot = bot; _greatWeaponMasterOption = new InlineKeyboardButton(GreatWeaponMasterText) { CallbackData = GreatWeaponMasterText }; _rageOption = new InlineKeyboardButton(RageText) { CallbackData = RageText }; _flameOption = new InlineKeyboardButton(FlameText) { CallbackData = FlameText }; _critOption = new InlineKeyboardButton(CritText) { CallbackData = CritText }; var firstRaw = new[] { _rageOption, _greatWeaponMasterOption }; var secondRaw = new[] { _flameOption, _critOption }; _options = new InlineKeyboardMarkup(new[] { firstRaw, secondRaw }); }
public GraphHelper(ILogger <GraphHelper> logger, IHttpContextAccessor httpContextAccessor, IConfiguration configuration, IHttpClientFactory httpClientFactory, Bot.Bot bot) { _httpContextAccessor = httpContextAccessor; _logger = logger; _configuration = configuration; _httpClientFactory = httpClientFactory; _bot = bot; }
public Manager(Bot.Bot bot) { _bot = bot; IEnumerable <KeyboardButton> buttons = Enumerable.Range(0, ButtonsTotal).Select(CreateButton); IEnumerable <IEnumerable <KeyboardButton> > keyboard = buttons.Batch(ButtonsPerRaw); _amountKeyboard = new ReplyKeyboardMarkup(keyboard); }
protected override void Context() { this.credentials = new Credentials("ident", "name"); this.bot = MockRepository.GenerateStub <Bot.Bot>(); bot.Stub(x => x.GetCredentials()).Return(credentials); this.parser = MockRepository.GenerateMock <PrivateMessageParser>(); }
public void Present( SimpleInterfaceServerDispatcher interfaceServerDispatcher, FromProcessMeasurement <IMemoryMeasurement> measurement, Bot.Bot bot) { Interface?.Present(interfaceServerDispatcher, measurement); InterfaceHeader?.SetStatus(Interface.InterfaceStatusEnum()); BotStepResultTextBox.Text = bot?.StepLastResult?.RenderBotStepToUIText(); }
public BotSingleton(IOptions <Config> options) { Config config = options.Value; if ((config.GoogleCredential == null) || (config.GoogleCredential.Count == 0)) { config.GoogleCredential = JsonConvert.DeserializeObject <Dictionary <string, string> >(config.GoogleCredentialJson); } Bot = new Bot.Bot(config); }
void BotExchange() { if (null == Bot) { Bot = BotConstruct(); } var BotPreference = BotControl?.PreferenceReadFromUI(); Bot.Exchange( SensorClient?.MemoryMeasurementLast, BotPreference, RecommendedMotionExecutedWithResult ?.Where(MotionExecutedWithResult => MotionExecutedWithResult.Value?.Success ?? false) ?.Select(MotionExecutedWithResult => MotionExecutedWithResult.Key.IdAtBot)); }
public BotSingleton(IOptions <Config> options) { Config config = options.Value; if ((config.GoogleCredential == null) || (config.GoogleCredential.Count == 0)) { config.GoogleCredential = JsonConvert.DeserializeObject <Dictionary <string, string> >(config.GoogleCredentialJson); } if (string.IsNullOrWhiteSpace(config.GoogleCredentialJson)) { config.GoogleCredentialJson = JsonConvert.SerializeObject(config.GoogleCredential); } if ((config.AdminIds == null) || (config.AdminIds.Count == 0)) { config.AdminIds = JsonConvert.DeserializeObject <List <long> >(config.AdminIdsJson); } Bot = new Bot.Bot(config); }
public void Bot_Step_InfoPanel_CurrentSystem_Enable_Click() { var infoPanelCurrentSystemEnableButtonMock = new Mock <IUIElement>(); infoPanelCurrentSystemEnableButtonMock .Setup(button => button.Id).Returns(4); var memoryMeasurementMock = new Mock <IMemoryMeasurement>(); memoryMeasurementMock .Setup(memoryMeasurement => memoryMeasurement.InfoPanelButtonCurrentSystem).Returns(infoPanelCurrentSystemEnableButtonMock.Object); var stepResult = new Bot.Bot().Step(new Bot.BotStepInput { FromProcessMemoryMeasurement = new FromProcessMeasurement <IMemoryMeasurement>(memoryMeasurementMock.Object, 0, 0) }); Assert.That(stepResult?.ListMotion?.FirstOrDefault()?.MotionParam?.MouseListWaypoint?.FirstOrDefault()?.UIElement == infoPanelCurrentSystemEnableButtonMock.Object); }
public void Update(Bot.Bot bot) { var coinage = bot.AntiIdle.Stats.Coinage; if (coinage > 0) { LastGain = coinage - LastCoinage; LastCoinage = coinage; if (coinage < StartCoinage) { DebugHelper.Write(bot, "Reset! (Current coinage is below start coinage)", "GoldPerHour"); StartCoinage = 0; TotalGain = 0; } if (StartCoinage <= 0) { DebugHelper.Write(bot, "New start coinage: {0:N0}", "GoldPerHour", coinage); StartCoinage = coinage; StartTime = DateTime.UtcNow; } else { if (LastGain > 0) { LastGainTime = DateTime.UtcNow; } else if (DateTime.UtcNow.Subtract(LastGainTime).TotalMinutes > 15) { DebugHelper.Write(bot, "Reset! No gold collected for 15 mins", "GoldPerHour"); Reset(); } TotalGain += LastGain; Debug.WriteLine("<{0}> LastGain: {1:N0}, TotalGain: {2:N0}, GPH: {3:N0}", bot.Name, LastGain, TotalGain, GoldPerHour); } } }
protected SupportedAction(Bot.Bot bot, Message message) { Bot = bot; Message = message; }
public Manager(Bot.Bot bot) { _bot = bot; _morning = false; }
public Manager(Bot.Bot bot, SaveManager <List <Record> > saveManager) { _saveManager = saveManager; _bot = bot; }
public NumberAction(Bot.Bot bot, Message message, int number) : base(bot, message) => _number = number;
public Manager(Bot.Bot bot) { _bot = bot; _articles = new SortedSet <Article>(); }
public FindQueryAction(Bot.Bot bot, Message message, FindQuery query) : base(bot, message) => _query = query;
public RememberMarkAction(Bot.Bot bot, Message message, MarkQuery query) : base(bot, message) { _query = query; }
internal Manager(Bot.Bot bot) { _bot = bot; _locker = new object(); }
public MarkAction(Bot.Bot bot, Message message, Message recordMessage, MarkQuery query) : base(bot, message) { _recordMessage = recordMessage; _query = query; }
public ForwardAction(Bot.Bot bot, Message message) : base(bot, message) { }
public static ProcessStartInfo ImpersonateStartInfo(ProcessStartInfo startinfo, Bot.Bot bot) { if (bot.UseWindowsUser) { if (!ExistsAsAdmin(bot.WindowsUserName)) { if (bot.CreateWindowsUser) { Create(bot.WindowsUserName, bot.WindowsUserPassword, isAdmin: true); } else { Logger.Instance.Write( "User Account \"{0}\" does not exist and we are not allowed to create it", bot.WindowsUserName); bot.Stop(); return(startinfo); } } startinfo.UserName = bot.WindowsUserName; var encPassword = new SecureString(); foreach (var c in bot.WindowsUserPassword) { encPassword.AppendChar(c); } startinfo.Password = encPassword; startinfo.UseShellExecute = false; } return(startinfo); }
public CommandAction(Bot.Bot bot, Message message, CommandBase <Bot.Bot, Bot.Config> command) : base(bot, message) { _command = command; }
public ArticleAction(Bot.Bot bot, Message message, Article article) : base(bot, message) => _article = article;