getSettingString() публичный статический Метод

public static getSettingString ( string key ) : string
key string
Результат string
Пример #1
0
        public void InitializeSettings()
        {
            this.screenshotAdvanceCheckbox.Checked    = SettingsManager.getSettingBool("AutoScreenshotAdvance");
            this.screenshotOnRareItemCheckbox.Checked = SettingsManager.getSettingBool("AutoScreenshotItemDrop");
            this.screenshotDeathCheckbox.Checked      = SettingsManager.getSettingBool("AutoScreenshotDeath");
            this.screenshotLowLifeCheckbox.Checked    = SettingsManager.getSettingBool("AutoScreenshotLowLife");
            this.screenshotValueBox.Text = SettingsManager.getSettingString("ScreenshotRareItemValue");

            this.enableScreenshotCheckbox.Checked = SettingsManager.getSettingBool("EnableScreenshots");
            if (SettingsManager.getSettingString("ScreenshotPath") == null || !Directory.Exists(SettingsManager.getSettingString("ScreenshotPath")))
            {
                string path = Path.Combine(Directory.GetCurrentDirectory(), "Screenshots");
                SettingsManager.setSetting("ScreenshotPath", path);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
            }

            screenshotDisplayList.ReadOnly           = true;
            screenshotDisplayList.AttemptDeleteItem += ScreenshotDisplayList_AttemptDeleteItem;

            screenshotPathBox.Text = SettingsManager.getSettingString("ScreenshotPath");
            refreshScreenshots();
        }
Пример #2
0
        public void InitializeSettings()
        {
            string language = SettingsManager.getSettingString("TibialyzerLanguage");

            switch (language)
            {
            case "en-US":
                languageDropDownList.SelectedIndex = 0;
                break;

            case "nl-NL":
                languageDropDownList.SelectedIndex = 1;
                break;

            case "pl-PL":
                languageDropDownList.SelectedIndex = 2;
                break;

            case "pt-BR":
                languageDropDownList.SelectedIndex = 3;
                break;
            }
            nameListBox.Items.Clear();
            foreach (string str in SettingsManager.getSetting("Names"))
            {
                nameListBox.Items.Add(str);
            }
            nameListBox.RefreshControl();
            nameListBox.ItemsChanged += NameListBox_ItemsChanged;

            automaticallyDetectCharacterCheckbox.Checked   = SettingsManager.getSettingBool("AutomaticallyDetectCharacter");
            automaticallyDownloadAddressesCheckbox.Checked = SettingsManager.getSettingBool("AutomaticallyDownloadAddresses");

            SwitchClients(SettingsManager.getSettingString("TibiaClient"));
        }
Пример #3
0
        private void ScreenshotDisplayList_AttemptDeleteItem(object sender, EventArgs e)
        {
            if (screenshotDisplayList.SelectedIndex >= 0)
            {
                string fileName = screenshotDisplayList.Text;
                string path     = SettingsManager.getSettingString("ScreenshotPath");
                if (path == null)
                {
                    return;
                }

                string imagePath = Path.Combine(path, fileName);
                if (!File.Exists(imagePath))
                {
                    return;
                }

                screenshotBox.Image.Dispose();
                screenshotBox.Image = null;

                try {
                    File.Delete(imagePath);
                } catch {
                    return;
                }

                screenshotDisplayList.Items.RemoveAt(screenshotDisplayList.SelectedIndex);
                refreshScreenshots();
            }
        }
Пример #4
0
        private void openInExplorer_Click(object sender, EventArgs e)
        {
            string path = SettingsManager.getSettingString("ScreenshotPath");

            if (path == null)
            {
                return;
            }
            Process.Start(path);
        }
Пример #5
0
        private void screenshotBrowse_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();

            folderBrowserDialog.SelectedPath = SettingsManager.getSettingString("ScreenshotPath");
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                SettingsManager.setSetting("ScreenshotPath", folderBrowserDialog.SelectedPath);
                screenshotPathBox.Text = folderBrowserDialog.SelectedPath;
                refreshScreenshots();
            }
        }
