Esempio n. 1
0
        public MainForm()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            mainForm = this;
            InitializeComponent();
            makeDraggable(this.Controls);
            this.InitializeTabs();
            switchTab(0);

            LootChanged += UpdateLootDisplay;

            if (!File.Exists(databaseFile)) {
                ExitWithError("Fatal Error", String.Format("Could not find database file {0}.", databaseFile));
            }

            if (!File.Exists(nodeDatabase)) {
                ExitWithError("Fatal Error", String.Format("Could not find database file {0}.", nodeDatabase));
            }

            conn = new SQLiteConnection(String.Format("Data Source={0};Version=3;", databaseFile));
            conn.Open();

            LootDatabaseManager.Initialize();

            StyleManager.InitializeStyle();

            NotificationForm.Initialize();

            prevent_settings_update = true;
            this.initializePluralMap();
            try {
                this.loadDatabaseData();
            } catch (Exception e) {
                ExitWithError("Fatal Error", String.Format("Corrupted database {0}.\nMessage: {1}", databaseFile, e.Message));
            }
            SettingsManager.LoadSettings(settingsFile);
            MainForm.initializeFonts();
            this.initializeHunts();
            this.initializeSettings();
            this.initializeMaps();
            this.initializeTooltips();
            try {
                Pathfinder.LoadFromDatabase(nodeDatabase);
            } catch (Exception e) {
                ExitWithError("Fatal Error", String.Format("Corrupted database {0}.\nMessage: {1}", nodeDatabase, e.Message));
            }
            prevent_settings_update = false;

            if (SettingsManager.getSettingBool("StartAutohotkeyAutomatically")) {
                startAutoHotkey_Click(null, null);
            }

            fileWriter = new StreamWriter(bigLootFile, true);

            ignoreStamp = createStamp();

            browseTypeBox.SelectedIndex = 0;

            this.Load += MainForm_Load;

            tibialyzerLogo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.draggable_MouseDown);

            BackgroundWorker bw = new BackgroundWorker();
            bw.DoWork += bw_DoWork;
            bw.RunWorkerAsync();

            MaximumNotificationDuration = notificationDurationBox.Maximum;
            scan_tooltip.AutoPopDelay = 60000;
            scan_tooltip.InitialDelay = 500;
            scan_tooltip.ReshowDelay = 0;
            scan_tooltip.ShowAlways = true;
            scan_tooltip.UseFading = true;

            this.loadTimerImage.Image = StyleManager.GetImage("scanningbar-red.gif");
            this.current_state = ScanningState.NoTibia;
            this.loadTimerImage.Enabled = true;
            scan_tooltip.SetToolTip(this.loadTimerImage, "No Tibia Client Found...");
        }
