private void CollectReferences() { references = new Dictionary <string, ReferenceInfo>(); XmlDocument book = BookUtils.OpenBook(sourceFileName); bodyType = BookBodyType.None; bodyNumber = 0; CollectReferences_ProcessElement(book.DocumentElement); }
private void dropletExtractPicturesToXml_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("FileDrop")) { string[] paths = (string[])e.Data.GetData("FileDrop"); foreach (string path in paths.Where(p => Path.GetExtension(p) == ".fb2" && File.Exists(p))) { string sourceFile = path; string targetFile = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + "_images.txt"); BookUtils.ExtractPicturesToXml(sourceFile, targetFile); } } }
private void dropletExtractPicturesToFiles_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("FileDrop")) { string[] paths = (string[])e.Data.GetData("FileDrop"); foreach (string path in paths.Where(p => Path.GetExtension(p) == ".fb2" && File.Exists(p))) { string sourceFile = path; string targetFolder = Path.ChangeExtension(path, null); BookUtils.ExtractPicturesToFiles(sourceFile, targetFolder); } } }
private void dropletConvertPicturesToXml_DragDrop(object sender, DragEventArgs e) { string[] pictureExtensions = new string[] { ".png", ".jpg", ".jpeg" }; if (e.Data.GetDataPresent("FileDrop")) { string[] paths = (string[])e.Data.GetData("FileDrop"); IEnumerable <string> folders = paths.Where(p => Directory.Exists(p)); IEnumerable <string> pictures = paths.Where(p => pictureExtensions.Contains(Path.GetExtension(p))); if (folders.Any() && !pictures.Any()) { foreach (string folder in folders) { BookUtils.ConvertFolderPicturesToXml(folder, folder + "_images.txt"); } } else if (!folders.Any() && pictures.Any()) { BookUtils.ConvertListPicturesToXml(pictures, Path.Combine(Path.GetDirectoryName(pictures.First()), "images.txt")); } } }