static void Main(string[] args) { string[] commands; var list = File.ReadAllText("CreateDocumentScript.txt"); commands = list.Split('#'); foreach (var command in commands) { var strippedCommand = Regex.Replace(command, @"\t|\n|\r", ""); var commandList = strippedCommand.Split(':'); switch (commandList[0]) { case "Document": // Your document creation code goes here string[] fileName = commandList[1].Split(';'); if (fileName[0] == "Markdown") { //fileNameArray[1] == fileName factory = MarkdownFactory.CreateInstance(); document = factory.CreateDocument(fileName[1]); Console.WriteLine(fileName[1]); } else if (fileName[0] == "Html") { factory = HTMLFactory.CreateInstance(); document = factory.CreateDocument(fileName[1]); Console.WriteLine(fileName[1]); } break; case "Element": // Your element creation code goes here document.AddElement(factory.CreateElement(commandList[1], commandList[2])); break; case "Run": // Your document running code goes here document.RunDocument(); Console.WriteLine("Running Document"); break; default: break; } } Console.WriteLine("Thanks for using...done"); System.Environment.Exit(0); }