Exemple #1
0
        //This is so bad on so many levels but i don't care, it works as is. Maybe one day i'll use a viewmodel which is the proper way to handle this.
        private void LaunchOptionsClose(object sender, RoutedEventArgs e)
        {
            ((Storyboard)FindResource("FadeOut")).Begin(LaunchOptions);

            try
            {
                ACCOUNT_CONFIG.ACCOUNTS.ADDITIONAL_PARAMS = cmdParams.Text;
                ACCOUNT_CONFIG.appendChangesToConfig();

                var dataList = SkillDataGrid.Items.OfType <SkillData>().ToList();
                var nodes    = MainWindow.qol_xml.XPathSelectElement("config/gcd/skill");

                XDocument tempdoc = MainWindow.qol_xml;
                tempdoc.Descendants("skill").Where(x => true).Remove();
                var elements = tempdoc.Descendants("gcd").Last();

                foreach (SkillData skill in dataList)
                {
                    elements.Add(new XElement("skill", new XAttribute("id", skill.skillID.ToString()), new XAttribute("value", skill.skillvalue), new XAttribute("mode", skill.mode.ToString())));
                }

                //tempdoc.XPathSelectElement("config/gcd").Attribute("enable").Value = ((bool)enableGCD.IsChecked) ? "1" : "0";
                MainWindow.qol_xml.Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "multitool_qol.xml"));
            } catch (Exception ex)
            {
                var dialog = new ErrorPrompt(String.Format("Error saving to multitool_qol.xml, make sure everything is filled out correctly in the skill section and the file exists in documents.\r\rAddition Info:\n{0}", ex.Message));
                dialog.ShowDialog();
            }
        }
Exemple #2
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //Check if loginhelper is installed
            loginHelper_installed = (File.Exists(Path.Combine(plugins_x86, "loginhelper.dll")) && File.Exists(Path.Combine(plugins_x64, "loginhelper.dll")));
            charselect_installed  = (File.Exists(Path.Combine(plugins_x86, "charselect.dll")) && File.Exists(Path.Combine(plugins_x64, "charselect.dll")));
            modpolice_installed   = (File.Exists(Path.Combine(bin_x86, "winmm.dll")) && File.Exists(Path.Combine(bin_x64, "winmm.dll")) && File.Exists(Path.Combine(plugins_x86, "bnspatch.dll")) && File.Exists(Path.Combine(plugins_x64, "bnspatch.dll")));

            Task.Run(new Action(() =>
            {
                if (ACCOUNT_CONFIG.ACCOUNTS.REGION < 2 || (Globals.BnS_Region)ACCOUNT_CONFIG.ACCOUNTS.REGION == Globals.BnS_Region.KR)
                {
                    Globals.GameVersionCheck();
                    Globals.isLoginAvailable();
                    Application.Current.Dispatcher.Invoke((Action) delegate
                    {
                        Debug.WriteLine("{0}", Globals.onlineBnSVersion);
                        if (Globals.localBnSVersion != Globals.onlineBnSVersion || !Globals.loginAvailable)
                        {
                            var dialog   = new ErrorPrompt(String.Format("{0}\n{1}", (!Globals.loginAvailable) ? "The server is currently undergoing maintenance." : "", (Globals.localBnSVersion != Globals.onlineBnSVersion) ? "A game update is available" : ""));
                            dialog.Owner = MainWindow.mainWindow;
                            dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                            dialog.ShowDialog();
                        }
                    });
                }
            }));

            await Task.Run(async() => await checkOnlineVersion());
        }
        private void PatchesListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            lastSelectedPatch = PatchesListBox.SelectedIndex;
            try
            {
                AddonsAndPatches AddonEntry = PatchesListBox.SelectedItem as AddonsAndPatches;
                if (AddonEntry == null)
                {
                    return;
                }
                if (AddonEntry.isChecked)
                {
                    AddonEntry.isChecked = false;
                }
                else
                {
                    AddonEntry.isChecked = true;
                }

                PatchesListBox.SelectedItem = AddonEntry;
                CollectionViewSource.GetDefaultView(PatchesListBox.DataContext).Refresh();
                PatchesListBox.SelectedIndex = lastSelectedPatch;
            } catch (Exception ex) {
                var dialog = new ErrorPrompt(ex.Message);
                dialog.ShowDialog();
            }
        }
        private void monitorActiveProcesses(object sender, DoWorkEventArgs e)
        {
            do
            {
                try
                {
                    foreach (var session in ACTIVE_SESSIONS.Select((item, index) => new { index, item }).ToList())
                    {
                        if (session.item.PROCESS.HasExited)
                        {
                            ACTIVE_SESSIONS.RemoveAt(session.index);
                            removeFromActiveInvoke(session.index);
                        }
                        Thread.Sleep(500);
                    }
                } catch (Exception ex)
                {
                    var dialog = new ErrorPrompt(ex.Message);
                    dialog.ShowDialog();
                }
            } while (ACTIVE_SESSIONS.Count > 0);

            if (MainWindow.isMinimized)
            {
                MainWindow.changeWindowState(true);
            }
        }
