private void resetToDefaultButton_Click(object sender, EventArgs e) { SettingsManager.ResetSettingsToDefault(); SettingsManager.SaveSettings(); AutoHotkeyManager.ShutdownAutohotkey(); MainForm.mainForm.initializeSettings(); }
protected override void WndProc(ref Message m) { if (m.Msg == 0xC) { // This messages is send by AutoHotkey to execute a command string command = Marshal.PtrToStringUni(m.LParam); if (command != null) { if (CommandManager.ExecuteCommand(command)) { return; //if the passed along string is a command, we have executed it successfully } } } if (m.Msg == 0x317) { // We intercept this message because this message signifies the AutoHotkey state (suspended or not) int wParam = m.WParam.ToInt32(); if (wParam == 32) { // 32 signifies we have entered suspended mode, so we warn the user with a popup AutoHotkeyManager.ShowSuspendedWindow(); } else if (wParam == 33) { // 33 signifies we are not suspended, destroy the suspended window (if it exists) AutoHotkeyManager.CloseSuspendedWindow(); } } base.WndProc(ref m); }
private void autoHotkeyGridSettings_TextChanged(object sender, EventArgs e) { if (MainForm.prevent_settings_update) { return; } AutoHotkeyManager.UpdateSettings(autoHotkeyGridSettings.Text.Split('\n').ToList()); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (SettingsManager.getSettingBool("ShutdownAutohotkeyOnExit")) { AutoHotkeyManager.ShutdownAutohotkey(); } if (fileWriter != null) { fileWriter.Close(); } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (SettingsManager.getSettingBool("ShutdownAutohotkeyOnExit")) { AutoHotkeyManager.ShutdownAutohotkey(); } // create backup of settings on successful shutdown if (SettingsManager.getSettingBool("AutomaticSettingsBackup")) { SettingsManager.CreateBackup(); } if (fileWriter != null) { fileWriter.Close(); } ProcessManager.Stop(); }
private void closeSuspendedWindow_Click(object sender, EventArgs e) { AutoHotkeyManager.CloseSuspendedWindow(); }
private void suspendedTest_Click(object sender, EventArgs e) { AutoHotkeyManager.ShowSuspendedWindow(true); }
private void shutdownAutoHotkey_Click(object sender, EventArgs e) { AutoHotkeyManager.ShutdownAutohotkey(); }
private void startAutoHotkey_Click(object sender, EventArgs e) { AutoHotkeyManager.StartAutohotkey(); }
public MainForm() { startup = true; Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; mainForm = this; InitializeComponent(); SettingsManager.LoadSettings(Constants.SettingsFile); LootDatabaseManager.LootChanged += NotificationManager.UpdateLootDisplay; LootDatabaseManager.LootChanged += UpdateLogDisplay; GlobalDataManager.ExperienceChanged += NotificationManager.UpdateExperienceDisplay; GlobalDataManager.DamageChanged += NotificationManager.UpdateDamageDisplay; GlobalDataManager.UsedItemsChanged += NotificationManager.UpdateUsedItemsDisplay; if (!File.Exists(Constants.DatabaseFile)) { ExitWithError("Fatal Error", String.Format("Could not find database file {0}.", Constants.DatabaseFile)); } if (!File.Exists(Constants.NodeDatabase)) { ExitWithError("Fatal Error", String.Format("Could not find database file {0}.", Constants.NodeDatabase)); } LootDatabaseManager.Initialize(); StyleManager.InitializeStyle(); NotificationForm.Initialize(); Parser.Initialize(); PopupManager.Initialize(this.notifyIcon1); prevent_settings_update = true; try { StorageManager.InitializeStorage(); } catch (Exception e) { ExitWithError("Fatal Error", String.Format("Corrupted database {0}.\nMessage: {1}", Constants.DatabaseFile, e.Message)); } ProcessManager.Initialize(); this.initializeSettings(); try { Pathfinder.LoadFromDatabase(Constants.NodeDatabase); } catch (Exception e) { ExitWithError("Fatal Error", String.Format("Corrupted database {0}.\nMessage: {1}", Constants.NodeDatabase, e.Message)); } prevent_settings_update = false; this.InitializeTabs(); switchTab(0); makeDraggable(this.Controls); if (SettingsManager.getSettingBool("StartAutohotkeyAutomatically")) { AutoHotkeyManager.StartAutohotkey(); } ReadMemoryManager.Initialize(); HuntManager.Initialize(); UIManager.Initialize(); MemoryReader.Initialize(); HUDManager.Initialize(); GlobalDataManager.Initialize(); this.Load += MainForm_Load; fileWriter = new StreamWriter(Constants.BigLootFile, true); tibialyzerLogo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.draggable_MouseDown); startup = false; ScanningManager.StartScanning(); scan_tooltip.AutoPopDelay = 60000; scan_tooltip.InitialDelay = 500; scan_tooltip.ReshowDelay = 0; scan_tooltip.ShowAlways = true; scan_tooltip.UseFading = true; SetScanningImage("scanningbar-red.gif", "No Tibia Client Found...", true); }
public MainForm() { startup = true; Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; mainForm = this; InitializeComponent(); Constants.InitializeConstants(); SettingsManager.Initialize(); if (File.Exists(Constants.SettingsTemporaryBackup)) { // a temporary backup file exists, this might indicate a problem occurred while writing a settings file (e.g. unexpected shutdown) try { SettingsManager.LoadSettings(Constants.SettingsTemporaryBackup); if (SettingsManager.settings.Count == 0) { throw new Exception("Failed to read backup settings."); } if (File.Exists(Constants.SettingsFile)) { File.Delete(Constants.SettingsFile); } File.Copy(Constants.SettingsTemporaryBackup, Constants.SettingsFile); File.Delete(Constants.SettingsTemporaryBackup); } catch (Exception ex) { DisplayWarning(String.Format("Backup settings file found, but could not read: {0}", ex.Message)); } } SettingsManager.LoadSettings(Constants.SettingsFile); LootDatabaseManager.LootChanged += NotificationManager.UpdateLootDisplay; LootDatabaseManager.LootChanged += UpdateLogDisplay; GlobalDataManager.ExperienceChanged += NotificationManager.UpdateExperienceDisplay; GlobalDataManager.DamageChanged += NotificationManager.UpdateDamageDisplay; GlobalDataManager.UsedItemsChanged += NotificationManager.UpdateUsedItemsDisplay; if (!File.Exists(Constants.DatabaseFile)) { ExitWithError("Fatal Error", String.Format("Could not find database file {0}.", Constants.DatabaseFile)); } if (!File.Exists(Constants.NodeDatabase)) { ExitWithError("Fatal Error", String.Format("Could not find database file {0}.", Constants.NodeDatabase)); } LootDatabaseManager.Initialize(); StyleManager.InitializeStyle(); NotificationForm.Initialize(); Parser.Initialize(); PopupManager.Initialize(this.notifyIcon1); prevent_settings_update = true; try { StorageManager.InitializeStorage(); } catch (Exception e) { ExitWithError("Fatal Error", String.Format("Corrupted database {0}.\nMessage: {1}", Constants.DatabaseFile, e.Message)); } try { OutfiterManager.Initialize(); } catch (Exception e) { ExitWithError("Fatal Error", String.Format("Corrupted outfiter database {0}.\nMessage: {1}", Constants.OutfiterDatabaseFile, e.Message)); } ProcessManager.Initialize(); this.initializeSettings(); try { Pathfinder.LoadFromDatabase(Constants.NodeDatabase); } catch (Exception e) { ExitWithError("Fatal Error", String.Format("Corrupted database {0}.\nMessage: {1}", Constants.NodeDatabase, e.Message)); } TaskManager.Initialize(); prevent_settings_update = false; ChangeLanguage(SettingsManager.getSettingString("TibialyzerLanguage")); this.InitializeTabs(); switchTab(0); makeDraggable(this.Controls); if (SettingsManager.getSettingBool("StartAutohotkeyAutomatically")) { AutoHotkeyManager.StartAutohotkey(); } ReadMemoryManager.Initialize(); HuntManager.Initialize(); UIManager.Initialize(); MemoryReader.Initialize(); HUDManager.Initialize(); GlobalDataManager.Initialize(); if (SettingsManager.getSettingBool("AutomaticallyDownloadAddresses")) { MainTab.DownloadNewAddresses(); } this.Load += MainForm_Load; fileWriter = new StreamWriter(Constants.BigLootFile, true); tibialyzerLogo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.draggable_MouseDown); startup = false; ScanningManager.StartScanning(); scan_tooltip.AutoPopDelay = 60000; scan_tooltip.InitialDelay = 500; scan_tooltip.ReshowDelay = 0; scan_tooltip.ShowAlways = true; scan_tooltip.UseFading = true; SetScanningImage("scanningbar-red.gif", "No Tibia Client Found...", true); }