private static void Main() { //Add the exception dialog to our solution new UnhandledExceptionDlg { RestartApp = false }; //Windows stuff Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CheckDotNet(); CheckUpdate.CheckForUpdate(); var executableFileInfo = new FileInfo(Application.ExecutablePath); string executableDirectoryName = executableFileInfo.DirectoryName; string ourDirectory = executableDirectoryName; if (!Directory.Exists(ourDirectory + "\\Logs")) { Directory.CreateDirectory(ourDirectory + "\\Logs"); } if (File.Exists(ourDirectory + "\\Logs\\OldLogFile.txt")) { File.Delete(ourDirectory + "\\Logs\\OldLogFile.txt"); } if (File.Exists(ourDirectory + "\\Logs\\LogFile.txt")) { File.Move(ourDirectory + "\\Logs\\LogFile.txt", ourDirectory + "\\Logs\\OldLogFile.txt"); } LazyForms.Load(); //Load license settings //Start update check // var check = new Thread(CheckUpdate.CheckForUpdate) {IsBackground = true}; // check.Start(); //Start license check LazySettings.LoadSettings(); ReloggerSettings.LoadSettings(); if (LazySettings.FirstRun) { new Wizard().ShowDialog(); } //Lets spawn the selector and wait for it to return before starting the bot var selector = new Selector(); selector.ShowDialog(); //If the user closed the bot or the process does not exist - close if (AttachTo == 0) { Environment.Exit(0); } Application.Run(LazyForms.MainForm); }
public void SaveSettings() { LazySettings.DebugMode = SetupDebugMode.Checked; LazySettings.SetupUseHotkeys = SetupUseHotkeys.Checked; LazySettings.StopAfterBool = SetupCBStopAfter.Checked; LazySettings.StopAfter = SetupTBStopAfter.Text; LazySettings.LogOutOnFollowTime = SetupTBLogOutOnFollow.Text; LazySettings.SoundFollow = SetupCBSoundFollow.Checked; LazySettings.SoundWhisper = SetupCBSoundWhisper.Checked; LazySettings.SoundStop = SetupCBSoundStop.Checked; LazySettings.Shutdown = SetupCBShutdown.Checked; LazySettings.BackgroundMode = SetupCBBackground.Checked; LazySettings.LogoutOnFollow = SetupCBLogoutOnFollow.Checked; LazySettings.HookMouse = CBHookMouse.Checked; LazySettings.Latency = Latency.Value; // LazySettings.CombatBoolEat = CombatCBEat.Checked; LazySettings.CombatBoolDrink = CombatCBDrink.Checked; LazySettings.CombatEatAt = CombatTBEatAt.Text; LazySettings.CombatDrinkAt = CombatTBDrinkAt.Text; LazySettings.KeysGroundMountBar = KeysGroundMountBar.SelectedItem.ToString(); LazySettings.KeysGroundMountKey = KeysGroundMountKey.SelectedItem.ToString(); LazySettings.KeysAttack1Bar = KeysAttack1Bar.SelectedItem.ToString(); LazySettings.KeysAttack1Key = KeysAttack1Key.SelectedItem.ToString(); LazySettings.KeysEatBar = KeysEatBar.SelectedItem.ToString(); LazySettings.KeysEatKey = KeysEatKey.SelectedItem.ToString(); LazySettings.KeysDrinkBar = KeysDrinkBar.SelectedItem.ToString(); LazySettings.KeysDrinkKey = KeysDrinkKey.SelectedItem.ToString(); LazySettings.KeysStafeLeftKeyText = KeysStafeLeftKey.SelectedItem.ToString(); LazySettings.KeysStafeRightKeyText = KeysStafeRightKey.SelectedItem.ToString(); LazySettings.KeysInteractKeyText = KeysInteractKey.SelectedItem.ToString(); LazySettings.KeysInteractTargetText = KeysInteractTarget.SelectedItem.ToString(); LazySettings.KeysTargetLastTargetText = KeysTargetLast.SelectedItem.ToString(); //Mail LazySettings.ShouldMail = CBMail.Checked; LazySettings.MailTo = TBMailTo.Text; LazySettings.MacroForMail = MacroForMail.Checked; LazySettings.KeysMailMacroBar = KeysMailMacroBar.SelectedItem.ToString(); LazySettings.KeysMailMacroKey = KeysMailMacroKey.SelectedItem.ToString(); //Vendor LazySettings.ShouldVendor = CBDoVendor.Checked; LazySettings.ShouldRepair = CBDoRepair.Checked; LazySettings.SellCommon = CBSellCommon.Checked; LazySettings.SellUncommon = CBSellUnCommon.Checked; LazySettings.SellPoor = CBSellPoor.Checked; LazySettings.FreeBackspace = IMinFreeBagSlots.Text; //Relogger ReloggerSettings.AccountName = SetupTBRelogUsername.Text; ReloggerSettings.AccountPw = SetupTBRelogPW.Text; ReloggerSettings.CharacterName = SetupTBRelogCharacter.Text; ReloggerSettings.ReloggingEnabled = SetupCBRelogEnableRelogger.Checked; ReloggerSettings.PeriodicReloggingEnabled = SetupCBRelogEnablePeriodicRelog.Checked; ReloggerSettings.PeriodicLogIn = SetupIIRelogLogInAfter.Value; ReloggerSettings.PeriodicLogOut = SetupIIRelogLogOutAfter.Value; ReloggerSettings.AccountAccount = SetupIIRelogLogAccount.Value; ReloggerSettings.SaveSettings(); //Language string clientLanguage = ClientLanguage.SelectedItem.ToString(); var lazyLanguage = (LazySettings.LazyLanguage)Enum.Parse(typeof(LazySettings.LazyLanguage), clientLanguage); if (LazySettings.Language != lazyLanguage) { if (!ItemDatabase.IsOpen) { ItemDatabase.Open(); } ItemDatabase.ClearDatabase(); } LazySettings.Language = lazyLanguage; LazySettings.SaveSettings(); SaveMailList(); SaveProtectedList(); }