Exemple #5
0
        private void handleClassAnimations(bool state, string className)
        {
            string directory  = SystemConfig.SYS.BNS_DIR + @"\contents\bns\CookedPC\";
            var    class_upks = SystemConfig.SYS.ANIMATION_UPKS.Where(x => x.CLASS == className).SelectMany(upk => upk.UPK_FILES);

            foreach (var file in class_upks)
            {
                if (state)
                {
                    Debug.WriteLine("Attempting to remove files for: " + className + "\n");
                    Debug.Write("File: " + file + "\n");
                    if (File.Exists(directory + file))
                    {
                        try
                        {
                            Debug.Write("Removing: " + file + " for: " + className + "\n");
                            File.Move(directory + file, SystemConfig.SYS.UPK_DIR + @"\" + file);
                        } catch (Exception ex)
                        {
                            var dialog = new ErrorPrompt(ex.Message);
                            dialog.ShowDialog();
                        }
                    }
                }
                else
                {
                    Debug.WriteLine("Attempting to restore files for: " + className + "\n");
                    Debug.Write("File: " + file + "\n");
                    if (File.Exists(SystemConfig.SYS.UPK_DIR + @"\" + file))
                    {
                        try
                        {
                            Debug.Write("Restoring: " + file + " for: " + className + "\n");
                            if (!File.Exists(directory + file))
                            {
                                File.Move(SystemConfig.SYS.UPK_DIR + @"\" + file, directory + file);
                            }
                        } catch (Exception ex)
                        {
                            var dialog = new ErrorPrompt(ex.Message);
                            dialog.ShowDialog();
                        }
                    }
                }
            }

            if (state)
            {
                classLabel.Content = String.Format("{0} Removed", className);
            }
            else
            {
                classLabel.Content = String.Format("{0} Restored", className);
            }

            ((Storyboard)FindResource("animate")).Begin(classLabel);
            ((Storyboard)FindResource("animate")).Begin(successStatePicture);
        }
Exemple #6
0
        private async void launchGameClientClick(object sender, RoutedEventArgs e)
        {
            bool is_x64 = (BIT_BOX.SelectedIndex == 1) ? true : false;

            //Some error checking for retards
            bool loginhelperBit  = File.Exists(Path.Combine(is_x64 ? plugins_x64 : plugins_x86, "loginhelper.dll"));
            bool bnspatchBit     = File.Exists(Path.Combine(is_x64 ? plugins_x64 : plugins_x86, "bnspatch.dll"));
            bool pluginloaderBit = File.Exists(Path.Combine(is_x64 ? bin_x64 : bin_x86, "winmm.dll"));

            if (ACCOUNT_LIST_BOX.SelectedIndex == -1)
            {
                classLabel.Text = "No account selected, select an account before attemping to launch a new client";
                ((Storyboard)FindResource("animate")).Begin(ErrorPromptGrid);
                return;
            }
            else if (!loginhelperBit)
            {
                var dialog = new ErrorPrompt(String.Format("Loginhelper is missing for {0}. Install it for {0} before launching a new client", is_x64 ? "64-bit" : "32-bit"), false, true);
                dialog.ShowDialog();
                return;
            }
            else if (!bnspatchBit)
            {
                var dialog = new ErrorPrompt(String.Format("BNSPatch is missing for {0}. Install it for {0} before launching a new client", is_x64 ? "64-bit" : "32-bit"), false, true);
                dialog.ShowDialog();
                return;
            }
            else if (!pluginloaderBit)
            {
                var dialog = new ErrorPrompt(String.Format("Pluginloader is missing for {0}. Install it for {0} before launching a new client", is_x64 ? "64-bit" : "32-bit"), false, true);
                dialog.ShowDialog();
                return;
            }

            string EMAIL     = ACCOUNT_LIST_BOX.Text;
            int    HAS_INDEX = ACTIVE_SESSIONS.FindIndex(x => x.EMAIL == EMAIL && x.REGION == REGION_BOX.SelectedIndex);

            if (HAS_INDEX == -1)
            {
                await launchNewGameClient();
            }
            else
            {
                if (ACTIVE_SESSIONS[HAS_INDEX].PROCESS.HasExited)
                {
                    ACTIVE_SESSIONS.RemoveAt(HAS_INDEX);
                    await launchNewGameClient();
                }
                else
                {
                    ACTIVE_SESSIONS[HAS_INDEX].PROCESS.Kill();
                    await launchNewGameClient();
                }
            }
        }
 private void GameUpdaterButton(object sender, RoutedEventArgs e)
 {
     if ((Globals.BnS_Region)ACCOUNT_CONFIG.ACCOUNTS.REGION == Globals.BnS_Region.TW)
     {
         var dialog = new ErrorPrompt("This feature is only available for NA, EU and KR region");
         dialog.ShowDialog();
     }
     else
     {
         setCurrentPage("Gameupdater");
     }
 }
        private void launchGameClientClick(object sender, RoutedEventArgs e)
        {
            //Some error checking for retards
            if (!loginHelper_installed)
            {
                classLabel.Text = "Loginhelper is not installed on either 32-bit or 64-bit. Both need to be installed before launching a new client";
                ((Storyboard)FindResource("animate")).Begin(ErrorPromptGrid);
                return;
            }
            else if (ACCOUNT_LIST_BOX.SelectedIndex == -1)
            {
                classLabel.Text = "No account selected, select an account before attemping to launch a new client";
                ((Storyboard)FindResource("animate")).Begin(ErrorPromptGrid);
                return;
            }
            else if (!modpolice_installed)
            {
                var dialog = new ErrorPrompt("Pluginloader / BNSPatch is missing from either 32 or 64-bit clients. Install these before launching a new client.");
                dialog.ShowDialog();
                return;
            }

            string EMAIL     = ACCOUNT_LIST_BOX.Text;
            int    HAS_INDEX = ACTIVE_SESSIONS.FindIndex(x => x.EMAIL == EMAIL && x.REGION == REGION_BOX.SelectedIndex);

            if (HAS_INDEX == -1)
            {
                launchNewGameClient();
            }
            else
            {
                if (ACTIVE_SESSIONS[HAS_INDEX].PROCESS.HasExited)
                {
                    ACTIVE_SESSIONS.RemoveAt(HAS_INDEX);
                    launchNewGameClient();
                }
                else
                {
                    classLabel.Text = "An instance for this account and region is already running, close the instance before trying to launch a new one";
                    ((Storyboard)FindResource("animate")).Begin(ErrorPromptGrid);
                }
            }
        }
Exemple #9
0
        private void versionCheckFinished(object sender, RunWorkerCompletedEventArgs e)
        {
            Debug.WriteLine(String.Format("Online Version: {0} \n", ONLINE_VERSION));

            if (ONLINE_VERSION == "")
            {
                var dialog = new ErrorPrompt("Could not fetch online version..?");
                dialog.ShowDialog();
                return;
            }

            if (ONLINE_VERSION == SystemConfig.SYS.VERSION)
            {
                MultiTool_UPDATE.Visibility = Visibility.Hidden;
            }
            else
            {
                MultiTool_UPDATE.Visibility = Visibility.Visible;
            }
        }
Exemple #10
0
        private void killGameProcess(object sender, RoutedEventArgs e)
        {
            if (ACCOUNT_LIST_BOX.SelectedIndex == -1)
            {
                return;
            }

            try
            {
                string EMAIL     = ACCOUNT_LIST_BOX.Text;
                int    HAS_INDEX = ACTIVE_SESSIONS.FindIndex(x => x.EMAIL == EMAIL && x.REGION == REGION_BOX.SelectedIndex);

                if (HAS_INDEX != -1)
                {
                    if (!ACTIVE_SESSIONS[HAS_INDEX].PROCESS.HasExited)
                    {
                        try
                        {
                            ACTIVE_SESSIONS[HAS_INDEX].PROCESS.Kill();
                            ACTIVE_SESSIONS.RemoveAt(HAS_INDEX);
                            ProcessInfo.Items.RemoveAt(HAS_INDEX);
                        }
                        catch (Exception ex)
                        {
                            var dialog = new ErrorPrompt(ex.Message);
                            dialog.ShowDialog();
                        }
                    }
                    else
                    {
                        ACTIVE_SESSIONS.RemoveAt(HAS_INDEX);
                        ProcessInfo.Items.RemoveAt(HAS_INDEX);
                    }
                }
            } catch (Exception ex)
            {
                var dialog = new ErrorPrompt(ex.Message);
                dialog.ShowDialog();
            }
        }
        static ACCOUNT_CONFIG()
        {
            if (!File.Exists(CONFIG_FILE))
            {
                ACCOUNTS = new ACCOUNTS_CONFIG
                {
                    USE_ALL_CORES         = 0,
                    USE_TEXTURE_STREAMING = 0,
                    REGION            = 0,
                    CLIENT_BIT        = 0,
                    LANGUAGE          = 0,
                    SELECT_LAST_CHAR  = 0,
                    MEMORY_CLEANER    = 0,
                    ADDITIONAL_PARAMS = "",
                    Saved             = new List <BNS_SAVED_ACCOUNTS_STRUCT> {
                    }
                };

                string _JSON = JsonConvert.SerializeObject(ACCOUNTS, Formatting.Indented);
                File.WriteAllText(CONFIG_FILE, _JSON);
            }
            else
            {
                try
                {
                    string _JSON = File.ReadAllText(CONFIG_FILE);
                    ACCOUNTS = JsonConvert.DeserializeObject <ACCOUNTS_CONFIG>(_JSON);

                    appendChangesToConfig();
                } catch (Exception)
                {
                    var dialog = new ErrorPrompt("There was an error reading the config file: accounts.json\rIf error persists delete accounts.json or check for syntax errors.");
                    dialog.ShowDialog();
                    Environment.Exit(0);
                }
            }
        }
Exemple #12
0
        private static void checkForUpdate()
        {
            WebClient client = new WebClient();

            try
            {
                var json = client.DownloadString("http://tonic.pw/files/bnsmultitool/version.json");
                onlineJson = JsonConvert.DeserializeObject <MainWindow.ONLINE_VERSION_STRUCT>(json);

                if (onlineJson.VERSION != MainWindow.FileVersion())
                {
                    Application.Current.Dispatcher.BeginInvoke((Action) delegate
                    {
                        var dialog = new ErrorPrompt("Update available, please be sure to read the change log for any critical changes.\r\rOnline Version: " + onlineJson.VERSION + "\rLocal: " + SystemConfig.SYS.VERSION, true);
                        dialog.ShowDialog();
                    });

                    SystemConfig.SYS.VERSION = MainWindow.FileVersion();
                    SystemConfig.appendChangesToConfig();

                    Dispatchers.buttonVisibility(MainWindow.UpdateButtonObj, Visibility.Visible);
                }
            } catch (WebException ex)
            {
                onlineJson           = new MainWindow.ONLINE_VERSION_STRUCT();
                onlineJson.CHANGELOG = new List <MainWindow.CHANGELOG_STRUCT>();
                onlineJson.CHANGELOG.Add(new MainWindow.CHANGELOG_STRUCT()
                {
                    VERSION = "ERROR", NOTES = ex.Message
                });
            }
            finally
            {
                client.Dispose();
            }
        }
        private async void handleToggleChange(object sender, RoutedEventArgs e)
        {
            try
            {
                HorizontalToggleSwitch currentToggle = (HorizontalToggleSwitch)sender;

                if (!_isInitialized)
                {
                    return;
                }

                if (Process.GetProcessesByName("Client").Length >= 1)
                {
                    peepoWtfText.Text = "You can't do that when Blade & Soul is already running!";
                    ((Storyboard)FindResource("animate")).Begin(ErrorPromptGrid);
                    return;
                }

                string sourceDirectory;
                string destinationDirectory;

                //Check if it is an individual class toggle
                if (systemToggles.Any(toggle => toggle.animToggle == currentToggle || toggle.fxToggle == currentToggle))
                {
                    string[]     upkfiles;
                    toggleStruct sysToggle;

                    if (currentToggle.Name.Contains("_fx_"))
                    {
                        sysToggle = systemToggles.Where(x => x.fxToggle.Name == currentToggle.Name).FirstOrDefault();
                        upkfiles  = SystemConfig.SYS.CLASSES.Where(x => x.CLASS == sysToggle.className).Select(upk => upk.EFFECTS).FirstOrDefault();
                    }
                    else
                    {
                        sysToggle = systemToggles.Where(x => x.animToggle.Name == currentToggle.Name).FirstOrDefault();
                        upkfiles  = SystemConfig.SYS.CLASSES.Where(x => x.CLASS == sysToggle.className).Select(upk => upk.ANIMATIONS).FirstOrDefault();
                    }

                    //We're restoring
                    if (currentToggle.IsChecked)
                    {
                        sourceDirectory      = backupLocation;
                        destinationDirectory = SystemConfig.SYS.BNS_DIR + @"\contents\bns\CookedPC\";
                    }
                    else
                    {
                        sourceDirectory      = SystemConfig.SYS.BNS_DIR + @"\contents\bns\CookedPC\";
                        destinationDirectory = backupLocation;
                    }

                    // _isInitialized = false;
                    if (upkfiles.Count() > 0)
                    {
                        foreach (string file in upkfiles)
                        {
                            try
                            {
                                //Move our target file to our new destination
                                if (File.Exists(sourceDirectory + file))
                                {
                                    if (!File.Exists(destinationDirectory + file))
                                    {
                                        File.Move(sourceDirectory + file, destinationDirectory + file);
                                    }
                                    else
                                    {
                                        File.Delete(sourceDirectory + file);
                                    }
                                }
                            }
                            catch (Exception)
                            {
                                //ProgressControl.updateProgressLabel(ex.Message);
                            }
                        }
                    }

                    //_isInitialized = true;
                    Dispatchers.labelContent(classLabel, String.Format("{0} {1}", sysToggle.className, (currentToggle.IsChecked) ? "Restored" : "Removed"));
                    ((Storyboard)FindResource("animate")).Begin(classLabel);
                    ((Storyboard)FindResource("animate")).Begin(successStatePicture);
                }
                else
                {
                    string[] upkFiles;
                    upkFiles = SystemConfig.SYS.MAIN_UPKS;

                    _progressControl = new ProgressControl();
                    MainWindow.mainWindowFrame.RemoveBackEntry();
                    ProgressGrid.Visibility = Visibility.Visible;
                    MainGrid.Visibility     = Visibility.Collapsed;

                    ProgressPanel.Children.Add(_progressControl);

                    //Turning whatever the f**k it is on
                    if (currentToggle.IsChecked)
                    {
                        ProgressControl.errorSadPeepo(Visibility.Hidden);
                        ProgressControl.updateProgressLabel("Restoring files");
                        await Task.Delay(150);

                        sourceDirectory      = backupLocation;
                        destinationDirectory = SystemConfig.SYS.BNS_DIR + @"\contents\bns\CookedPC\";
                    }
                    else
                    {
                        ProgressControl.errorSadPeepo(Visibility.Hidden);
                        ProgressControl.updateProgressLabel("Removing files");
                        await Task.Delay(150);

                        sourceDirectory      = SystemConfig.SYS.BNS_DIR + @"\contents\bns\CookedPC\";
                        destinationDirectory = backupLocation;
                    }

                    if (upkFiles.Count() > 0)
                    {
                        foreach (string file in upkFiles)
                        {
                            try
                            {
                                ProgressControl.updateProgressLabel(String.Format("Checking for {0}", file));
                                await Task.Delay(25);

                                //Move our target file to our new destination
                                if (File.Exists(sourceDirectory + file))
                                {
                                    ProgressControl.updateProgressLabel(String.Format("{0} {1}", (currentToggle.IsChecked) ? "Restoring" : "Removing", file));
                                    if (!File.Exists(destinationDirectory + file))
                                    {
                                        File.Move(sourceDirectory + file, destinationDirectory + file);
                                    }
                                    else
                                    {
                                        File.Delete(sourceDirectory + file);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                ProgressControl.updateProgressLabel(ex.Message);
                                await Task.Delay(500);
                            }
                            await Task.Delay(50);
                        }
                    }

                    ProgressGrid.Visibility = Visibility.Hidden;
                    MainGrid.Visibility     = Visibility.Visible;
                    ProgressPanel.Children.Clear();
                    _progressControl = null;
                }
            } catch (Exception ex)
            {
                var dialog = new ErrorPrompt("Something went wrong, \r\rAddition information: \r" + ex.Message);
                dialog.ShowDialog();
            }

            GC.WaitForPendingFinalizers();
        }
Exemple #14
0
        public Launcher()
        {
            InitializeComponent();

            //Set our default selections if saved and other misc stuff
            try
            {
                if (ACCOUNT_CONFIG.ACCOUNTS.USE_ALL_CORES == 1)
                {
                    USE_ALL_CORES.IsChecked = true;
                }

                if (ACCOUNT_CONFIG.ACCOUNTS.USE_TEXTURE_STREAMING == 1)
                {
                    NOTEXTURE_STREAMING.IsChecked = true;
                }

                if (MainWindow.qol_xml.XPathSelectElement("config/options/option[@name='useMarketplace']").Attribute("enable").Value == "1")
                {
                    useMarketplace.IsChecked = true;
                }

                if (MainWindow.qol_xml.XPathSelectElement("config/options/option[@name='useAutoBait']").Attribute("enable").Value == "1")
                {
                    useAutoBait.IsChecked = true;
                }

                if (MainWindow.qol_xml.XPathSelectElement("config/options/option[@name='useItemCap']").Attribute("enable").Value == "1")
                {
                    useItemCap.IsChecked = true;
                }

                if (MainWindow.qol_xml.XPathSelectElement("config/options/option[@name='AutoCombat']").Attribute("enable").Value == "1")
                {
                    AutoCombat.IsChecked = true;
                }

                if (MainWindow.qol_xml.XPathSelectElement("config/options/option[@name='AutoCombat']").Attribute("useRange").Value == "1")
                {
                    autocombatrangeTOS.IsChecked = true;
                }

                if (MainWindow.qol_xml.XPathSelectElement("config/options/option[@name='useNoCameraLock']").Attribute("enable").Value == "1")
                {
                    useNoCameraLock.IsChecked = true;
                }

                if (MainWindow.qol_xml.XPathSelectElement("config/gcd").Attribute("enable").Value == "1")
                {
                    enableGCD.IsChecked = true;
                }

                if (ACCOUNT_CONFIG.ACCOUNTS.SELECT_LAST_CHAR == 1)
                {
                    useLastChar.IsChecked = true;
                }

                if (ACCOUNT_CONFIG.ACCOUNTS.ADDITIONAL_PARAMS != "")
                {
                    cmdParams.Text = ACCOUNT_CONFIG.ACCOUNTS.ADDITIONAL_PARAMS;
                }

                SkillDataGrid.ItemsSource = LoadSkillDataCollection();

                autoCombatRange.Text = MainWindow.qol_xml.XPathSelectElement("config/options/option[@name='AutoCombat']").Attribute("range").Value;

                BIT_BOX.SelectedIndex          = ACCOUNT_CONFIG.ACCOUNTS.CLIENT_BIT;
                REGION_BOX.SelectedIndex       = ACCOUNT_CONFIG.ACCOUNTS.REGION;
                LANGUAGE_BOX.SelectedIndex     = ACCOUNT_CONFIG.ACCOUNTS.LANGUAGE;
                MemoryCleanerBox.SelectedIndex = ACCOUNT_CONFIG.ACCOUNTS.MEMORY_CLEANER;

                memoryTimer.IsEnabled = false;
                memoryTimer.Tick     += new EventHandler(dispatchTimer_tick);

                if (ACCOUNT_CONFIG.ACCOUNTS.MEMORY_CLEANER != 0)
                {
                    memoryTimer.Interval  = TimeSpan.FromMinutes(timerFromSelection());
                    memoryTimer.IsEnabled = true;
                    memoryTimer.Start();
                }

                foreach (var account in ACCOUNT_CONFIG.ACCOUNTS.Saved)
                {
                    ACCOUNT_LIST_BOX.Items.Add(account.EMAIL);
                }

                if (ACCOUNT_SELECTED_INDEX != -1)
                {
                    ACCOUNT_LIST_BOX.SelectedIndex = ACCOUNT_SELECTED_INDEX;
                }

                monitorProcesses.DoWork += new DoWorkEventHandler(monitorActiveProcesses);
            } catch (Exception ex)
            {
                var dialog = new ErrorPrompt("Something went wrong, accounts.json is probably corrupted. Check for syntax errors in accounts.json or delete entirely.\r\rAddition information: \r" + ex.Message);
                dialog.ShowDialog();
                Environment.Exit(0);
            }
        }
        public MainWindow()
        {
            var wi = WindowsIdentity.GetCurrent();
            var wp = new WindowsPrincipal(wi);

            bool runAsAdmin = wp.IsInRole(WindowsBuiltInRole.Administrator);

            if (!runAsAdmin)
            {
                var processInfo = new ProcessStartInfo(Assembly.GetExecutingAssembly().CodeBase);

                processInfo.UseShellExecute = true;
                processInfo.Verb            = "runas";

                // Start the new process
                try
                {
                    Process.Start(processInfo);
                }
                catch (Exception)
                {
                    var dialog = new ErrorPrompt("Failed to auto start as admin, please launch with administrator rights.");
                    dialog.ShowDialog();
                }

                // Shut down the current process
                Environment.Exit(0);
            }

            InitializeComponent();

            string      CultureName = Thread.CurrentThread.CurrentCulture.Name;
            CultureInfo ci          = new CultureInfo(CultureName);

            if (ci.NumberFormat.NumberDecimalSeparator != ".")
            {
                // Forcing use of decimal separator for numerical values
                ci.NumberFormat.NumberDecimalSeparator = ".";
                Thread.CurrentThread.CurrentCulture    = ci;
                Thread.CurrentThread.CurrentUICulture  = ci;
            }

            //Construct our taskbar icon
            taskBar.Icon                  = Properties.Resources.AppIcon;
            taskBar.ToolTipText           = "BnS Multi Tool";
            taskBar.TrayMouseDoubleClick += new RoutedEventHandler(OnNotifyDoubleClick);
            taskBar.Visibility            = Visibility.Hidden;

            UpdateButtonObj = MultiTool_UPDATE;

            this.MouseDown += delegate { try { DragMove(); } catch (Exception) { } };

            try
            {
                const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
                using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey))
                {
                    if ((int)ndpKey.GetValue("Release") < 461808)
                    {
                        var dialog = new ErrorPrompt("It seems you do not have .NET Framework 4.7.2 or higher, this is required for certain features to work properly.\nPlease install it and try launching again.");
                        dialog.ShowDialog();
                        Environment.Exit(0);
                    }
                }

                if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "multitool_qol.xml")))
                {
                    File.WriteAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "multitool_qol.xml"), Properties.Resources.multitool_qol);
                }

                qol_xml = XDocument.Load(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "multitool_qol.xml"));
            }
            catch (Exception) { }

            if (File.Exists("BnS-Multi-Tool-Updater.exe"))
            {
                File.Delete("BnS-Multi-Tool-Updater.exe");
            }

            if (String.IsNullOrEmpty(SystemConfig.SYS.BNS_DIR) || !Directory.Exists(Path.Combine(SystemConfig.SYS.BNS_DIR, "bin")))
            {
                //First check the registry, see if we can find the correct path, if not prompt the user when catching the error.
                try
                {
                    RegistryKey BNS_REGISTRY = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\NCWest\BnS");

                    if (BNS_REGISTRY != null)
                    {
                        SystemConfig.SYS.BNS_DIR = BNS_REGISTRY.GetValue("BaseDir").ToString();
                        //This is a slight correction for some systems, for whatever reason they are not registering the path correctly so I have to force this backslash onto it.
                        if (SystemConfig.SYS.BNS_DIR.Last() != '\\')
                        {
                            SystemConfig.SYS.BNS_DIR += "\\";
                        }
                    }
                    else
                    {
                        BNS_REGISTRY = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\plaync\BNS_KOR");

                        if (BNS_REGISTRY == null)
                        {
                            throw new Exception("No registry entries for client");
                        }

                        SystemConfig.SYS.BNS_DIR = BNS_REGISTRY.GetValue("BaseDir").ToString();
                        if (SystemConfig.SYS.BNS_DIR.Last() != '\\')
                        {
                            SystemConfig.SYS.BNS_DIR += "\\";
                        }

                        ACCOUNT_CONFIG.ACCOUNTS.REGION   = (int)Globals.BnS_Region.KR;
                        ACCOUNT_CONFIG.ACCOUNTS.LANGUAGE = 5;
                    }

                    SystemConfig.appendChangesToConfig();

                    if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + @"\contents\"))
                    {
                        throw new Exception("Directory doesn't eixst");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("The path for Blade and Soul is not valid, please set the proper path for your game installation", "INVALID PATH");
                    using (var FOLDER = new System.Windows.Forms.FolderBrowserDialog())
                    {
                        System.Windows.Forms.DialogResult RESULT = FOLDER.ShowDialog();

                        if (RESULT == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(FOLDER.SelectedPath))
                        {
                            SystemConfig.SYS.BNS_DIR = FOLDER.SelectedPath + "\\";
                            SystemConfig.appendChangesToConfig();
                        }
                    }
                }
            }

            lstBoxUpdaterThreads.SelectedIndex = SystemConfig.SYS.UPDATER_THREADS;
            lstBoxNewGame.SelectedIndex        = SystemConfig.SYS.NEW_GAME_OPTION;
            lstBoxLauncherX.SelectedIndex      = SystemConfig.SYS.MINIMZE_ACTION;
            DeltaPatching_Checkbox.IsChecked   = (SystemConfig.SYS.DELTA_PATCHING == 1) ? true : false;
            PingCheckTick.IsChecked            = (SystemConfig.SYS.PING_CHECK == 1) ? true : false;
            BNS_LOCATION_BOX.Text = SystemConfig.SYS.BNS_DIR;
        }
