public static void DefaultCreate(string htmlDir, string jsonFile, string outputFile) { Console.WriteLine("Creating RSS"); string jsonData = File.ReadAllText(jsonFile); Func <string, Task <string> > GetContent = async(fileName) => { return(await Task.Run <string>(() => File.ReadAllText(Path.Combine(htmlDir, fileName + ".html")))); }; string rssFeed = new CreateRSS(jsonData, GetContent).GetXml().GetAwaiter().GetResult(); File.WriteAllText(outputFile, rssFeed); }
static int RunCompile(string SourceDir, string OutputDir, string JsonFile) { if (!Commands.IsDirectory(SourceDir)) { Console.Error.WriteLine("Wrong source directory"); Console.WriteLine($"SourceDir: {SourceDir}"); return(1); } if (!new DirectoryInfo(OutputDir).Exists) { new DirectoryInfo(OutputDir).Create(); } Console.WriteLine($"source directory is: {new DirectoryInfo(SourceDir).FullName}"); Console.WriteLine($"output directory is: {new DirectoryInfo(OutputDir).FullName}"); Action postChange = () => CreateRSS.DefaultCreate(OutputDir, JsonFile, Path.Combine(OutputDir, "rss.xml")); new Compiler(SourceDir, OutputDir, postChange).Start(); return(0); }