private void onlineUsers_Tick(object sender, EventArgs e) { WebClient client = new WebClient(); int usersOnline = 0; Debug.WriteLine("Getting Tick"); try { string stringnumber = client.DownloadString(String.Format("http://tonic.pw/files/bnsmultitool/usersOnline.php?UID={0}", SystemConfig.SYS.FINGERPRINT)); if (!(int.TryParse(stringnumber, out usersOnline))) { usersOnline = 0; } } catch (WebException ex) { Debug.WriteLine(ex.Message); } finally { client.Dispose(); } Dispatchers.labelContent(usersOnlineLbl, String.Format("Users Online: {0}", (usersOnline != 0) ? usersOnline.ToString() : "Error")); }
private void refreshSomeShit() { //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")); }
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 } }
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(); }