Пример #6
0
 public void InitializeSettings()
 {
     this.popupAnimationBox.Checked                   = SettingsManager.getSettingBool("EnableSimpleNotificationAnimation");
     this.eventPopupBox.Checked                       = SettingsManager.getSettingBool("EnableEventNotifications");
     this.unrecognizedPopupBox.Checked                = SettingsManager.getSettingBool("EnableUnrecognizedNotifications");
     this.copyAdvancesCheckbox.Checked                = SettingsManager.getSettingBool("CopyAdvances");
     this.popupTypeBox.SelectedIndex                  = SettingsManager.getSettingBool("UseRichNotificationType") ? 1 : 0;
     this.outfitGenderCheckbox.SelectedIndex          = SettingsManager.getSettingBool("OutfitGenderMale") ? 0 : 1;
     this.lookModeCheckbox.Checked                    = SettingsManager.getSettingBool("LookMode");
     this.scanningSpeedTrack.Value                    = Math.Min(Math.Max(SettingsManager.getSettingInt("ScanSpeed"), scanningSpeedTrack.Minimum), scanningSpeedTrack.Maximum);
     this.scanSpeedDisplayLabel.Text                  = Constants.ScanSpeedText[scanningSpeedTrack.Value / 10] + String.Format("({0})", scanningSpeedTrack.Value);
     this.experienceComputationDropdown.SelectedIndex = SettingsManager.getSettingString("ExperiencePerHourCalculation") == "TibiaStyle" ? 0 : 1;
 }
Пример #7
0
 public void InitializeSettings()
 {
     this.enablePopupAnimationsCheckbox.Checked         = SettingsManager.getSettingBool("EnableSimpleNotificationAnimation");
     this.popupOnEventCheckbox.Checked                  = SettingsManager.getSettingBool("EnableEventNotifications");
     this.unrecognizedPopupCheckbox.Checked             = SettingsManager.getSettingBool("EnableUnrecognizedNotifications");
     this.copyAdvancesCheckbox.Checked                  = SettingsManager.getSettingBool("CopyAdvances");
     this.defaultOutfitGenderDropDownList.SelectedIndex = SettingsManager.getSettingBool("OutfitGenderMale") ? 0 : 1;
     this.viewLookedAtObjectsCheckbox.Checked           = SettingsManager.getSettingBool("LookMode");
     this.scanningSpeedTrack.Value        = Math.Min(Math.Max(SettingsManager.getSettingInt("ScanSpeed"), scanningSpeedTrack.Minimum), scanningSpeedTrack.Maximum);
     this.scanningSpeedDisplayHeader.Text = Constants.ScanSpeedText[scanningSpeedTrack.Value / 10] + String.Format("({0})", scanningSpeedTrack.Value);
     this.experienceComputationDropDownList.SelectedIndex = SettingsManager.getSettingString("ExperiencePerHourCalculation") == "TibiaStyle" ? 0 : 1;
     this.scanInternalTabsCheckbox.Checked           = SettingsManager.getSettingBool("ScanInternalTabStructure");
     this.skipDuplicateLootCheckbox.Checked          = SettingsManager.getSettingBool("SkipDuplicateLoot");
     this.skipDuplicateCommandsCheckbox.Checked      = SettingsManager.getSettingBool("SkipDuplicateCommands");
     this.extraPlayerLookInformationCheckbox.Checked = SettingsManager.getSettingBool("GatherExtraPlayerInformation");
 }
