public void addFile(String path, string targetDirectory) { zipFile.Dispose(); try { using (Ionic.Zip.ZipFile ionicZip = new Ionic.Zip.ZipFile(resourceLocation)) { ionicZip.UpdateFile(path); ionicZip.Save(); } } finally { zipFile = new ZipFile(resourceLocation); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { var path = Regex.Replace(PathToJar[ComboBoxRadar.SelectedIndex], "\"", ""); using (Ionic.Zip.ZipFile zip = Ionic.Zip.ZipFile.Read(path)) { zip.UpdateFile(PathToMap[ComboBoxMap.SelectedIndex] + @"\" + PathToMapNames[ComboBoxMap.SelectedIndex] + @"\Erangel_Minimap.png", @"\maps"); zip.UpdateFile(PathToMap[ComboBoxMap.SelectedIndex] + @"\" + PathToMapNames[ComboBoxMap.SelectedIndex] + @"\Miramar_Minimap.png", @"\maps"); zip.UpdateFile(PathToMap[ComboBoxMap.SelectedIndex] + @"\" + PathToMapNames[ComboBoxMap.SelectedIndex] + @"\Savage_Minimap.png", @"\maps"); zip.Save(); } } catch (Exception ex) { System.Windows.MessageBox.Show("Inject map Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } try { if (ComboBoxMap.SelectedIndex == -1) { System.Windows.MessageBox.Show("Select map!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } Process proc = new Process(); proc.StartInfo.CreateNoWindow = true; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.OutputDataReceived += proc_OutputDataReceived; proc.ErrorDataReceived += proc_OutputDataReceived; if (RadioCustomIp.IsChecked == true) { SomeText2 = TextBoxGamePCIP.Text; SomeText3 = TextBoxRadarPCIP.Text; Launcher_Namespace.Properties.Settings.Default.TextBoxRadarPCIP = TextBoxRadarPCIP.Text; Launcher_Namespace.Properties.Settings.Default.TextBoxGamePCIP = TextBoxGamePCIP.Text; Launcher_Namespace.Properties.Settings.Default.Save(); proc.StartInfo.FileName = "java"; proc.StartInfo.Arguments = " -jar " + PathToJar[ComboBoxRadar.SelectedIndex] + " " + SomeText3 + " PortFilter " + SomeText2; proc.Start(); proc.BeginOutputReadLine(); proc.BeginErrorReadLine(); TextBoxCmd.Text += "\njava -jar " + PathToJar[ComboBoxRadar.SelectedIndex] + " " + SomeText3 + " PortFilter " + SomeText2; } if (RadioPCAP.IsChecked == true) { string LocalIpAdressFilter = Regex.Replace(LocalIpAdress, "[^0-9 .]", ""); string AllIpAdressFilter = Regex.Replace(AllIpAdress, "[^0-9 .]", ""); proc.StartInfo.FileName = "java"; proc.StartInfo.Arguments = "-jar " + PathToJar[ComboBoxRadar.SelectedIndex] + " " + LocalIpAdressFilter + " PortFilter " + AllIpAdressFilter + " Offline"; proc.Start(); proc.BeginOutputReadLine(); proc.BeginErrorReadLine(); TextBoxCmd.Text += "\njava -jar " + PathToJar[ComboBoxRadar.SelectedIndex] + " " + LocalIpAdressFilter + " PortFilter " + AllIpAdressFilter + " Offline"; } if (RadioArp.IsChecked == true) { SomeText2 = TextBoxGamePCIP.Text; SomeText3 = TextBoxRadarPCIP.Text; Launcher_Namespace.Properties.Settings.Default.TextBoxRadarPCIP = TextBoxRadarPCIP.Text; Launcher_Namespace.Properties.Settings.Default.TextBoxGamePCIP = TextBoxGamePCIP.Text; Launcher_Namespace.Properties.Settings.Default.Save(); TextBoxCmd.Text += "\n" + SomeText3; Process.Start("arpspoof.exe", SomeText2); Thread.Sleep(2000); proc.StartInfo.FileName = "java"; proc.StartInfo.Arguments = "-jar " + PathToJar[ComboBoxRadar.SelectedIndex] + " " + SomeText3 + " PortFilter " + SomeText2; proc.Start(); proc.BeginOutputReadLine(); proc.BeginErrorReadLine(); TextBoxCmd.Text += "\njava -jar " + PathToJar[ComboBoxRadar.SelectedIndex] + " " + SomeText3 + " PortFilter " + SomeText2; } if (RadioAuto.IsChecked == true) { string LocalIpAdressFilter = Regex.Replace(LocalIpAdress, "[^0-9 .]", ""); string AllIpAdressFilter = Regex.Replace(AllIpAdress, "[^0-9 .]", ""); proc.StartInfo.FileName = "java"; proc.StartInfo.Arguments = "-jar " + PathToJar[ComboBoxRadar.SelectedIndex] + " " + LocalIpAdressFilter + " PortFilter " + AllIpAdressFilter; proc.Start(); proc.BeginOutputReadLine(); proc.BeginErrorReadLine(); TextBoxCmd.Text += "\njava -jar " + PathToJar[ComboBoxRadar.SelectedIndex] + " " + LocalIpAdressFilter + " PortFilter " + AllIpAdressFilter; } } catch (Exception ex) { TextBoxCmd.Text += "\nError: " + ex.Message; } }