예제 #1
0
 private void resetToDefaultButton_Click(object sender, EventArgs e)
 {
     SettingsManager.ResetSettingsToDefault();
     SettingsManager.SaveSettings();
     AutoHotkeyManager.ShutdownAutohotkey();
     MainForm.mainForm.initializeSettings();
 }
예제 #2
0
        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);
        }
예제 #3
0
        private void autoHotkeyGridSettings_TextChanged(object sender, EventArgs e)
        {
            if (MainForm.prevent_settings_update)
            {
                return;
            }

            AutoHotkeyManager.UpdateSettings(autoHotkeyGridSettings.Text.Split('\n').ToList());
        }
예제 #4
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (SettingsManager.getSettingBool("ShutdownAutohotkeyOnExit"))
     {
         AutoHotkeyManager.ShutdownAutohotkey();
     }
     if (fileWriter != null)
     {
         fileWriter.Close();
     }
 }
예제 #5
0
 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();
 }
예제 #6
0
 private void closeSuspendedWindow_Click(object sender, EventArgs e)
 {
     AutoHotkeyManager.CloseSuspendedWindow();
 }
예제 #7
0
 private void suspendedTest_Click(object sender, EventArgs e)
 {
     AutoHotkeyManager.ShowSuspendedWindow(true);
 }
예제 #8
0
 private void shutdownAutoHotkey_Click(object sender, EventArgs e)
 {
     AutoHotkeyManager.ShutdownAutohotkey();
 }
예제 #9
0
 private void startAutoHotkey_Click(object sender, EventArgs e)
 {
     AutoHotkeyManager.StartAutohotkey();
 }
예제 #10
0
        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);
        }
예제 #11
0
        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);
        }