Пример #8
0
        public override void LoadHUD()
        {
            pictureBox           = new PictureBox();
            pictureBox.Location  = new Point(0, 0);
            pictureBox.Size      = new Size(this.Width, this.Height);
            pictureBox.BackColor = StyleManager.TransparencyKey;
            this.Controls.Add(pictureBox);

            try {
                string backgroundLocation = SettingsManager.getSettingString("PortraitBackgroundImage");
                if (backgroundLocation != null)
                {
                    backgroundImage = Image.FromFile(backgroundLocation);
                }
                else
                {
                    backgroundImage = StyleManager.GetImage("defaultportrait-blue.png").Clone() as Image;
                }
            } catch {
                backgroundImage = StyleManager.GetImage("defaultportrait-blue.png").Clone() as Image;
            }

            try {
                string centerLocation = SettingsManager.getSettingString("PortraitCenterImage");
                if (centerLocation != null)
                {
                    centerImage = Image.FromFile(centerLocation);
                }
                else
                {
                    centerImage = null;
                }
            } catch {
                centerImage = null;
            }


            backgroundOffset = new Point(SettingsManager.getSettingInt("PortraitBackgroundXOffset"), SettingsManager.getSettingInt("PortraitBackgroundYOffset"));
            centerOffset     = new Point(SettingsManager.getSettingInt("PortraitCenterXOffset"), SettingsManager.getSettingInt("PortraitCenterYOffset"));

            backgroundScale = Math.Min(100, Math.Max(0, SettingsManager.getSettingInt("PortraitBackgroundScale")));
            centerScale     = Math.Min(100, Math.Max(0, SettingsManager.getSettingInt("PortraitCenterScale")));

            RefreshHUD(1, 1);

            this.Load += Portrait_Load;
        }
Пример #9
0
        private void nameListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (MainForm.prevent_settings_update)
            {
                return;
            }

            string imagePath = SettingsManager.getSettingString("HealthListImage" + nameListBox.SelectedIndex);

            playerImageBox.Image = null;
            if (imagePath != null)
            {
                try {
                    playerImageBox.Image = Image.FromFile(imagePath);
                } catch { }
            }
        }
Пример #10
0
        private void refreshCenterImage()
        {
            string centerLocation = SettingsManager.getSettingString("PortraitCenterImage");

            if (centerLocation == null)
            {
                return;
            }
            centerImageBox.Image = LoadImageFromPath(centerLocation);
            if (centerImageBox.Image == null)
            {
                OutfiterOutfit outfit = new OutfiterOutfit();
                outfit.FromString(centerLocation);
                centerImageBox.Image = outfit.GetImage();
                outfiterCode.Text    = centerLocation;
            }
        }
Пример #11
0
        public HealthList()
        {
            InitializeComponent();

            this.BackColor       = StyleManager.BlendTransparencyKey;
            this.TransparencyKey = StyleManager.BlendTransparencyKey;

            displayNames    = SettingsManager.getSettingBool(GetHUD() + "DisplayNames");
            displayIcons    = SettingsManager.getSettingBool(GetHUD() + "DisplayIcons");
            displayText     = SettingsManager.getSettingBool(GetHUD() + "DisplayText");
            healthBarHeight = SettingsManager.getSettingInt(GetHUD() + "Height");
            playerBarHeight = displayNames ? healthBarHeight * 5 / 3 : healthBarHeight;

            List <string> names = SettingsManager.getSetting(GetHUD() + "PlayerNames");
            int           index = 0;

            foreach (string name in names)
            {
                if (name.Trim() == "")
                {
                    continue;
                }
                string imagePath = SettingsManager.getSettingString(GetHUD() + "Image" + index.ToString());
                Image  image     = null;
                if (imagePath != null)
                {
                    try {
                        image = Image.FromFile(imagePath);
                    } catch {
                        OutfiterOutfit outfit = new OutfiterOutfit();
                        outfit.FromString(imagePath);
                        image = outfit.GetImage();
                    }
                }
                this.players.Add(new PlayerEntry {
                    name = name, playerImage = image
                });
                index++;
            }

            double opacity = SettingsManager.getSettingDouble(GetHUD() + "Opacity");

            opacity      = Math.Min(1, Math.Max(0, opacity));
            this.Opacity = opacity;
        }
