Exemplo n.º 1
0
        private void DisableEffects(object sender, DoWorkEventArgs e)
        {
            ProgressControl.errorSadPeepo(Visibility.Hidden);
            ProgressControl.updateProgressLabel("Removing Effects");
            Thread.Sleep(500);

            if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + @"\contents\bns\CookedPC\"))
            {
                ProgressControl.errorSadPeepo(Visibility.Visible);
                ProgressControl.updateProgressLabel("Blade and Soul path is not valid");
                Thread.Sleep(5000);
                return;
            }
            else if (SystemConfig.SYS.UPK_DIR == "")
            {
                ProgressControl.errorSadPeepo(Visibility.Visible);
                ProgressControl.updateProgressLabel("UPK Backup directory is not set!");
                Thread.Sleep(5000);
                return;
            }

            if (!Directory.Exists(SystemConfig.SYS.UPK_DIR))
            {
                ProgressControl.errorSadPeepo(Visibility.Visible);
                ProgressControl.updateProgressLabel("Path for backing up UPK's doesn't exist");
                Thread.Sleep(5000);
                return;
            }

            foreach (string UPK in SystemConfig.SYS.MAIN_UPKS)
            {
                string _SOURCE = SystemConfig.SYS.BNS_DIR + "\\contents\\bns\\CookedPC\\" + UPK;
                string _DEST   = SystemConfig.SYS.UPK_DIR + "\\" + UPK;

                ProgressControl.updateProgressLabel(String.Format("Checking for {0}", UPK));
                if (File.Exists(_SOURCE))
                {
                    if (File.Exists(_DEST))
                    {
                        File.Delete(_DEST);
                    }

                    ProgressControl.updateProgressLabel(String.Format("Removing {0}", UPK));
                    File.Move(_SOURCE, _DEST);
                }

                Thread.Sleep(50);
            }

            if (SystemConfig.SYS.ADDITIONAL_EFFECTS == 1)
            {
                foreach (string UPK in SystemConfig.SYS.ADDITIONAL_UPKS)
                {
                    string _SOURCE = SystemConfig.SYS.BNS_DIR + "\\contents\\bns\\CookedPC\\" + UPK;
                    string _DEST   = SystemConfig.SYS.UPK_DIR + "\\" + UPK;
                    ProgressControl.updateProgressLabel(String.Format("Checking for {0}", UPK));

                    if (File.Exists(_SOURCE))
                    {
                        if (File.Exists(_DEST))
                        {
                            File.Delete(_DEST);
                        }

                        ProgressControl.updateProgressLabel(String.Format("Removing {0}", UPK));
                        File.Move(_SOURCE, _DEST);
                    }

                    Thread.Sleep(50);
                }
            }
        }
