public static void Main(string[] args) { string resultDir = Utility.ResultDirectory; // recreate result files every time! if (Directory.Exists(resultDir)) { Directory.Delete(resultDir, true); } else { Directory.CreateDirectory(resultDir); } Console.WriteLine(""); Console.WriteLine("========================================"); Console.WriteLine("RESULT DIRECTORY: {0}", resultDir); Console.WriteLine("========================================"); Console.WriteLine(""); foreach (string chapter in Chapters.Examples.Keys) { bool madeSubDir = false; foreach (string example in Chapters.Examples[chapter].Keys) { Chapters c = new Chapters() { ChapterName = chapter, ExampleName = example }; if (c.IsPdfResult || c.IsZipResult || c.IsOtherResult) { if (!madeSubDir) { string resultSubDir = Path.Combine(resultDir, chapter); Directory.CreateDirectory(resultSubDir); madeSubDir = true; } Console.WriteLine("Creating output file: {0} => {1} ", chapter, example ); c.SendOutput(); } } } }
protected void Submit(object sender, EventArgs e) { Chapters c = new Chapters() { ChapterName = DropDownListChapters.Text, ExampleName = DropDownListExamples.Text }; if (c.IsPdfResult || c.IsZipResult || c.IsOtherResult) { try { c.SendOutput(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } else { //MessageBox.Show() } }