static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (GetDesktopScalingFactor() != 1) { ErrorDisplayer.Error("Your computer have an increased or decreased DPI scaling factor, that is not supported by this awake bot." + "In order to be able to use this bot, you have to have a 100% Scaling in the Windows Display Settings. " + "If you do not now how to change the scaling, use google."); return; } var requiredFiles = new string[] { "Settings.xml", }; var requiredFolders = new string[] { Globals.TesseractFolderName, Globals.ConfigFolderName, "tesseract\\tessdata", }; foreach (var file in requiredFiles) { if (!File.Exists(file)) { ErrorFileMissing(file); return; } } foreach (var folder in requiredFolders) { if (!Directory.Exists(folder)) { ErrorFileMissing(folder); return; } } if (Win32.LoadLibrary("win32u.dll") == IntPtr.Zero) { Win32.MissingWin32u = true; } else { Win32.MissingWin32u = false; } //AccuracyBenchmark.BeginBenchmark(); var hookHandle = KeyboardHook.RegisterHook(); Application.Run(new ProcessSelector()); Win32.UnhookWindowsHookEx(hookHandle); }
public SolutionEvents(TaskFileProcessor taskFileProcessor, ExceptionDialog exceptionDialog, ErrorDisplayer errorDisplayer, AllProjectFinder allProjectFinder) { this.taskFileProcessor = taskFileProcessor; this.exceptionDialog = exceptionDialog; this.errorDisplayer = errorDisplayer; this.allProjectFinder = allProjectFinder; }
private void AwakeBotUserInterfaceLoad(object sender, EventArgs e) { Text = Globals.BotWindowName; // Remove thse annoying double border from buttons when focus is occured ButtonItemPosition.GotFocus += (s, ev) => { ((Button)s).NotifyDefault(false); }; ButtonAwakeScrollPosition.GotFocus += (s, ev) => { ((Button)s).NotifyDefault(false); }; ButtonReversionScrollPosition.GotFocus += (s, ev) => { ((Button)s).NotifyDefault(false); }; ButtonSelectAwakeRect.GotFocus += (s, ev) => { ((Button)s).NotifyDefault(false); }; AddPositionButtonsMouseUpEvent(); UpdateTrackbarLabel(); if (!Directory.Exists(Globals.ConfigFolderName)) { Directory.CreateDirectory(Globals.ConfigFolderName); } string[] files = Directory.GetFiles(Globals.ConfigFolderName, "*.xml"); if (files.Length <= 0) { ErrorDisplayer.Error("I was unable to find any server configs. " + "Ensure that the configs are located in a folder called \"configs\"."); } foreach (var file in files) { string fileName = Path.GetFileNameWithoutExtension(file); ComboBoxConfigs.Items.Add(fileName); } }
protected override void InitializeLastChance() { var errorHandler = new ErrorDisplayer(ApplicationContext); PluginLoader.Instance.EnsureLoaded(); base.InitializeLastChance(); }
protected override void InitializeLastChance() { var errorHandler = new ErrorDisplayer(ApplicationContext); Cirrious.MvvmCross.Plugins.Visibility.PluginLoader.Instance.EnsureLoaded(); base.InitializeLastChance(); }
protected override void InitializeLastChance() { Cirrious.MvvmCross.Plugins.Visibility.PluginLoader.Instance.EnsureLoaded(); // create a new error displayer - it will hook itself into the framework var errorDisplayer = new ErrorDisplayer(); base.InitializeLastChance(); }
public SolutionEvents(TaskFileProcessor taskFileProcessor, AttributeFileProcessor attributeFileProcessor, ExceptionDialog exceptionDialog, ErrorDisplayer errorDisplayer, AllProjectFinder allProjectFinder, MSBuildKiller msBuildKiller) { this.taskFileProcessor = taskFileProcessor; this.attributeFileProcessor = attributeFileProcessor; this.exceptionDialog = exceptionDialog; this.errorDisplayer = errorDisplayer; this.allProjectFinder = allProjectFinder; this.msBuildKiller = msBuildKiller; }
private void ButtonStartBotOnClick(object sender, EventArgs e) { try { if (!AwakeningRoutine.IsRunning()) { var result = MessageBox.Show(this, "Does the item you want to awake already have an awakening?\n\n" + "If not, you must awaken it once first. If you do not, the bot will fail to continue.\n\n" + "Press \"OK\" if it has an awakening.\nPress \"Cancel\" if it does not have an awakening. Manually awake it yourself once.", "Awake the item first!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.Cancel) { return; } if (_botConfig.ItemPosition == Point.Empty || _botConfig.AwakeScrollPosition == Point.Empty || _botConfig.ReversionPosition == Point.Empty) { ErrorDisplayer.Error("Set all of the item and scroll positions before starting the bot!"); return; } else if (ComboBoxConfigs.SelectedIndex == -1) { ErrorDisplayer.Error("Select a server config before starting the bot!"); return; } else if (ListviewAwakes.Items.Count <= 0) { ErrorDisplayer.Error("You need atleast one awake added!"); return; } AwakeningRoutine = new AwakeningRoutine(this, _botConfig, _serverConfig); // check if required tessdata language is there if (!LanguageTraineddataExists()) { ErrorDisplayer.Error($"You are missing the tesseract \"{_serverConfig.Language}.traineddata\" " + $"file required for that language"); return; } AwakeningRoutine.StartBot(_preferredAwakeItems); } else { AwakeningRoutine.StopBot(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private bool TrySetAwakePosition(Control control) { if (control.RectangleToScreen(control.DisplayRectangle).Contains(Cursor.Position)) { ErrorDisplayer.Error("Click and drag the cursor to the item that will be awaked."); return(false); } control.BackColor = Color.FromArgb(11, 166, 65); return(true); }
private void ButtonAddAwakeOnClick(object sender, EventArgs e) { int selectedComboIndex = ComboBoxAwakeType.SelectedIndex; if (selectedComboIndex == -1) { ErrorDisplayer.Error("You cannot add an awake without telling me which awaketype silly!"); return; } int newAwakeValue = (int)NumericAwakeValue.Value; var newAwakeName = _serverConfig.AwakeTypes[selectedComboIndex].Name; int newAwakeGroup = (int)NumericAwakeGroup.Value; ListviewAwakes.Items.Add(new ListViewItem(new string[] { newAwakeName, newAwakeValue.ToString(), newAwakeGroup.ToString(), })); GroupBoxNewAwake.Visible = false; ResetAddAwakeControls(); var newAwake = new Awake() { Name = newAwakeName, Value = newAwakeValue, TypeIndex = Convert.ToInt16(selectedComboIndex), }; foreach (var preferredAwake in _preferredAwakeItems) { // Are they in the same group? if (newAwakeGroup == preferredAwake.Group) { if (preferredAwake.Awake.TypeIndex == newAwake.TypeIndex) { ErrorDisplayer.Info("This type of awake is already added to the list.\n\n" + "When you add two different, they will interally be converted into one, the same goes for the awake on the item.\n\n" + "Example: If you add one STR+50 awake into the list, the bot will stop when it gets e.g. STR+23 and STR+30 because it will turn into STR+53 internally."); } } } _preferredAwakeItems.Add(new AwakeItem { Awake = newAwake, Group = newAwakeGroup, }); }
private void ButtonDeleteAwakeOnClick(object sender, EventArgs e) { if (ListviewAwakes.SelectedIndices.Count > 0) { int selectedIndex = ListviewAwakes.SelectedIndices[0]; ListviewAwakes.Items.RemoveAt(selectedIndex); _preferredAwakeItems.RemoveAt(selectedIndex); } else { ErrorDisplayer.Error("You have to select an awake to delete in the list silly!"); } }
public TaskFileReplacer(ErrorDisplayer errorDisplayer, NotifyPropertyWeaverFileExporter fileExporter) { this.errorDisplayer = errorDisplayer; this.fileExporter = fileExporter; Directory.CreateDirectory(Environment.ExpandEnvironmentVariables(@"%appdata%\NotifyPropertyWeaver")); taskFilePath = Environment.ExpandEnvironmentVariables(@"%appdata%\NotifyPropertyWeaver\TaskAssembliesToUpdate.txt"); if (!File.Exists(taskFilePath)) { using (File.Create(taskFilePath)) { } } }
public TaskFileReplacer(ErrorDisplayer errorDisplayer, CosturaFileExporter fileExporter) { this.errorDisplayer = errorDisplayer; this.fileExporter = fileExporter; Directory.CreateDirectory(Environment.ExpandEnvironmentVariables(@"%appdata%\Costura")); taskFilePath = Environment.ExpandEnvironmentVariables(@"%appdata%\Costura\TaskAssembliesToUpdate.txt"); if (!File.Exists(taskFilePath)) { using (File.Create(taskFilePath)) { } } }
/// <summary> /// Crops the bitmap into the specified rectangle /// </summary> /// <param name="bitmap"></param> /// <param name="cropRectangle"></param> /// <returns></returns> public Bitmap CropBitmap(Bitmap bitmap, Rectangle cropRectangle) { try { return(bitmap.Clone(cropRectangle, bitmap.PixelFormat)); } catch (OutOfMemoryException) { ErrorDisplayer.Error("A bitmap has made an attempt to clone an invalid bitmap " + "rectangle or not enough memory was available." + Environment.NewLine + cropRectangle.ToString() + Environment.NewLine); } return(null); }
void RefreshNeuzProcesses() { var processName = XmlUtils.GetXmlSetting("ProcessName"); var processes = Process.GetProcessesByName(processName); if (processes.Length == 0) { ErrorDisplayer.Info("I did not find any flyff processes, are you sure you have one opened? " + "If you do, maybe it has a different name compared to the one in the settings file."); return; } PopulateListviewProcesses(processes); Processes.AddRange(processes); }
private async void ExecuteRegisterUserCommand(string password) { try { var response = await this._dataService.RegisterUser(this.RegisterUsername, password, this.Email); if (response.IsSuccessStatusCode) { var userStr = await response.Content.ReadAsStringAsync(); var user = JsonConvert.DeserializeObject <LoginResponseModel>(userStr); this.credetentialsManager.SetCredetentials(user.Username, password); this._navigationService.Navigate("ItemsPage", user); } } catch (ArgumentException ae) { ErrorDisplayer.ShowError(ae.Message); } }
private void ComboBoxConfigsOnSelectedIndexChanged(object sender, EventArgs e) { if (ComboBoxConfigs.SelectedIndex < 0) { return; } string selectedConfig = ComboBoxConfigs.Text; try { _serverConfig = ServerConfigManager.ReadConfig(selectedConfig); } catch (Exception ex) { ErrorDisplayer.Error($"Failed while parsing the config {selectedConfig} with exception message: {ex.ToString()}"); ComboBoxConfigs.SelectedIndex = -1; _serverConfig = null; return; } RefreshConfigAwakeTypes(_serverConfig.AwakeTypes); }
private void InitialiseErrorDisplay() { var errorDisplayer = new ErrorDisplayer(ApplicationContext); }
public DisableMenuConfigure(CurrentProjectFinder currentProjectFinder, ErrorDisplayer errorDisplayer, ExceptionDialog exceptionDialog) { this.exceptionDialog = exceptionDialog; this.errorDisplayer = errorDisplayer; this.currentProjectFinder = currentProjectFinder; }
private void OptimizationToolStripMenuItem_Click(object sender, EventArgs e) { ErrorDisplayer.Info("When using the awakebot, be in an area that isn't laggy.\n\n" + "When setting the \"Item Awake Read Rect\", make sure to make the rectangle big enough to fit a larger awake and multiple awakes.\n\n" + "Important that you don't make the rectangle too big to ensure that no other text/pixels with that same color gets in the picture."); }
private void CreatorToolStripMenuItem_Click(object sender, EventArgs e) { ErrorDisplayer.Info("Created by greyb1t"); }
static void ErrorFileMissing(string fileName) { ErrorDisplayer.Error("Unable to start because " + fileName + " is not found."); }