示例#1
0
        public static string GetNewFilePath()
        {
            string path = DragonUtil.RemoveAllQuotes(Console.ReadLine());

            var directoryName = Path.GetDirectoryName(path);

            if (Directory.Exists(directoryName) &&
                DragonUtil.CheckFolderWritePermission(directoryName))
            {
                return(path);
            }

            ColoredConsole.WriteLineWithColor("Invalid folder, can't write to to: " + directoryName, ConsoleColor.Red);

            Console.WriteLine("");
            return(null);
        }
示例#2
0
        public string ConvertToHtml(string markdownPath, string htmlPath, ConverterOptions options)
        {
            Console.WriteLine("Converting " + markdownPath + " to RW WordPress ready HTML...");

            if (htmlPath == null)
            {
                htmlPath = DragonUtil.GetFullPathWithoutExtension(markdownPath) + ".html";
            }

            if (DragonUtil.CheckFolderWritePermission(Path.GetDirectoryName(htmlPath)))
            {
                Converter.ConvertMarkdownFileToHtmlFile(markdownPath, htmlPath, options);
                Console.WriteLine("Saved HTML to custom location: " + htmlPath);
            }
            else
            {
                ColoredConsole.WriteLineWithColor("Conversion aborted, can't write to " + htmlPath, ConsoleColor.Red);
            }

            return(htmlPath);
        }