Esempio n. 2
0
        public MainForm()
        {
            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;

            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();

            this.Load += MainForm_Load;

            fileWriter = new StreamWriter(Constants.BigLootFile, true);

            tibialyzerLogo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.draggable_MouseDown);

            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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        public MainForm()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            mainForm = this;
            InitializeComponent();
            makeDraggable(this.Controls);
            this.InitializeTabs();
            switchTab(0);

            if (!File.Exists(databaseFile)) {
                ExitWithError("Fatal Error", String.Format("Could not find database file {0}.", databaseFile));
            }

            if (!File.Exists(nodeDatabase)) {
                ExitWithError("Fatal Error", String.Format("Could not find database file {0}.", nodeDatabase));
            }

            conn = new SQLiteConnection(String.Format("Data Source={0};Version=3;", databaseFile));
            conn.Open();

            lootConn = new SQLiteConnection(String.Format("Data Source={0};Version=3;", lootDatabaseFile));
            lootConn.Open();

            back_image = LoadImage(@"Images\back.png");
            prevpage_image = LoadImage(@"Images\prevpage.png");
            nextpage_image = LoadImage(@"Images\nextpage.png");
            cross_image = LoadImage(@"Images\cross.png");
            tibia_image = LoadImage(@"Images\tibia.png");
            mapup_image = LoadImage(@"Images\mapup.png");
            mapdown_image = LoadImage(@"Images\mapdown.png");
            checkmark_no = LoadImage(@"Images\checkmark-no.png");
            checkmark_yes = LoadImage(@"Images\checkmark-yes.png");
            checkbox_yes = LoadImage(@"Images\checkbox-checked.png");
            checkbox_no = LoadImage(@"Images\checkbox-empty.png");
            infoIcon = LoadImage(@"Images\defaulticon.png");
            tibia_store_image = LoadImage(@"Images\tibiastore.png");
            nomapavailable = LoadImage(@"Images\nomapavailable.png");
            checkbox_yes = LoadImage(@"Images\checkbox-checked.png");
            utilityImages.Add("offline training", LoadImage(@"Images\offlinetraining.png"));
            utilityImages.Add("offline training melee", utilityImages["offline training"]);
            utilityImages.Add("offline training magic", LoadImage(@"Images\offlinetrainingmagic.png"));
            utilityImages.Add("offline training distance", LoadImage(@"Images\offlinetrainingdistance.png"));
            utilityImages.Add("potion", LoadImage(@"Images\potionstore.png"));
            utilityImages.Add("boat", LoadImage(@"Images\boat.png"));
            utilityImages.Add("depot", LoadImage(@"Images\depot.png"));
            utilityImages.Add("bank", LoadImage(@"Images\bank.png"));
            utilityImages.Add("temple", LoadImage(@"Images\temple.png"));
            utilityImages.Add("ore wagon", LoadImage(@"Images\orewagon.png"));
            utilityImages.Add("whirlpool", LoadImage(@"Images\whirlpool.png"));
            utilityImages.Add("post office", LoadImage(@"Images\postoffice.png"));

            item_background = LoadImage(@"Images\item_background.png");
            for (int i = 0; i < 10; i++) {
                image_numbers[i] = LoadImage(@"Images\" + i.ToString() + ".png");
            }

            vocationImages.Add("knight", LoadImage(@"Images\Knight.png"));
            vocationImages.Add("paladin", LoadImage(@"Images\Paladin.png"));
            vocationImages.Add("druid", LoadImage(@"Images\Druid.png"));
            vocationImages.Add("sorcerer", LoadImage(@"Images\Sorcerer.png"));

            NotificationForm.Initialize();
            CreatureStatsForm.InitializeCreatureStats();

            for (int i = 0; i < 5; i++) {
                star_image[i] = LoadImage(@"Images\star" + i + ".png");
                star_image_text[i] = LoadImage(@"Images\star" + i + "_text.png");
            }
            star_image[5] = LoadImage(@"Images\starunknown.png");
            star_image_text[5] = LoadImage(@"Images\starunknown_text.png");

            prevent_settings_update = true;
            this.initializePluralMap();
            try {
                this.loadDatabaseData();
            } catch (Exception e) {
                ExitWithError("Fatal Error", String.Format("Corrupted database {0}.\nMessage: {1}", databaseFile, e.Message));
            }
            SettingsManager.LoadSettings(settingsFile);
            MainForm.initializeFonts();
            this.initializeHunts();
            this.initializeSettings();
            this.initializeMaps();
            this.initializeTooltips();
            try {
                Pathfinder.LoadFromDatabase(nodeDatabase);
            } catch (Exception e) {
                ExitWithError("Fatal Error", String.Format("Corrupted database {0}.\nMessage: {1}", nodeDatabase, e.Message));
            }
            prevent_settings_update = false;

            if (SettingsManager.getSettingBool("StartAutohotkeyAutomatically")) {
                startAutoHotkey_Click(null, null);
            }

            fileWriter = new StreamWriter(bigLootFile, true);

            ignoreStamp = createStamp();

            browseTypeBox.SelectedIndex = 0;

            this.Load += MainForm_Load;

            tibialyzerLogo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.draggable_MouseDown);

            BackgroundWorker bw = new BackgroundWorker();
            bw.DoWork += bw_DoWork;
            bw.RunWorkerAsync();

            MaximumNotificationDuration = notificationDurationBox.Maximum;
            scan_tooltip.AutoPopDelay = 60000;
            scan_tooltip.InitialDelay = 500;
            scan_tooltip.ReshowDelay = 0;
            scan_tooltip.ShowAlways = true;
            scan_tooltip.UseFading = true;

            this.loadingbar = LoadImage(@"Images\scanningbar.gif");
            this.loadingbarred = LoadImage(@"Images\scanningbar-red.gif");
            this.loadingbargray = LoadImage(@"Images\scanningbar-gray.gif");

            this.loadTimerImage.Image = this.loadingbarred;
            this.current_state = ScanningState.NoTibia;
            this.loadTimerImage.Enabled = true;
            scan_tooltip.SetToolTip(this.loadTimerImage, "No Tibia Client Found...");
        }