Пример #12
0
        private void hudTypeList_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedHUDLabel.Text            = hudTypeList.Items[hudTypeList.SelectedIndex].ToString();
            MainForm.prevent_settings_update = true;
            string hudName = getSelectedHudName();

            hudXOffsetBox.Text          = SettingsManager.getSettingString(hudName + "XOffset");
            hudYOffsetBox.Text          = SettingsManager.getSettingString(hudName + "YOffset");
            hudAnchorBox.SelectedIndex  = SettingsManager.getSettingInt(hudName + "Anchor");
            hudWidthBox.Text            = SettingsManager.getSettingString(hudName + "Width");
            hudHeightBox.Text           = SettingsManager.getSettingString(hudName + "Height");
            showHudOnStartupBox.Checked = SettingsManager.getSettingBool(hudName + "ShowOnStartup");
            fontSizeBox.Text            = SettingsManager.getSettingString(hudName + "FontSize");
            hudOpacityBox.Text          = SettingsManager.getSettingString(hudName + "Opacity");
            displayHUDTextBox.Checked   = SettingsManager.getSettingBool(hudName + "DisplayText");

            advancedOptionsButton.Visible = hudName == "HealthList" || hudName == "Portrait";

            MainForm.prevent_settings_update = false;
        }
Пример #13
0
 public static int GetExperiencePerHour()
 {
     if (SettingsManager.getSettingString("ExperiencePerHourCalculation") == "TibiaStyle")
     {
         return(GetTotalExperience(TimestampManager.getLatestTimes(15)).Item1 * 4);
     }
     else
     {
         List <string> times           = TimestampManager.getLatestTimes(coefficients.Length);
         double        totalExperience = 0;
         for (int i = 0; i < coefficients.Length; i++)
         {
             if (totalExperienceResults.ContainsKey(times[i]))
             {
                 totalExperience += totalExperienceResults[times[i]] * coefficients[i];
             }
         }
         return((int)(totalExperience * 4));
     }
 }
Пример #14
0
        public void refreshScreenshots()
        {
            string selectedValue = screenshotDisplayList.SelectedIndex >= 0 ? screenshotDisplayList.Items[screenshotDisplayList.SelectedIndex].ToString() : null;
            int    index         = 0;

            string path = SettingsManager.getSettingString("ScreenshotPath");

            if (path == null)
            {
                return;
            }

            if (!Directory.Exists(path))
            {
                return;
            }

            string[] files = Directory.GetFiles(path);

            refreshingScreenshots = true;

            screenshotDisplayList.Items.Clear();
            foreach (string file in files)
            {
                if (Constants.ImageExtensions.Contains(Path.GetExtension(file), StringComparer.OrdinalIgnoreCase))   //check if file is an image
                {
                    string f = Path.GetFileName(file);
                    if (f == selectedValue)
                    {
                        index = screenshotDisplayList.Items.Count;
                    }
                    screenshotDisplayList.Items.Add(f);
                }
            }

            refreshingScreenshots = false;
            if (screenshotDisplayList.Items.Count > 0)
            {
                screenshotDisplayList.SelectedIndex = index;
            }
        }
Пример #15
0
        public static void saveScreenshot(string name, Bitmap bitmap)
        {
            if (bitmap == null)
            {
                return;
            }
            string path = SettingsManager.getSettingString("ScreenshotPath");

            if (path == null)
            {
                return;
            }

            DateTime dt = DateTime.Now;

            name = String.Format("{0} - {1}-{2}-{3} {4}h{5}m{6}s{7}ms.png", name, dt.Year.ToString("D4"), dt.Month.ToString("D2"), dt.Day.ToString("D2"), dt.Hour.ToString("D2"), dt.Minute.ToString("D2"), dt.Second.ToString("D2"), dt.Millisecond.ToString("D4"));
            path = Path.Combine(path, name);
            bitmap.Save(path, ImageFormat.Png);
            bitmap.Dispose();
            MainForm.mainForm.refreshScreenshots();
        }
