public static void Execute(ContentItem selectedItem, string currentFile) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; ofd.Filter = "All files|*.*|Image files(.png;.bmp;.jpg)|*.png;*.bmp;*.jpg"; if (ofd.ShowDialog() == DialogResult.OK) { ContentFolder curFolder = selectedItem as ContentFolder ?? selectedItem as ContentFolder; if (curFolder == null) { return; } foreach (var file in ofd.FileNames) { ContentFolder destFolder = curFolder; string fileName = file; string absolutePath = Path.Combine(Path.GetDirectoryName(currentFile), curFolder.getPath()); if (MakePathRelative(ref fileName, absolutePath)) { destFolder = curFolder.CreateTreeFolderStructure(Path.GetDirectoryName(fileName)); } destFolder.AddFile(ofd.FileName, Path.Combine(absolutePath, Path.GetFileName(file))); } } }