public void unrar() { ZCreate(); if (TF == true) { foreach (object ItemChecked in FilesInsDir.CheckedItems) { Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = (sDir + "/unrar.exe"); p.StartInfo.Arguments = ("x " + ItemChecked.ToString() + " " + xTractPath + "/"); p.Start(); p.WaitForExit(); } OpenExtractPath(); } File.Delete(sDir + "/unrar.exe"); File.Delete(sDir + "/unrar3.dll"); }
//Log Parser Button public void button2_Click_1(object sender, EventArgs e) { if (!chklive.Checked) { richTextBox1.Enabled = false; } if (txtFolder.Text.Trim().Length == 0 || textBoxex.Text.Trim().Length == 0) { if (txtFolder.Text.Trim().Length == 0) { MessageBox.Show("Please define a log file location", "Log File Warning"); } else { MessageBox.Show("Please define an extionsion for the file types in your location" + Environment.NewLine + "eg: .txt or .log", "Log File Warning"); } } else { txtOutput.Enabled = true; richTextBox1.Enabled = true; progressBar1.Value = 0; var filesInFolder = Directory.EnumerateFiles(txtFolder.Text); var progbarmax = filesInFolder.Count(); progressBar1.Maximum = progbarmax; //toolStripProgressBar1.Maximum = progbarmax; txtOutput.Clear(); richTextBox1.Clear(); TextWriter tw = new StreamWriter(txtExtractToFile.Text); //if (chksave.Checked) //{ // TextWriter tw = new StreamWriter(txtExtractToFile.Text); //} foreach (var file in filesInFolder) { try { progressBar1.Value++; //toolStripProgressBar1.Value++; if (file.Contains(textBoxex.Text)) { txtOutput.AppendText(file + Environment.NewLine); var listContents = File.ReadAllLines(file); { foreach (var line in listContents) { if (chk_custom.Checked) { if (line.Contains(tx_customsearch.Text)) { richTextBox1.AppendText(file + " : " + line + Environment.NewLine); if (chksave.Checked) { tw.WriteLine(line); } } } else { foreach (object ItemChecked in checkedListBox2.CheckedItems) { if (line.Contains(ItemChecked.ToString())) { richTextBox1.AppendText(ItemChecked.ToString() + ": from : " + file + " : " + line + Environment.NewLine); if (chksave.Checked) { tw.WriteLine(line); } } } } } } } } catch (Exception ex) { } } tw.Close(); MessageBox.Show("Complete, Scanned " + filesInFolder.Count() + " Files"); } }