Пример #16
0
        public override void LoadHUD()
        {
            pictureBox           = new PictureBox();
            pictureBox.Location  = new Point(0, 0);
            pictureBox.Size      = new Size(this.Width, this.Height);
            pictureBox.BackColor = StyleManager.TransparencyKey;
            this.Controls.Add(pictureBox);

            string centerLocation = SettingsManager.getSettingString("PortraitCenterImage");

            if (centerLocation != null)
            {
                try {
                    centerImage = Image.FromFile(centerLocation);
                } catch {
                    OutfiterOutfit outfit = new OutfiterOutfit();
                    outfit.FromString(centerLocation);
                    using (Image image = outfit.GetImage()) {
                        using (Bitmap bitmap = new Bitmap(image)) {
                            centerImage = bitmap.Clamp();
                        }
                    }
                }
            }
            else
            {
                centerImage = null;
            }


            backgroundOffset = new Point(SettingsManager.getSettingInt("PortraitBackgroundXOffset"), SettingsManager.getSettingInt("PortraitBackgroundYOffset"));
            centerOffset     = new Point(SettingsManager.getSettingInt("PortraitCenterXOffset"), SettingsManager.getSettingInt("PortraitCenterYOffset"));

            backgroundScale = Math.Min(100, Math.Max(0, SettingsManager.getSettingInt("PortraitBackgroundScale")));
            centerScale     = Math.Min(100, Math.Max(0, SettingsManager.getSettingInt("PortraitCenterScale")));

            RefreshHUD();
        }
Пример #17
0
        public static void saveScreenshot(string name, Bitmap bitmap)
        {
            if (bitmap == null)
            {
                return;
            }
            string path = SettingsManager.getSettingString("ScreenshotPath");

            if (path == null)
            {
                return;
            }
            try {
                DateTime dt = DateTime.Now;
                name = String.Format("{0}-{1}-{2} {3}h{4}m{5}s{6}ms {7}.png", dt.Year.ToString("D4"), dt.Month.ToString("D2"), dt.Day.ToString("D2"), dt.Hour.ToString("D2"), dt.Minute.ToString("D2"), dt.Second.ToString("D2"), dt.Millisecond.ToString("D4"), name);
                path = Path.Combine(path, name);
                bitmap.Save(path, ImageFormat.Png);
                bitmap.Dispose();
                MainForm.mainForm.refreshScreenshots();
            } catch (Exception ex) {
                MainForm.mainForm.DisplayWarning("Failed to save screenshot: " + ex.Message);
            }
        }
Пример #18
0
        private void screenshotList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (refreshingScreenshots)
            {
                return;
            }
            if (screenshotDisplayList.SelectedIndex >= 0)
            {
                string selectedImage = screenshotDisplayList.Items[screenshotDisplayList.SelectedIndex].ToString();

                string path = SettingsManager.getSettingString("ScreenshotPath");
                if (path == null)
                {
                    return;
                }

                string imagePath = Path.Combine(path, selectedImage);
                if (!File.Exists(imagePath))
                {
                    return;
                }
                try {
                    Image image = Image.FromFile(imagePath);
                    if (image != null)
                    {
                        Image oldImage = screenshotBox.Image;
                        screenshotBox.Image = image;
                        if (oldImage != null)
                        {
                            oldImage.Dispose();
                        }
                        screenshotTitleHeader.Text = selectedImage;
                    }
                } catch {
                }
            }
        }
Пример #19
0
 private void refreshBackgroundImage()
 {
     backgroundImageBox.Image = LoadImageFromPath(SettingsManager.getSettingString("PortraitBackgroundImage"));
 }
Пример #20
0
 public static void Initialize()
 {
     TibiaClientName = SettingsManager.settingExists("TibiaClientName") ? SettingsManager.getSettingString("TibiaClientName") : TibiaClientName;
     detectTibiaActive.Start();
 }