Exemplo n.º 2
0
        private async void installLoginHelperClick(object sender, RoutedEventArgs e)
        {
            _progressControl        = new ProgressControl();
            ProgressGrid.Visibility = Visibility.Visible;
            MainGrid.Visibility     = Visibility.Collapsed;
            ProgressPanel.Children.Add(_progressControl);

            string pluginName = "loginhelper";

            if (((Button)sender).Name.Contains("CHARSELECT"))
            {
                pluginName = "charselect";
            }

            await Task.Run(async() =>
            {
                try
                {
                    if (!Directory.Exists("modpolice"))
                    {
                        Directory.CreateDirectory("modpolice");
                    }

                    ProgressControl.updateProgressLabel("Logging into Mega anonymously...");
                    var client = new MegaApiClient();
                    await client.LoginAnonymousAsync();

                    if (!Directory.Exists("modpolice"))
                    {
                        Directory.CreateDirectory("modpolice");
                    }

                    ProgressControl.updateProgressLabel("Retrieving file list...");
                    IEnumerable <INode> nodes = await client.GetNodesFromLinkAsync(new Uri("https://mega.nz/folder/4EUF2IhL#Ci1Y-sbbyw7nwwMGvHV2_w"));

                    INode currentNode           = null;
                    IProgress <double> progress = new Progress <double>(x => ProgressControl.updateProgressLabel(String.Format("Downloading: {0} ({1}%)", currentNode.Name, Math.Round(x))));

                    //Find our latest nodes for download
                    INode loginhelper_node = nodes.Where(x => x.Type == NodeType.File && x.Name.Contains(pluginName)).OrderByDescending(t => t.ModificationDate).FirstOrDefault();

                    if (loginhelper_node == null)
                    {
                        ProgressControl.errorSadPeepo(Visibility.Visible);
                        ProgressControl.updateProgressLabel("Something went wrong getting the node");
                        await Task.Delay(7000);
                        return;
                    }

                    if (File.Exists(@"modpolice\" + loginhelper_node.Name))
                    {
                        File.Delete(@"modpolice\" + loginhelper_node.Name);
                    }

                    currentNode = loginhelper_node;
                    await client.DownloadFileAsync(currentNode, @"modpolice\" + loginhelper_node.Name, progress);

                    ProgressControl.updateProgressLabel("Unzipping: " + loginhelper_node.Name);
                    await Task.Delay(750);
                    Modpolice.ExtractZipFileToDirectory(@".\modpolice\" + loginhelper_node.Name, @".\modpolice", true);

                    ProgressControl.updateProgressLabel("Installing " + pluginName + " x86");
                    await Task.Delay(750);

                    if (!Directory.Exists(plugins_x86))
                    {
                        Directory.CreateDirectory(plugins_x86);
                    }

                    ProgressControl.updateProgressLabel("Installing " + pluginName + " x86");
                    if (File.Exists(Path.Combine(plugins_x86, pluginName + ".dll")))
                    {
                        File.Delete(Path.Combine(plugins_x86, pluginName + ".dll"));
                    }

                    File.Move(@".\modpolice\bin\plugins\" + pluginName + ".dll", Path.Combine(plugins_x86, pluginName + ".dll"));

                    ProgressControl.updateProgressLabel("Installing " + pluginName + " x64");
                    await Task.Delay(750);

                    if (!Directory.Exists(plugins_x64))
                    {
                        Directory.CreateDirectory(plugins_x64);
                    }

                    ProgressControl.updateProgressLabel("Installing " + pluginName + " x64");
                    if (File.Exists(Path.Combine(plugins_x64, pluginName + ".dll")))
                    {
                        File.Delete(Path.Combine(plugins_x64, pluginName + ".dll"));
                    }

                    File.Move(@".\modpolice\bin64\plugins\" + pluginName + ".dll", Path.Combine(plugins_x64, pluginName + ".dll"));

                    if (pluginName == "loginhelper")
                    {
                        ProgressControl.updateProgressLabel("Searching for use-ingame-login.xml");
                        await Task.Delay(750);

                        if (!File.Exists(login_xml))
                        {
                            ProgressControl.updateProgressLabel("patches.xml not found, installing...");
                            if (!Directory.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "patches")))
                            {
                                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "patches"));
                            }

                            File.WriteAllText(login_xml, Properties.Resources.use_ingame_login);
                        }
                    }

                    ProgressControl.updateProgressLabel("All done, just tidying up.");
                    await client.LogoutAsync();
                } catch (Exception ex)
                {
                    ProgressControl.errorSadPeepo(Visibility.Visible);
                    ProgressControl.updateProgressLabel(ex.Message);
                    await Task.Delay(7000);
                }
            });

            ProgressGrid.Visibility = Visibility.Hidden;
            MainGrid.Visibility     = Visibility.Visible;
            ProgressPanel.Children.Clear();
            _progressControl = null;

            //Check if loginhelper is installed
            loginHelper_installed = (File.Exists(Path.Combine(plugins_x86, pluginName + ".dll")) && File.Exists(Path.Combine(plugins_x64, pluginName + ".dll")));
            charselect_installed  = (File.Exists(Path.Combine(plugins_x86, "charselect.dll")) && File.Exists(Path.Combine(plugins_x64, "charselect.dll")));
            await Task.Run(async() => await checkOnlineVersion());
        }
Exemplo n.º 3
0
        private async void installModPolice(object sender, RoutedEventArgs e)
        {
            _progressControl        = new ProgressControl();
            ProgressGrid.Visibility = Visibility.Visible;
            MainGrid.Visibility     = Visibility.Collapsed;
            ProgressPanel.Children.Add(_progressControl);

            if (((Button)sender).Name == "installOnline")
            {
                try
                {
                    ProgressControl.updateProgressLabel("Logging into Mega anonymously...");
                    var client = new MegaApiClient();
                    await client.LoginAnonymousAsync();

                    if (!Directory.Exists("modpolice"))
                    {
                        Directory.CreateDirectory("modpolice");
                    }

                    ProgressControl.updateProgressLabel("Retrieving file list...");
                    IEnumerable <INode> nodes = await client.GetNodesFromLinkAsync(new Uri("https://mega.nz/folder/WXhzUZ7Y#XzlqkPa8DU4X8xrILQDdZA"));

                    INode currentNode           = null;
                    IProgress <double> progress = new Progress <double>(x => ProgressControl.updateProgressLabel(String.Format("Downloading: {0} ({1}%)", currentNode.Name, Math.Round(x))));

                    //Find our latest nodes for download
                    INode bnspatch_node     = nodes.Where(x => x.Type == NodeType.File && x.Name.Contains("bnspatch")).OrderByDescending(t => t.ModificationDate).FirstOrDefault();
                    INode pluginloader_node = nodes.Where(x => x.Type == NodeType.File && x.Name.Contains("pluginloader")).OrderByDescending(t => t.ModificationDate).FirstOrDefault();

                    if (pluginloader_node == null)
                    {
                        ProgressControl.errorSadPeepo(Visibility.Visible);
                        ProgressControl.updateProgressLabel("Error retrieving pluginloader");
                    }
                    else
                    {
                        currentNode = pluginloader_node;
                        if (File.Exists(@"modpolice\" + pluginloader_node.Name))
                        {
                            File.Delete(@"modpolice\" + pluginloader_node.Name);
                        }

                        ProgressControl.errorSadPeepo(Visibility.Hidden);
                        await client.DownloadFileAsync(currentNode, @"modpolice\" + pluginloader_node.Name, progress);
                    }

                    if (pluginloader_node == null)
                    {
                        ProgressControl.errorSadPeepo(Visibility.Visible);
                        ProgressControl.updateProgressLabel("Error retrieving pluginloader");
                    }
                    else
                    {
                        currentNode = bnspatch_node;
                        if (File.Exists(@"modpolice\" + bnspatch_node.Name))
                        {
                            File.Delete(@"modpolice\" + bnspatch_node.Name);
                        }

                        ProgressControl.errorSadPeepo(Visibility.Hidden);
                        await client.DownloadFileAsync(currentNode, @"modpolice\" + bnspatch_node.Name, progress);
                    }

                    ProgressControl.updateProgressLabel("All done, logging out...");
                }
                catch (Exception ex)
                {
                    ProgressControl.errorSadPeepo(Visibility.Visible);
                    ProgressControl.updateProgressLabel(ex.Message);
                    await Task.Delay(3000);
                }
            }

            try
            {
                string _BNSPATCH_VERSION = Directory.EnumerateFiles(Environment.CurrentDirectory + @"\modpolice\").Select(x => Path.GetFileName(x))
                                           .Where(Name => Path.GetExtension(Name) == ".zip" && Name.Contains("bnspatch"))
                                           .OrderByDescending(d => new FileInfo(d).Name)
                                           .Select(Name => Path.GetFileNameWithoutExtension(Name)).First().ToString();

                string _PLUGINLOADER_VERSION = Directory.EnumerateFiles(Environment.CurrentDirectory + @"\modpolice\").Select(x => Path.GetFileName(x))
                                               .Where(Name => Path.GetExtension(Name) == ".zip" && Name.Contains("pluginloader"))
                                               .OrderByDescending(d => new FileInfo(d).Name)
                                               .Select(Name => Path.GetFileNameWithoutExtension(Name)).First().ToString();

                ProgressControl.updateProgressLabel("Unzipping " + _PLUGINLOADER_VERSION);
                ExtractZipFileToDirectory(@".\modpolice\" + _PLUGINLOADER_VERSION + ".zip", @".\modpolice", true);

                await Task.Delay(750);

                ProgressControl.updateProgressLabel("Unzipping " + _BNSPATCH_VERSION);
                ExtractZipFileToDirectory(@".\modpolice\" + _BNSPATCH_VERSION + ".zip", @".\modpolice", true);

                //pluginloader x86
                if (File.Exists(SystemConfig.SYS.BNS_DIR + bin_x86 + "winmm.dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + bin_x86 + "winmm.dll");
                }

                ProgressControl.updateProgressLabel("Installing pluginloader x86");
                await Task.Delay(750);

                File.Move(@".\modpolice\bin\winmm.dll", SystemConfig.SYS.BNS_DIR + bin_x86 + "winmm.dll");

                //pluginloader x64
                if (File.Exists(SystemConfig.SYS.BNS_DIR + bin_x64 + "winmm.dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + bin_x64 + "winmm.dll");
                }

                ProgressControl.updateProgressLabel("Installing pluginloader x64");
                await Task.Delay(750);

                File.Move(@".\modpolice\bin64\winmm.dll", SystemConfig.SYS.BNS_DIR + bin_x64 + "winmm.dll");

                //bnspatch x86
                ProgressControl.updateProgressLabel("Checking if plugins folder exists for x86");
                await Task.Delay(500);

                if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + plugins_x86))
                {
                    Directory.CreateDirectory(SystemConfig.SYS.BNS_DIR + plugins_x86);
                }

                ProgressControl.updateProgressLabel("Installing bnspatch x86");
                if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnspatch.dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnspatch.dll");
                }

                File.Move(@".\modpolice\bin\plugins\bnspatch.dll", SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnspatch.dll");

                //bnspatch x64
                ProgressControl.updateProgressLabel("Checking if plugins folder exists for x64");
                await Task.Delay(500);

                if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + plugins_x64))
                {
                    Directory.CreateDirectory(SystemConfig.SYS.BNS_DIR + plugins_x64);
                }

                ProgressControl.updateProgressLabel("Installing bnspatch x64");
                if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnspatch.dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnspatch.dll");
                }

                File.Move(@".\modpolice\bin64\plugins\bnspatch.dll", SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnspatch.dll");

                ProgressControl.updateProgressLabel("Searching for patches.xml");
                await Task.Delay(500);

                if (!File.Exists(patches_xml))
                {
                    ProgressControl.updateProgressLabel("patches.xml not found, installing...");
                    File.WriteAllText(patches_xml, Properties.Resources.patches);
                }

                ProgressControl.updateProgressLabel("pluginloader & bnspatch successfully installed");
                await Task.Delay(2000);
            } catch (Exception ex)
            {
                ProgressControl.errorSadPeepo(Visibility.Visible);
                ProgressControl.updateProgressLabel(ex.Message);
                await Task.Delay(7000);
            }

            try
            {
                ProgressGrid.Visibility = Visibility.Hidden;
                MainGrid.Visibility     = Visibility.Visible;
                ProgressPanel.Children.Clear();
                _progressControl = null;

                //Get the file info and display version for pluginloader
                pluginloader = new pluginFileInfo(SystemConfig.SYS.BNS_DIR + @"\bin\" + "winmm.dll");
                Dispatchers.labelContent(pluginloaderLabel, String.Format("Current: {0}", (pluginloader != null) ? pluginloader.modificationTime.ToString("MM-dd-yy") : "Not Installed"));

                bnspatchPlugin = new pluginFileInfo(SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnspatch.dll");
                Dispatchers.labelContent(bnspatchLabel, String.Format("Current: {0}", (bnspatchPlugin != null) ? bnspatchPlugin.modificationTime.ToString("MM-dd-yy") : "Not Installed"));
            } catch (Exception)
            {
                //Why are we here, is it just to suffer?
            }
            //refreshSomeShit();
        }
Exemplo n.º 4
0
        private async void installBNSNOGG(object sender, RoutedEventArgs e)
        {
            _progressControl        = new ProgressControl();
            ProgressGrid.Visibility = Visibility.Visible;
            MainGrid.Visibility     = Visibility.Collapsed;
            ProgressPanel.Children.Add(_progressControl);

            try
            {
                ProgressControl.updateProgressLabel("Logging into Mega anonymously...");
                var client = new MegaApiClient();
                await client.LoginAnonymousAsync();

                if (!Directory.Exists("modpolice"))
                {
                    Directory.CreateDirectory("modpolice");
                }

                ProgressControl.updateProgressLabel("Retrieving file list...");
                IEnumerable <INode> nodes = await client.GetNodesFromLinkAsync(new Uri("https://mega.nz/folder/WXhzUZ7Y#XzlqkPa8DU4X8xrILQDdZA"));

                INode currentNode           = null;
                IProgress <double> progress = new Progress <double>(x => ProgressControl.updateProgressLabel(String.Format("Downloading: {0} ({1}%)", currentNode.Name, Math.Round(x))));

                //Find our latest nodes for download
                INode bnsnogg_node = nodes.Where(x => x.Type == NodeType.File && x.Name.Contains("bnsnogg")).OrderByDescending(t => t.ModificationDate).FirstOrDefault();

                if (bnsnogg_node == null)
                {
                    ProgressControl.errorSadPeepo(Visibility.Visible);
                    ProgressControl.updateProgressLabel("Error retrieving pluginloader");
                }
                else
                {
                    currentNode = bnsnogg_node;
                    if (File.Exists(@"modpolice\" + bnsnogg_node.Name))
                    {
                        File.Delete(@"modpolice\" + bnsnogg_node.Name);
                    }

                    ProgressControl.errorSadPeepo(Visibility.Hidden);
                    await client.DownloadFileAsync(currentNode, @"modpolice\" + bnsnogg_node.Name, progress);
                }

                ProgressControl.updateProgressLabel("All done, logging out...");

                string _BNSNOGG_VERSION = Directory.EnumerateFiles(Environment.CurrentDirectory + @"\modpolice\").Select(x => Path.GetFileName(x))
                                          .Where(Name => Path.GetExtension(Name) == ".zip" && Name.Contains("bnsnogg"))
                                          .OrderByDescending(d => new FileInfo(d).Name)
                                          .Select(Name => Path.GetFileNameWithoutExtension(Name)).First().ToString();

                ProgressControl.updateProgressLabel("Unzipping " + _BNSNOGG_VERSION);
                ExtractZipFileToDirectory(@".\modpolice\" + _BNSNOGG_VERSION + ".zip", @".\modpolice", true);

                //pluginloader x86
                if (File.Exists(SystemConfig.SYS.BNS_DIR + bin_x86 + "version.dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + bin_x86 + "version.dll");
                }

                ProgressControl.updateProgressLabel("Installing bnsnogg x86");
                await Task.Delay(750);

                File.Move(@".\modpolice\bin\version.dll", SystemConfig.SYS.BNS_DIR + bin_x86 + "version.dll");

                //pluginloader x64
                if (File.Exists(SystemConfig.SYS.BNS_DIR + bin_x64 + "version.dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + bin_x64 + "version.dll");
                }

                ProgressControl.updateProgressLabel("Installing bnsnogg x64");
                await Task.Delay(750);

                File.Move(@".\modpolice\bin64\version.dll", SystemConfig.SYS.BNS_DIR + bin_x64 + "version.dll");

                if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + plugins_x86))
                {
                    Directory.CreateDirectory(SystemConfig.SYS.BNS_DIR + plugins_x86);
                }

                if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnsnogg.dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnsnogg.dll");
                }

                File.Move(@".\modpolice\bin\plugins\bnsnogg.dll", SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnsnogg.dll");

                if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + plugins_x64))
                {
                    Directory.CreateDirectory(SystemConfig.SYS.BNS_DIR + plugins_x64);
                }

                if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnsnogg.dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnsnogg.dll");
                }

                File.Move(@".\modpolice\bin64\plugins\bnsnogg.dll", SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnsnogg.dll");

                ProgressControl.updateProgressLabel("bnsnogg successfully installed");
                await Task.Delay(2000);
            }
            catch (Exception ex)
            {
                ProgressControl.errorSadPeepo(Visibility.Visible);
                ProgressControl.updateProgressLabel(ex.Message);
                await Task.Delay(7000);
            }

            try
            {
                ProgressGrid.Visibility = Visibility.Hidden;
                MainGrid.Visibility     = Visibility.Visible;
                ProgressPanel.Children.Clear();
                _progressControl = null;

                bnsnoggPlugin = new pluginFileInfo(SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnsnogg.dll");
                Dispatchers.labelContent(bnsnogglocalLabel, String.Format("Current: {0}", (bnsnoggPlugin != null) ? bnsnoggPlugin.modificationTime.ToString("MM-dd-yy") : "Not Installed"));
            }
            catch (Exception)
            {
                //Why are we here, is it just to suffer?
            }
        }
Exemplo n.º 5
0
        private async void installAdditional(object sender, RoutedEventArgs e)
        {
            string pluginName;

            switch (((Button)sender).Name)
            {
            case "simplemodeInstall":
                pluginName = "simplemodetrainingroom";
                break;

            case "lessloadingInstall":
                pluginName = "lessloadingscreens";
                break;

            default:
                pluginName = "highpriority";
                break;
            }

            toggleControl           = false;
            _progressControl        = new ProgressControl();
            ProgressGrid.Visibility = Visibility.Visible;
            MainGrid.Visibility     = Visibility.Collapsed;
            ProgressPanel.Children.Add(_progressControl);

            try
            {
                if (!Directory.Exists("modpolice"))
                {
                    Directory.CreateDirectory("modpolice");
                }

                ProgressControl.updateProgressLabel("Logging into Mega");
                var client = new MegaApiClient();
                await client.LoginAnonymousAsync();

                ProgressControl.updateProgressLabel("Retrieving file list...");
                IEnumerable <INode> nodes = await client.GetNodesFromLinkAsync(new Uri("https://mega.nz/folder/WXhzUZ7Y#XzlqkPa8DU4X8xrILQDdZA"));

                INode currentNode           = null;
                IProgress <double> progress = new Progress <double>(x => ProgressControl.updateProgressLabel(String.Format("Downloading: {0} ({1}%)", currentNode.Name, Math.Round(x))));
                INode pluginNode            = nodes.Where(x => x.Type == NodeType.File && x.Name.Contains(pluginName)).OrderByDescending(t => t.ModificationDate).FirstOrDefault();

                if (pluginNode == null)
                {
                    ProgressControl.errorSadPeepo(Visibility.Visible);
                    ProgressControl.updateProgressLabel("Something went wrong getting the node");
                    await Task.Delay(5000);

                    toggleControl = true;
                    return;
                }

                if (File.Exists(@"modpolice\" + pluginNode.Name))
                {
                    File.Delete(@"modpolice\" + pluginNode.Name);
                }

                currentNode = pluginNode;
                await client.DownloadFileAsync(currentNode, @"modpolice\" + pluginNode.Name, progress);

                ProgressControl.updateProgressLabel("Unzipping: " + pluginNode.Name);
                await Task.Delay(750);

                Modpolice.ExtractZipFileToDirectory(@".\modpolice\" + pluginNode.Name, @".\modpolice", true);

                ProgressControl.updateProgressLabel("Installing " + pluginName + " x86");
                await Task.Delay(750);

                if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + plugins_x86))
                {
                    Directory.CreateDirectory(SystemConfig.SYS.BNS_DIR + plugins_x86);
                }

                //Delete the current plugin dll
                if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x86 + pluginName + ".dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x86 + pluginName + ".dll");
                }

                //Make sure there isn't a plugin dll that is in an off state
                if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x86 + pluginName + ".dll.off"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x86 + pluginName + ".dll.off");
                }

                File.Move(@".\modpolice\bin\plugins\" + pluginName + ".dll", SystemConfig.SYS.BNS_DIR + plugins_x86 + pluginName + ".dll");

                ProgressControl.updateProgressLabel("Installing " + pluginName + " x64");
                await Task.Delay(750);

                if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + plugins_x64))
                {
                    Directory.CreateDirectory(SystemConfig.SYS.BNS_DIR + plugins_x64);
                }

                //Delete the current plugin dll
                if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x64 + pluginName + ".dll"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x64 + pluginName + ".dll");
                }

                //Make sure there isn't a plugin dll that is in an off state
                if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x64 + pluginName + ".dll.off"))
                {
                    File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x64 + pluginName + ".dll.off");
                }

                File.Move(@".\modpolice\bin64\plugins\" + pluginName + ".dll", SystemConfig.SYS.BNS_DIR + plugins_x64 + pluginName + ".dll");

                ProgressControl.updateProgressLabel("All done");
                await Task.Delay(750);

                await client.LogoutAsync();
            } catch (Exception ex)
            {
                ProgressControl.errorSadPeepo(Visibility.Visible);
                ProgressControl.updateProgressLabel(ex.Message);
                await Task.Delay(7000);
            }
            try
            {
                ProgressGrid.Visibility = Visibility.Hidden;
                MainGrid.Visibility     = Visibility.Visible;
                ProgressPanel.Children.Clear();
                _progressControl = null;
                toggleControl    = true;

                if (pluginName == "simplemodetrainingroom")
                {
                    simplemodeTraining = new pluginFileInfo(SystemConfig.SYS.BNS_DIR + plugins_x86 + "simplemodetrainingroom.dll");
                    Dispatchers.toggleIsChecked(simplemodeToggle, true);
                    Dispatchers.labelContent(SimplemodeCurrentLbl, String.Format("Current: {0}", (simplemodeTraining != null) ? simplemodeTraining.modificationTime.ToString("MM-dd-yy") : "Not Installed"));
                }
                else if (pluginName == "lessloadingscreens")
                {
                    lessLoadingScreen = new pluginFileInfo(SystemConfig.SYS.BNS_DIR + plugins_x86 + "lessloadingscreens.dll");
                    Dispatchers.toggleIsChecked(lessloadingToggle, true);
                    Dispatchers.labelContent(lessloadingCurrentLbl, String.Format("Current: {0}", (lessLoadingScreen != null) ? lessLoadingScreen.modificationTime.ToString("MM-dd-yy") : "Not Installed"));
                }
                else
                {
                    highpriorityplugin = new pluginFileInfo(SystemConfig.SYS.BNS_DIR + plugins_x86 + "highpriority.dll");
                    Dispatchers.toggleIsChecked(HighpriorityToggle, true);
                    Dispatchers.labelContent(HighpriorityCurrentLbl, String.Format("Current: {0}", (highpriorityplugin != null) ? highpriorityplugin.modificationTime.ToString("MM-dd-yy") : "Not Installed"));
                }

                Dispatchers.btnIsEnabled((Button)sender, false);
            } catch (Exception)
            {
                //F**K ASS C**T
            }
        }
Exemplo n.º 6
0
        private async void handleToggle(object sender, RoutedEventArgs e)
        {
            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;
            }

            Button currentToggle = (Button)sender;

            string[] upkFiles;
            string   sourceDirectory;
            string   destinationDirectory;

            bool currentState = currentToggle.Name.Contains("_on") ? true : false;

            if (currentToggle.Name.Contains("animation"))
            {
                Debug.WriteLine("Animation Toggle");
                _isInitialized = false;
                upkFiles       = SystemConfig.SYS.CLASSES.SelectMany(entries => entries.ANIMATIONS).ToArray();
                foreach (var fuckass in systemToggles)
                {
                    fuckass.animToggle.IsChecked = currentState;
                }
                _isInitialized = true;
            }
            else if (currentToggle.Name.Contains("effect"))
            {
                Debug.WriteLine("effect Toggle");
                _isInitialized = false;
                upkFiles       = SystemConfig.SYS.CLASSES.SelectMany(entries => entries.EFFECTS).ToArray();
                foreach (var fuckass in systemToggles)
                {
                    fuckass.fxToggle.IsChecked = currentState;
                }
                _isInitialized = true;
            }
            else
            {
                _isInitialized = false;

                //Put all animations and stuff into one big array, I'm sure there is a better way to do this but it's 6am and I can't be bothered to think efficient.
                upkFiles = SystemConfig.SYS.CLASSES.SelectMany(entries => entries.ANIMATIONS).ToArray();
                upkFiles = upkFiles.Concat(SystemConfig.SYS.CLASSES.SelectMany(entries => entries.EFFECTS)).ToArray();
                upkFiles = upkFiles.Concat(SystemConfig.SYS.MAIN_UPKS).ToArray();

                foreach (var fuckass in systemToggles)
                {
                    fuckass.animToggle.IsChecked = currentState;
                    fuckass.fxToggle.IsChecked   = currentState;
                }

                otherEffectsToggle.IsChecked = currentState;
                _isInitialized = true;
            }

            _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 (currentState)
            {
                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}", currentState ? "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;
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
        private async void installModPolice(object sender, RoutedEventArgs e)
        {
            _progressControl        = new ProgressControl();
            ProgressGrid.Visibility = Visibility.Visible;
            MainGrid.Visibility     = Visibility.Collapsed;
            ProgressPanel.Children.Add(_progressControl);

            try
            {
                string _BNSPATCH_VERSION = Directory.EnumerateFiles(Environment.CurrentDirectory + @"\modpolice\").Select(x => Path.GetFileName(x))
                                           .Where(Name => Path.GetExtension(Name) == ".zip" && Name.Contains("bnspatch"))
                                           .OrderByDescending(d => new FileInfo(d).Name)
                                           .Select(Name => Path.GetFileNameWithoutExtension(Name)).First().ToString();

                string _PLUGINLOADER_VERSION = Directory.EnumerateFiles(Environment.CurrentDirectory + @"\modpolice\").Select(x => Path.GetFileName(x))
                                               .Where(Name => Path.GetExtension(Name) == ".zip" && Name.Contains("pluginloader"))
                                               .OrderByDescending(d => new FileInfo(d).Name)
                                               .Select(Name => Path.GetFileNameWithoutExtension(Name)).First().ToString();

                await Task.Run(() =>
                {
                    ProgressControl.updateProgressLabel("Unzipping " + _PLUGINLOADER_VERSION);
                    ExtractZipFileToDirectory(@".\modpolice\" + _PLUGINLOADER_VERSION + ".zip", @".\modpolice", true);

                    Thread.Sleep(750);
                    ProgressControl.updateProgressLabel("Unzipping " + _BNSPATCH_VERSION);
                    ExtractZipFileToDirectory(@".\modpolice\" + _BNSPATCH_VERSION + ".zip", @".\modpolice", true);


                    //pluginloader x86
                    if (File.Exists(SystemConfig.SYS.BNS_DIR + bin_x86 + "winmm.dll"))
                    {
                        File.Delete(SystemConfig.SYS.BNS_DIR + bin_x86 + "winmm.dll");
                    }

                    ProgressControl.updateProgressLabel("Installing pluginloader x86");
                    Thread.Sleep(750);

                    File.Move(@".\modpolice\bin\winmm.dll", SystemConfig.SYS.BNS_DIR + bin_x86 + "winmm.dll");

                    //pluginloader x64
                    if (File.Exists(SystemConfig.SYS.BNS_DIR + bin_x64 + "winmm.dll"))
                    {
                        File.Delete(SystemConfig.SYS.BNS_DIR + bin_x64 + "winmm.dll");
                    }

                    ProgressControl.updateProgressLabel("Installing pluginloader x64");
                    Thread.Sleep(750);

                    File.Move(@".\modpolice\bin64\winmm.dll", SystemConfig.SYS.BNS_DIR + bin_x64 + "winmm.dll");

                    //bnspatch x86
                    ProgressControl.updateProgressLabel("Checking if plugins folder exists for x86");
                    Thread.Sleep(500);

                    if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + plugins_x86))
                    {
                        Directory.CreateDirectory(SystemConfig.SYS.BNS_DIR + plugins_x86);
                    }

                    ProgressControl.updateProgressLabel("Installing bnspatch x86");
                    if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnspatch.dll"))
                    {
                        File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnspatch.dll");
                    }

                    File.Move(@".\modpolice\bin\plugins\bnspatch.dll", SystemConfig.SYS.BNS_DIR + plugins_x86 + "bnspatch.dll");

                    //bnspatch x64
                    ProgressControl.updateProgressLabel("Checking if plugins folder exists for x64");
                    Thread.Sleep(500);

                    if (!Directory.Exists(SystemConfig.SYS.BNS_DIR + plugins_x64))
                    {
                        Directory.CreateDirectory(SystemConfig.SYS.BNS_DIR + plugins_x64);
                    }

                    ProgressControl.updateProgressLabel("Installing bnspatch x64");
                    if (File.Exists(SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnspatch.dll"))
                    {
                        File.Delete(SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnspatch.dll");
                    }

                    File.Move(@".\modpolice\bin64\plugins\bnspatch.dll", SystemConfig.SYS.BNS_DIR + plugins_x64 + "bnspatch.dll");

                    ProgressControl.updateProgressLabel("Searching for patches.xml");
                    Thread.Sleep(500);

                    if (!File.Exists(patches_xml))
                    {
                        ProgressControl.updateProgressLabel("patches.xml not found, installing...");
                        File.WriteAllText(patches_xml, Properties.Resources.patches);
                    }

                    ProgressControl.updateProgressLabel("pluginloader & bnspatch successfully installed");
                    Thread.Sleep(2000);
                });
            } catch (Exception ex)
            {
                ProgressControl.errorSadPeepo(Visibility.Visible);
                ProgressControl.updateProgressLabel(ex.Message);
                Thread.Sleep(7000);
            }

            ProgressGrid.Visibility = Visibility.Hidden;
            MainGrid.Visibility     = Visibility.Visible;
            ProgressPanel.Children.Clear();
            _progressControl = null;

            pluginloaderLabel.Content = "Plugin Loader: Installed";
            bnspatchLabel.Content     = "BNS Patch: Installed";

            refreshSomeShit();
        }
Exemplo n.º 9
0
        private async void downloadClick(object sender, RoutedEventArgs e)
        {
            _progressControl        = new ProgressControl();
            ProgressGrid.Visibility = Visibility.Visible;
            MainGrid.Visibility     = Visibility.Collapsed;
            ProgressPanel.Children.Add(_progressControl);

            await Task.Run(async() =>
            {
                try
                {
                    ProgressControl.updateProgressLabel("Logging into Mega anonymously...");
                    var client = new MegaApiClient();
                    await client.LoginAnonymousAsync();

                    if (!Directory.Exists("modpolice"))
                    {
                        Directory.CreateDirectory("modpolice");
                    }

                    ProgressControl.updateProgressLabel("Retrieving file list...");
                    IEnumerable <INode> nodes = await client.GetNodesFromLinkAsync(new Uri("https://mega.nz/folder/WXhzUZ7Y#XzlqkPa8DU4X8xrILQDdZA"));

                    INode currentNode           = null;
                    IProgress <double> progress = new Progress <double>(x => ProgressControl.updateProgressLabel(String.Format("Downloading: {0} ({1}%)", currentNode.Name, Math.Round(x))));

                    //Find our latest nodes for download
                    INode bnspatch_node     = nodes.Where(x => x.Type == NodeType.File && x.Name.Contains("bnspatch")).OrderByDescending(t => t.ModificationDate).FirstOrDefault();
                    INode pluginloader_node = nodes.Where(x => x.Type == NodeType.File && x.Name.Contains("pluginloader")).OrderByDescending(t => t.ModificationDate).FirstOrDefault();

                    if (pluginloader_node == null)
                    {
                        ProgressControl.errorSadPeepo(Visibility.Visible);
                        ProgressControl.updateProgressLabel("Errorr retrieving pluginloader");
                    }
                    else
                    {
                        currentNode = pluginloader_node;
                        if (File.Exists(@"modpolice\" + pluginloader_node.Name))
                        {
                            File.Delete(@"modpolice\" + pluginloader_node.Name);
                        }

                        ProgressControl.errorSadPeepo(Visibility.Hidden);
                        await client.DownloadFileAsync(currentNode, @"modpolice\" + pluginloader_node.Name, progress);
                    }

                    if (pluginloader_node == null)
                    {
                        ProgressControl.errorSadPeepo(Visibility.Visible);
                        ProgressControl.updateProgressLabel("Errorr retrieving pluginloader");
                    }
                    else
                    {
                        currentNode = bnspatch_node;
                        if (File.Exists(@"modpolice\" + bnspatch_node.Name))
                        {
                            File.Delete(@"modpolice\" + bnspatch_node.Name);
                        }

                        ProgressControl.errorSadPeepo(Visibility.Hidden);
                        await client.DownloadFileAsync(currentNode, @"modpolice\" + bnspatch_node.Name, progress);
                    }

                    ProgressControl.updateProgressLabel("All done, logging out...");
                    await client.LogoutAsync();
                    ProgressControl.updateProgressLabel("Peepo berry happy!");
                    Thread.Sleep(1500);
                }
                catch (Exception ex)
                {
                    ProgressControl.errorSadPeepo(Visibility.Visible);
                    ProgressControl.updateProgressLabel(ex.Message);
                    Thread.Sleep(4000);
                }
            });

            ProgressGrid.Visibility = Visibility.Hidden;
            MainGrid.Visibility     = Visibility.Visible;
            ProgressPanel.Children.Clear();
            _progressControl = null;
        }