コード例 #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
ファイル: MainForm.cs プロジェクト: Steex/FB2Formatter
        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
ファイル: MainForm.cs プロジェクト: Steex/FB2Formatter
        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
ファイル: MainForm.cs プロジェクト: Steex/FB2Formatter
        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"));
                }
            }
        }