예제 #1
0
        private void CollectReferences()
        {
            references = new Dictionary <string, ReferenceInfo>();

            XmlDocument book = BookUtils.OpenBook(sourceFileName);

            bodyType   = BookBodyType.None;
            bodyNumber = 0;
            CollectReferences_ProcessElement(book.DocumentElement);
        }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
        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);
                }
            }
        }
예제 #4
0
        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"));
                }
            }
        }