private void DownloadFile_Click(object sender, EventArgs e) { if (Downloads.SelectedItem == null) { return; } CheatInfo selected = Downloads.SelectedItem as CheatInfo; SaveFileDialog save = new SaveFileDialog(); save.InitialDirectory = Environment.CurrentDirectory; save.Filter = "Dynamic-link library (*.dll)|*.dll"; if (save.ShowDialog() == DialogResult.OK) { try { WebClient file = new WebClient(); file.DownloadFileAsync(new Uri(selected.Path), save.FileName); cDownloadDir = save.FileName; cDownloadName = selected.Name; file.DownloadFileCompleted += new AsyncCompletedEventHandler(downloadComplete); file.DownloadProgressChanged += new DownloadProgressChangedEventHandler(downloadProgress); } catch (Exception ex) { MessageBox.Show("It seems the injector couldn't download the file\n" + "Most likely just your internet connection :/\n\nError info:\n" + ex.ToString()); } } }
private void OpenFile_Click(object sender, EventArgs e) { OpenFileDialog Browse = new OpenFileDialog() { Multiselect = true, Title = "Select a cheat", Filter = "Dynamic Linked Library (*.dll)|*.DLL|" + "All files (*.*)|*.*" }; bool sameFileMessage = false; if (Browse.ShowDialog() == DialogResult.OK) { foreach (String file in Browse.FileNames) { try { bool sameFile = false; foreach (CheatInfo current in FileList.Items) { if (file == current.Path) { sameFile = true; sameFileMessage = true; } } if (sameFile) { continue; } CheatInfo cheat = new CheatInfo(); cheat.Name = Path.GetFileNameWithoutExtension(file); cheat.Path = file; FileList.Items.Add(cheat); FileList.SetItemChecked(FileList.Items.Count - 1, true); } catch (SecurityException ex) { // The user lacks appropriate permissions to read files, discover paths, etc. MessageBox.Show("Security error. Please contact your administrator for details.\n" + "Most likely the injector can't read/write to the directory.\n\n" + "Error message: " + ex.Message + "\n\n" + "Details (send to Support):\n\n" + ex.StackTrace ); } } if (sameFileMessage) { MessageBox.Show("One more files you selected are already in the injector", "Error"); } } }
private void AddF_Click(object sender, EventArgs e) { FolderBrowserDialog Browse = new FolderBrowserDialog(); bool sameFileMessage = false; if (Browse.ShowDialog() == DialogResult.OK) { DirectoryInfo dir = new DirectoryInfo(Browse.SelectedPath); foreach (FileInfo file in dir.GetFiles("*.dll")) { try { bool sameFile = false; foreach (CheatInfo current in FileList.Items) { if (file.DirectoryName == current.Path) { sameFileMessage = true; sameFile = true; } } if (sameFile) { continue; } CheatInfo cheat = new CheatInfo(); cheat.Name = file.Name; cheat.Path = file.FullName; FileList.Items.Add(cheat); FileList.SetItemChecked(FileList.Items.Count - 1, true); } catch (SecurityException ex) { // The user lacks appropriate permissions to read files, discover paths, etc. MessageBox.Show("Security error. Please contact your administrator for details.\n" + "Most likely the injector can't read/write to the directory.\n\n" + "Error message: " + ex.Message + "\n\n" + "Details (send to Support):\n\n" + ex.StackTrace ); } } if (sameFileMessage) { MessageBox.Show("One more files you selected are already in the injector", "Error"); } } }
private void QuickInject_Click(object sender, EventArgs e) { if (Owned.SelectedItem == null) { return; } //DLLPath.Text = Environment.CurrentDirectory + "\\" + Owned.SelectedItem.ToString(); CheatInfo cheat = Owned.SelectedItem as CheatInfo; FileList.Items.Add(cheat); FileList.SetItemChecked(FileList.Items.Count - 1, true); MainTabs.SelectedIndex = 1; }
private void updateList() { Owned.Items.Clear(); // Get all the DLLs in the Injector's current path DirectoryInfo dir = new DirectoryInfo(Environment.CurrentDirectory); foreach (FileInfo file in dir.GetFiles("*.dll")) { CheatInfo cheat = new CheatInfo(); cheat.Name = Path.GetFileNameWithoutExtension(file.Name); cheat.Path = file.FullName; Owned.Items.Add(cheat); } try { Downloads.Items.Clear(); // Get the list of cheats string text = new WebClient().DownloadString(mainFile); int start = text.IndexOf("Cheats:") + "Cheats:".Length + 1; int end = text.IndexOf("Info:"); string list = text.Substring(start, end - start); string[] cheats = list.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < cheats.Length; i++) { CheatInfo cheat = new CheatInfo(); string[] info = cheats[i].Split(new char[] { ';' }, StringSplitOptions.None); cheat.Name = info[0]; cheat.Path = info[1]; Downloads.Items.Add(cheat); } } catch (Exception ex) { if (!ShutUp) { MessageBox.Show($"There was a problem downloading the DLL list\n\n{ex.ToString()}", "Error"); } } }