private void rPFFilesToolStripMenuItem_Click(object sender, EventArgs e) { timerTime = DateTime.Now; watch = new System.Threading.Timer(Tick, null, 0, 10); if (folderBrowserDialog1.ShowDialog(this) == DialogResult.OK) { new Thread(() => { Thread.CurrentThread.IsBackground = true; string[] rpfFiles = Directory.GetFiles(folderBrowserDialog1.SelectedPath, "*.rpf", SearchOption.AllDirectories); foreach (string file in rpfFiles) { TimeLabel.Text = "Scanning RPFs and Extracting Files ..."; RpfFile rpf = new RpfFile(file, Path.GetDirectoryName(file)); try { rpf.ScanStructure(null, null); var fileTypes = new List <string>() { ".ybn", ".ymap" }; RPFFunctions.SearchRPF(rpf, file, CurrentList, fileTypes); } catch (Exception) { MessageBox.Show("Error can't read " + file + ".\nThis file has been skipped.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } StringFunctions.SetCount(CurrentList, FilesAddedLabel, startButton); watch.Dispose(); }).Start(); } }
private void rPFFilesToolStripMenuItem_Click(object sender, EventArgs e) { var watch = Stopwatch.StartNew(); if (folderBrowserDialog1.ShowDialog(this) == DialogResult.OK) { new Thread(() => { Thread.CurrentThread.IsBackground = true; string[] rpfFiles = Directory.GetFiles(folderBrowserDialog1.SelectedPath, "*.rpf", SearchOption.AllDirectories); foreach (string file in rpfFiles) { TimeLabel.Text = "Scanning RPFs and Extracting Files ..."; RpfFile rpf = new RpfFile(file, Path.GetDirectoryName(file)); try { rpf.ScanStructure(null, null); var fileTypes = new List <string>() { ".ybn", ".ymap" }; RPFFunctions.SearchRPF(rpf, file, CurrentList, fileTypes); var elapsedMss = watch.ElapsedMilliseconds; TimeLabel.Text = "Time Elapsed: " + StringFunctions.ConvertMillisecondsToSeconds(elapsedMss).ToString(); } catch (Exception) { MessageBox.Show("Error can't read " + file + ".\nThis file has been skipped.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } StringFunctions.SetCountAndTime(watch.ElapsedMilliseconds, TimeLabel, CurrentList, FilesAddedLabel, startButton); }).Start(); } }
private void addItemsToolStripMenuItem_Click(object sender, EventArgs e) { var watch = Stopwatch.StartNew(); if (openFileDialog1.ShowDialog(this) == DialogResult.OK) { new Thread(() => { Thread.CurrentThread.IsBackground = true; foreach (string file in openFileDialog1.FileNames) { if (file.EndsWith(".rpf")) { TimeLabel.Text = "Scanning RPFs and Extracting Files ..."; RpfFile rpf = new RpfFile(file, Path.GetDirectoryName(file)); try { rpf.ScanStructure(null, null); var fileTypes = new List <string>() { ".ybn", ".ydr", ".yft", ".ydd" }; RPFFunctions.SearchRPF(rpf, file, CurrentList, fileTypes); } catch (Exception) { MessageBox.Show("Error can't read " + file + ".\nThis file has been skipped.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (!StringFunctions.DoesItemExist(CurrentList, file)) { CurrentList.Items.Add(file); } } var elapsedMss = watch.ElapsedMilliseconds; TimeLabel.Text = "Time Elapsed: " + StringFunctions.ConvertMillisecondsToSeconds(elapsedMss).ToString(); } StringFunctions.SetCountAndTime(watch.ElapsedMilliseconds, TimeLabel, CurrentList, FilesAddedLabel, startButton); }).Start(); } }
private void addItemsToolStripMenuItem_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog(this) == DialogResult.OK) { timerTime = DateTime.Now; watch = new System.Threading.Timer(Tick, null, 0, 10); new Thread(() => { Thread.CurrentThread.IsBackground = true; foreach (string file in openFileDialog1.FileNames) { if (file.EndsWith(".rpf")) { TimeLabel.Text = "Scanning RPFs and Extracting Files ..."; RpfFile rpf = new RpfFile(file, Path.GetDirectoryName(file)); try { rpf.ScanStructure(null, null); var fileTypes = new List <string>() { ".ybn", ".ymap" }; RPFFunctions.SearchRPF(rpf, file, CurrentList, fileTypes); } catch (Exception) { MessageBox.Show("Error can't read " + file + ".\nThis file has been skipped.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (!StringFunctions.DoesItemExist(CurrentList, file)) { CurrentList.Items.Add(file); } } } StringFunctions.SetCount(CurrentList, FilesAddedLabel, startButton); watch.Dispose(); }).Start(); } }
private void CurrentList_DragDrop(object sender, DragEventArgs e) { new Thread(() => { timerTime = DateTime.Now; watch = new System.Threading.Timer(Tick, null, 0, 10); Thread.CurrentThread.IsBackground = true; string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string file in files) { if (file.EndsWith("ybn") || file.EndsWith("ymap")) { if (!StringFunctions.DoesItemExist(CurrentList, file)) { CurrentList.Items.Add(file); } else if (file.EndsWith("rpf")) { TimeLabel.Text = "Scanning RPFs and Extracting Files ..."; RpfFile rpf = new RpfFile(file, Path.GetDirectoryName(file)); try { rpf.ScanStructure(null, null); var fileTypes = new List <string>() { ".ybn", ".ymap" }; RPFFunctions.SearchRPF(rpf, file, CurrentList, fileTypes); } catch (Exception) { MessageBox.Show("Error can't read " + file + ".\nThis file has been skipped.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } StringFunctions.SetCount(CurrentList, FilesAddedLabel, startButton); watch.Dispose(); }).Start(); }