public void ProcessFileEntry(FileEntry entry) { if (entry.IsFile) { PCKFileEntry = entry.PCKFileEntry; DialogResult = true; Close(); } else { Directory = entry.Directories; UpdateList(); } }
public FileEntry CreateFileEntry(PCKFile.FileEntry PCKEntry) { var entry = new FileEntry(); entry.IsFile = true; entry.PCKFileEntry = PCKEntry; entry.FileName = System.IO.Path.GetFileName(PCKEntry.FileName); string[] dirs = PCKEntry.FileName.Split('/'); for (int i = 0; i < dirs.Length - 1; ++i) { entry.Directories.Add(dirs[i]); } return(entry); }
public void OpenFile(ListBox listBox = null, string path = null) { if (listBox != null) { ProcessFileEntry(listBox.SelectedItem as FileEntry); } else if (!string.IsNullOrEmpty(path)) { if (!Archive.FileEntries.Any(t => t.FileName == path)) { MessageBox.Show("File not found!", $"The file \"{path}\" does not exist in the archive!", MessageBoxButton.OK, MessageBoxImage.Error); } else { PCKFileEntry = Archive.FileEntries.FirstOrDefault(t => t.FileName == path); DialogResult = true; Close(); } } }