private void AddDirectoryFiles_Click(object sender, EventArgs e) { using (FolderBrowserDialog fbd = new FolderBrowserDialog()) { if (fbd.ShowDialog() == DialogResult.OK) { foreach (string dirFiles in Directory.GetFiles(fbd.SelectedPath)) { FileInfo file = new FileInfo(dirFiles); zipinfo newFile = new zipinfo(file.Name, dirFiles, file.Length, file); fileList.Add(newFile); updateFileList(); } foreach (string dirFile in Directory.GetDirectories(fbd.SelectedPath)) { foreach (string dirFiles in Directory.GetFiles(dirFile)) { FileInfo file = new FileInfo(dirFiles); zipinfo newFile = new zipinfo(file.Name, Path.Combine(dirFile, dirFiles), file.Length, file); fileList.Add(newFile); updateFileList(); } } } } }
private void AddFile_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog()) { if (ofd.ShowDialog() == DialogResult.OK) { FileInfo file = new FileInfo(ofd.FileName); zipinfo newFile = new zipinfo(file.Name, ofd.FileName, file.Length, file); fileList.Add(newFile); updateFileList(); } } }