private void ExportAll(string Folder, ProgressBarWindow progressBar) { int Curfile = 0; foreach (ASST asst in beaFile.FileList.Values) { int value = (Curfile * 100) / beaFile.FileList.Count; progressBar.Value = value; progressBar.Refresh(); try { if (!String.IsNullOrWhiteSpace(Path.GetDirectoryName($"{Folder}/{beaFile.Name}/{asst.FileName}"))) { if (!File.Exists(asst.FileName)) { if (!Directory.Exists($"{Folder}/{beaFile.Name}/{asst.FileName}")) { Directory.CreateDirectory(Path.GetDirectoryName($"{Folder}/{beaFile.Name}/{asst.FileName}")); } } } File.WriteAllBytes($"{Folder}/{beaFile.Name}/{asst.FileName}", GetASSTData(asst.FileName)); } catch { } Curfile++; if (value == 99) { value = 100; } progressBar.Value = value; progressBar.Refresh(); } }
private void ExportAll(object sender, EventArgs args) { FolderSelectDialog fsd = new FolderSelectDialog(); if (fsd.ShowDialog() == DialogResult.OK) { progressBar = new ProgressBarWindow(); progressBar.Task = "Extracing Files..."; progressBar.Refresh(); progressBar.Value = 0; progressBar.StartPosition = FormStartPosition.CenterScreen; progressBar.Show(); ExportAll(fsd.SelectedPath, progressBar); } }