Exemple #16
0
        private async Task launchNewGameClient()
        {
            try
            {
                string EMAIL     = ACCOUNT_LIST_BOX.Text;
                int    HAS_INDEX = ACTIVE_SESSIONS.FindIndex(x => x.EMAIL == EMAIL && x.REGION == REGION_BOX.SelectedIndex);
                bool   is_x86    = (BIT_BOX.SelectedIndex == 0) ? true : false;

                Process proc = new Process();
                if (is_x86)
                {
                    proc.StartInfo.FileName = Path.Combine(SystemConfig.SYS.BNS_DIR, "bin", "Client.exe");
                }
                else
                {
                    proc.StartInfo.FileName = Path.Combine(SystemConfig.SYS.BNS_DIR, "bin64", "Client.exe");
                }

                //Arugments passed to Client.exe
                if (REGION_BOX.SelectedIndex >= 2)
                {
                    //Other Regions (TW / KR)
                    proc.StartInfo.Arguments = String.Format(@"/sesskey /LaunchByLauncher -unattended {0} {1} {2} {3}",
                                                             (((bool)NOTEXTURE_STREAMING.IsChecked) ? "-NOTEXTURESTREAMING " : ""), (((bool)USE_ALL_CORES.IsChecked) ? "-USEALLAVAILABLECORES " : ""), ((bool)useLastChar.IsChecked) ? "-CHARLAST" : "", cmdParams.Text);
                }
                else
                {
                    //NA & EU Region
                    proc.StartInfo.Arguments = String.Format(@"/sesskey /LaunchByLauncher -lang:{0} -region:{1} -unattended {2} {3} {4} {5}",
                                                             languageFromSelection(), REGION_BOX.SelectedIndex, (((bool)NOTEXTURE_STREAMING.IsChecked) ? "-NOTEXTURESTREAMING " : ""), (((bool)USE_ALL_CORES.IsChecked) ? "-USEALLAVAILABLECORES " : ""), ((bool)useLastChar.IsChecked) ? "-CHARLAST" : "", cmdParams.Text);
                }

                //We need to limit the password down to 16 characters as NCSoft password limit is technically 16 and trims off everything after 16, only know of it being a problem in NA/EU not sure about TW
                string pw = REGION_BOX.SelectedIndex != 2 ? ACCOUNT_CONFIG.ACCOUNTS.Saved[ACCOUNT_SELECTED_INDEX].PASSWORD.Truncate(16) : ACCOUNT_CONFIG.ACCOUNTS.Saved[ACCOUNT_SELECTED_INDEX].PASSWORD;

                //Setup environment variables for loginhelper
                proc.StartInfo.UseShellExecute = false; //Required for setting environment variables to processes
                proc.StartInfo.EnvironmentVariables.Add("BNS_PROFILE_USERNAME", ACCOUNT_CONFIG.ACCOUNTS.Saved[ACCOUNT_SELECTED_INDEX].EMAIL);
                proc.StartInfo.EnvironmentVariables.Add("BNS_PROFILE_PASSWORD", pw);
                proc.StartInfo.EnvironmentVariables.Add("BNS_PINCODE", ACCOUNT_CONFIG.ACCOUNTS.Saved[ACCOUNT_SELECTED_INDEX].PINCODE);

                if (MainWindow.qol_xml.XPathSelectElements("config/options/option[@enable='1']").Count() > 0 || MainWindow.qol_xml.XPathSelectElement("config/gcd").Attribute("enable").Value == "1")
                {
                    await QOL_PLUGIN_CHECK(); //Check version on launch
                }
                //Check if region is not NA / EU if so check if bnsnogg.dll is installed
                if (REGION_BOX.SelectedIndex >= 2)
                {
                    if (!File.Exists(Path.Combine(is_x86 ? plugins_x86 : plugins_x64, "bnsnogg.dll")))
                    {
                        throw new Exception(String.Format("Your region has an anti-cheat and requires bnsnogg.dll, it is missing from {0} version", is_x86 ? "32-bit" : "64-bit"));
                    }
                }

                //All checks out, start process
                proc.Start();

                //New code for settings option.
                switch (SystemConfig.SYS.NEW_GAME_OPTION)
                {
                case 1:
                    Application.Current.MainWindow.WindowState = WindowState.Minimized;
                    break;

                case 2:
                    MainWindow.changeWindowState(false, true);
                    break;

                case 3:
                    Environment.Exit(0);
                    break;
                }

                if (HAS_INDEX == -1)
                {
                    ACTIVE_SESSIONS.Add(new SESSION_LIST()
                    {
                        EMAIL = EMAIL, REGION = REGION_BOX.SelectedIndex, PROCESS = proc
                    });

                    if (ACTIVE_SESSIONS.Count == 1 && !monitorProcesses.IsBusy)
                    {
                        monitorProcesses.RunWorkerAsync(); //Start our worker thread.
                    }
                    ProcessInfo.Items.Add(String.Format("{0} - {1}", EMAIL, getSelectedRegion(REGION_BOX.SelectedIndex)));
                }
                else
                {
                    ACTIVE_SESSIONS[HAS_INDEX].PROCESS = proc;
                }
            } catch (Exception ex)
            {
                var dialog = new ErrorPrompt(ex.Message);
                dialog.ShowDialog();
            }

            GC.Collect();
        }
        private void launchNewGameClient()
        {
            try
            {
                string EMAIL     = ACCOUNT_LIST_BOX.Text;
                int    HAS_INDEX = ACTIVE_SESSIONS.FindIndex(x => x.EMAIL == EMAIL && x.REGION == REGION_BOX.SelectedIndex);
                bool   is_x86    = (BIT_BOX.SelectedIndex == 0) ? true : false;

                if (HAS_INDEX == -1)
                {
                    Process proc = new Process();
                    if (is_x86)
                    {
                        proc.StartInfo.FileName = SystemConfig.SYS.BNS_DIR + @"\bin\Client.exe";
                    }
                    else
                    {
                        proc.StartInfo.FileName = SystemConfig.SYS.BNS_DIR + @"\bin64\Client.exe";
                    }

                    //Arugments passed to Client.exe
                    proc.StartInfo.Arguments = String.Format(@"/sesskey /launchbylauncher -lang:{0} -region:{1} -unattended {2} {3}",
                                                             languageFromSelection(), REGION_BOX.SelectedIndex, (((bool)NOTEXTURE_STREAMING.IsChecked) ? "-NOTEXTURESTREAMIN " : ""), (((bool)USE_ALL_CORES.IsChecked) ? "-USEALLAVAILABLECORE " : ""));

                    //Setup environment variables for loginhelper
                    proc.StartInfo.EnvironmentVariables.Add("BNS_PROFILE_USERNAME", ACCOUNT_CONFIG.ACCOUNTS.Saved[ACCOUNT_SELECTED_INDEX].EMAIL);
                    proc.StartInfo.EnvironmentVariables.Add("BNS_PROFILE_PASSWORD", ACCOUNT_CONFIG.ACCOUNTS.Saved[ACCOUNT_SELECTED_INDEX].PASSWORD);
                    proc.StartInfo.EnvironmentVariables.Add("BNS_PINCODE", ACCOUNT_CONFIG.ACCOUNTS.Saved[ACCOUNT_SELECTED_INDEX].PINCODE);
                    proc.StartInfo.EnvironmentVariables.Add("AUTO_BAIT", ((bool)BaitBasketToS.IsChecked) ? "1" : "0");
                    proc.StartInfo.EnvironmentVariables.Add("RAISE_LIMIT", ((bool)RaiseCapToS.IsChecked) ? "1" : "0");
                    proc.StartInfo.UseShellExecute = false; //Required for setting environment variables to processes
                    //proc.StartInfo.Verb = "runas"; //Launching as admin.. Do I really need this? Or am I dumb?
                    proc.Start();

                    if ((bool)BaitBasketToS.IsChecked || (bool)RaiseCapToS.IsChecked)
                    {
                        if (is_x86)
                        {
                            File.WriteAllBytes(Path.GetTempPath() + @"\BnS-ToS-x86.exe", Properties.Resources.BnS_ToS_x86);

                            ProcessStartInfo tosproc = new ProcessStartInfo();
                            tosproc.FileName = Path.GetTempPath() + @"\BnS-ToS-x86.exe";
                            tosproc.Verb     = "runas";
                            Process.Start(tosproc);
                        }
                        else
                        {
                            File.WriteAllBytes(Path.GetTempPath() + @"\BnS-ToS-x64.exe", Properties.Resources.BnS_ToS_x64);

                            ProcessStartInfo tosproc = new ProcessStartInfo();
                            tosproc.FileName = Path.GetTempPath() + @"\BnS-ToS-x64.exe";
                            tosproc.Verb     = "runas";
                            Process.Start(tosproc);
                        }
                    }

                    ACTIVE_SESSIONS.Add(new SESSION_LIST()
                    {
                        EMAIL = EMAIL, REGION = REGION_BOX.SelectedIndex, PROCESS = proc
                    });

                    if (ACTIVE_SESSIONS.Count == 1)
                    {
                        monitorProcesses.RunWorkerAsync(); //Start our worker thread.
                    }
                    ProcessInfo.Items.Add(String.Format("{0} - {1}", EMAIL, (REGION_BOX.SelectedIndex == 0) ? "NA" : "EU"));
                }
            } catch (Exception ex)
            {
                var dialog = new ErrorPrompt(ex.Message);
                dialog.ShowDialog();
            }
        }
        static SystemConfig()
        {
            string[] ihatemylife = new string[] { "00009393.upk", "00010869.upk", "00009812.upk", "00003814.upk", "00007242.upk", "00008904.upk", "00024690.upk", "00059534.upk", "00010772.upk", "00011949.upk", "00012009.upk", "00026129.upk", "00061144.upk" };

            if (!File.Exists(CONFIG_FILE))
            {
                SYS = new SYSConfig
                {
                    VERSION            = "3.2.2",
                    FINGERPRINT        = null,
                    ADDITIONAL_EFFECTS = 0,
                    PATCH_310          = 0,
                    BNS_DIR            = "",
                    MAIN_UPKS          = ihatemylife,
                    DELTA_PATCHING     = 1,
                    NEW_GAME_OPTION    = 0,
                    UPDATER_THREADS    = 0,
                    MINIMZE_ACTION     = 1,
                    PING_CHECK         = 1,
                    patch32            = 1,
                    patch64            = 1,
                    CLASSES            = new List <BNS_CLASS_STRUCT>
                    {
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Assassin",
                            EFFECTS    = new string[] { "00010504.upk", "00060553.upk", "00069254.upk" },
                            ANIMATIONS = new string[] { "00007916.upk", "00056572.upk", "00068516.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Summoner",
                            EFFECTS    = new string[] { "00006660.upk", "00060554.upk", "00080169.upk" },
                            ANIMATIONS = new string[] { "00007917.upk", "00056573.upk", "00080266.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "KungFuMaster",
                            EFFECTS    = new string[] { "00060549.upk", "00010771.upk", "00064821.upk" },
                            ANIMATIONS = new string[] { "00007912.upk", "00056568.upk", "00064820.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Gunslinger",
                            EFFECTS    = new string[] { "00007307.upk", "00060552.upk" },
                            ANIMATIONS = new string[] { "00007915.upk", "00056571.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Destroyer",
                            EFFECTS    = new string[] { "00008841.upk", "00060551.upk", "00067307.upk" },
                            ANIMATIONS = new string[] { "00007914.upk", "00056570.upk", "00068515.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Forcemaster",
                            EFFECTS    = new string[] { "00009801.upk", "00060550.upk", "00072638.upk" },
                            ANIMATIONS = new string[] { "00007913.upk", "00056569.upk", "00068626.upk", "00068628.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Soulfighter",
                            EFFECTS    = new string[] { "00034433.upk", "00060557.upk" },
                            ANIMATIONS = new string[] { "00034408.upk", "00056576.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Archer",
                            EFFECTS    = new string[] { "00064738.upk", "00068166.upk" },
                            ANIMATIONS = new string[] { "00064736.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Blademaster",
                            EFFECTS    = new string[] { "00010354.upk", "00013263.upk", "00060548.upk" },
                            ANIMATIONS = new string[] { "00007911.upk", "00056567.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Bladedancer",
                            EFFECTS    = new string[] { "00031769.upk", "00060555.upk", "00072644.upk", "00072646.upk" },
                            ANIMATIONS = new string[] { "00018601.upk", "00056574.upk", "00078303.upk", "00078533.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Warlock",
                            EFFECTS    = new string[] { "00023411.upk", "00023412.upk", "00060556.upk", "00060729.upk" },
                            ANIMATIONS = new string[] { "00023439.upk", "00056575.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Warden",
                            EFFECTS    = new string[] { "00056127.upk", "00060558.upk", "00020753.upk" },
                            ANIMATIONS = new string[] { "00056577.upk", "00056126.upk", "00056566.upk" }
                        },
                        new BNS_CLASS_STRUCT()
                        {
                            CLASS      = "Astromancer",
                            EFFECTS    = new string[] { "00072639.upk", "00072642.upk" },
                            ANIMATIONS = new string[] { "00076159.upk", "00069237.upk", "00069238.upk" }
                        }
                    }
                };

                string _JSON = JsonConvert.SerializeObject(SYS, Formatting.Indented);
                File.WriteAllText(CONFIG_FILE, _JSON);
            }
            else
            {
                try
                {
                    string _JSON = File.ReadAllText(CONFIG_FILE);
                    SYS = JsonConvert.DeserializeObject <SYSConfig>(_JSON);

                    //This whole section is for patching older clients, eventually will remove.
                    if (SYS.CLASSES == null)
                    {
                        SYS.CLASSES = new List <BNS_CLASS_STRUCT>()
                        {
                        }
                    }
                    ;

                    //Hotfix
                    if (SYS.CLASSES.Count < 1)
                    {
                        SYS.CLASSES = new List <BNS_CLASS_STRUCT>
                        {
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Assassin",
                                EFFECTS    = new string[] { "00010504.upk", "00060553.upk", "00069254.upk" },
                                ANIMATIONS = new string[] { "00007916.upk", "00056572.upk", "00068516.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Summoner",
                                EFFECTS    = new string[] { "00006660.upk", "00060554.upk", "00080169.upk" },
                                ANIMATIONS = new string[] { "00007917.upk", "00056573.upk", "00080266.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "KungFuMaster",
                                EFFECTS    = new string[] { "00060549.upk", "00010771.upk", "00064821.upk" },
                                ANIMATIONS = new string[] { "00007912.upk", "00056568.upk", "00064820.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Gunslinger",
                                EFFECTS    = new string[] { "00007307.upk", "00060552.upk" },
                                ANIMATIONS = new string[] { "00007915.upk", "00056571.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Destroyer",
                                EFFECTS    = new string[] { "00008841.upk", "00060551.upk", "00067307.upk" },
                                ANIMATIONS = new string[] { "00007914.upk", "00056570.upk", "00068515.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Forcemaster",
                                EFFECTS    = new string[] { "00009801.upk", "00060550.upk", "00072638.upk" },
                                ANIMATIONS = new string[] { "00007913.upk", "00056569.upk", "00068626.upk", "00068628.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Soulfighter",
                                EFFECTS    = new string[] { "00034433.upk", "00060557.upk" },
                                ANIMATIONS = new string[] { "00034408.upk", "00056576.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Archer",
                                EFFECTS    = new string[] { "00064738.upk", "00068166.upk" },
                                ANIMATIONS = new string[] { "00064736.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Blademaster",
                                EFFECTS    = new string[] { "00010354.upk", "00013263.upk", "00060548.upk" },
                                ANIMATIONS = new string[] { "00007911.upk", "00056567.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Bladedancer",
                                EFFECTS    = new string[] { "00031769.upk", "00060555.upk", "00072644.upk", "00072646.upk" },
                                ANIMATIONS = new string[] { "00018601.upk", "00056574.upk", "00078303.upk", "00078533.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Warlock",
                                EFFECTS    = new string[] { "00023411.upk", "00023412.upk", "00060556.upk", "00060729.upk" },
                                ANIMATIONS = new string[] { "00023439.upk", "00056575.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Warden",
                                EFFECTS    = new string[] { "00056127.upk", "00060558.upk", "00020753.upk" },
                                ANIMATIONS = new string[] { "00056577.upk", "00056126.upk", "00056566.upk" }
                            },
                            new BNS_CLASS_STRUCT()
                            {
                                CLASS      = "Astromancer",
                                EFFECTS    = new string[] { "00072639.upk", "00072642.upk" },
                                ANIMATIONS = new string[] { "00076159.upk", "00069237.upk", "00069238.upk" }
                            }
                        };
                    }

                    if (SYS.PATCH_321 == 0)
                    {
                        int ind = SYS.CLASSES.FindIndex(x => x.CLASS == "Summoner");
                        if (ind != -1)
                        {
                            SYS.CLASSES[ind].EFFECTS    = new string[] { "00006660.upk", "00060554.upk", "00080169.upk" };
                            SYS.CLASSES[ind].ANIMATIONS = new string[] { "00007917.upk", "00056573.upk", "00080266.upk" };
                            SYS.PATCH_321 = 1;
                        }
                    }

                    if (SYS.PATCH_310 == 0)
                    {
                        int ind = SYS.CLASSES.FindIndex(x => x.CLASS == "Bladedancer");
                        if (ind != -1)
                        {
                            SYS.CLASSES[ind].EFFECTS    = new string[] { "00031769.upk", "00060555.upk", "00072644.upk", "00072646.upk" };
                            SYS.CLASSES[ind].ANIMATIONS = new string[] { "00018601.upk", "00056574.upk", "00078303.upk", "00078533.upk" };
                        }
                        SYS.PING_CHECK     = 1;
                        SYS.DELTA_PATCHING = 1;

                        //Patch use-ingame-login.xml with KR entry and syntax fix.
                        string xml_path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "patches", "use-ingame-login.xml");

                        if (File.Exists(xml_path))
                        {
                            File.Delete(xml_path);
                            File.WriteAllText(xml_path, Properties.Resources.use_ingame_login);
                        }
                    }

                    appendChangesToConfig();
                } catch (Exception)
                {
                    var dialog = new ErrorPrompt("There was an error reading the config file: settings.json\rIf error persists delete settings.json or check for syntax errors.");
                    dialog.ShowDialog();
                    Environment.Exit(0);
                }
            }
        }