Пример #21
0
        public static void Initialize()
        {
            //"Name#DBTableID#Track#Time#Exp#SideHunt#AggregateHunt#ClearOnStartup#Creature#Creature#..."
            if (!SettingsManager.settingExists("Hunts"))
            {
                SettingsManager.setSetting("Hunts", new List <string>()
                {
                    "New Hunt#True#0#0#False#True"
                });
            }
            hunts.Clear();
            int        activeHuntIndex = 0, index = 0;
            List <int> dbTableIds = new List <int>();

            foreach (string str in SettingsManager.getSetting("Hunts"))
            {
                SQLiteDataReader reader;
                Hunt             hunt   = new Hunt();
                string[]         splits = str.Split('#');
                if (splits.Length >= 7)
                {
                    hunt.name = splits[0];
                    if (!int.TryParse(splits[1].Trim(), out hunt.dbtableid))
                    {
                        continue;
                    }
                    if (dbTableIds.Contains(hunt.dbtableid))
                    {
                        continue;
                    }
                    dbTableIds.Add(hunt.dbtableid);

                    hunt.totalTime         = 0;
                    hunt.trackAllCreatures = splits[2] == "True";
                    double.TryParse(splits[3], NumberStyles.Any, CultureInfo.InvariantCulture, out hunt.totalTime);
                    long.TryParse(splits[4], out hunt.totalExp);
                    hunt.sideHunt       = splits[5] == "True";
                    hunt.aggregateHunt  = splits[6] == "True";
                    hunt.clearOnStartup = splits[7] == "True";
                    hunt.temporary      = false;
                    string massiveString = "";
                    for (int i = 8; i < splits.Length; i++)
                    {
                        if (splits[i].Length > 0)
                        {
                            massiveString += splits[i] + "\n";
                        }
                    }
                    hunt.trackedCreatures = massiveString;
                    // set this hunt to the active hunt if it is the active hunt
                    if (SettingsManager.settingExists("ActiveHunt") && SettingsManager.getSettingString("ActiveHunt") == hunt.name)
                    {
                        activeHuntIndex = index;
                    }

                    refreshLootCreatures(hunt);

                    if (hunt.clearOnStartup)
                    {
                        resetHunt(hunt);
                    }

                    // create the hunt table if it does not exist
                    LootDatabaseManager.CreateHuntTable(hunt);
                    // load the data for the hunt from the database
                    reader = LootDatabaseManager.GetHuntMessages(hunt);
                    while (reader.Read())
                    {
                        string message = reader["message"].ToString();
                        Tuple <Creature, List <Tuple <Item, int> > > resultList = Parser.ParseLootMessage(message);
                        if (resultList == null)
                        {
                            continue;
                        }

                        string t = message.Substring(0, 5);
                        if (!hunt.loot.logMessages.ContainsKey(t))
                        {
                            hunt.loot.logMessages.Add(t, new List <string>());
                        }
                        hunt.loot.logMessages[t].Add(message);

                        Creature cr = resultList.Item1;
                        if (!hunt.loot.creatureLoot.ContainsKey(cr))
                        {
                            hunt.loot.creatureLoot.Add(cr, new Dictionary <Item, int>());
                        }
                        foreach (Tuple <Item, int> tpl in resultList.Item2)
                        {
                            Item item  = tpl.Item1;
                            int  count = tpl.Item2;
                            if (!hunt.loot.creatureLoot[cr].ContainsKey(item))
                            {
                                hunt.loot.creatureLoot[cr].Add(item, count);
                            }
                            else
                            {
                                hunt.loot.creatureLoot[cr][item] += count;
                            }
                        }
                        if (!hunt.loot.killCount.ContainsKey(cr))
                        {
                            hunt.loot.killCount.Add(cr, 1);
                        }
                        else
                        {
                            hunt.loot.killCount[cr] += 1;
                        }
                    }
                    hunts.Add(hunt);
                    index++;
                }
            }
            if (hunts.Count == 0)
            {
                Hunt h = new Hunt();
                h.name      = "New Hunt";
                h.dbtableid = 1;
                hunts.Add(h);
                resetHunt(h);
            }
            activeHunt = hunts[activeHuntIndex];
            MainForm.mainForm.InitializeHuntDisplay(activeHuntIndex);
        }
Пример #22
0
 private void refreshCenterImage()
 {
     centerImageBox.Image = LoadImageFromPath(SettingsManager.getSettingString("PortraitCenterImage"));
 }
Пример #23
0
 public static void Initialize()
 {
     TibiaClientName = SettingsManager.settingExists("TibiaClientName") ? SettingsManager.getSettingString("TibiaClientName") : TibiaClientName;
 }
Пример #24
0
 public static void Initialize()
 {
     TibiaClientName   = SettingsManager.settingExists("TibiaClientName") ? SettingsManager.getSettingString("TibiaClientName") : TibiaClientName;
     tibiaFocusWatcher = new WindowFocusWatcher(WindowFocusWatcherEvent);
 }
Пример #25
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);
        }