public IParser SelectParser(string directory) { ConsoleInterface consoleInterface = new ConsoleInterface(); string extension = Path.GetExtension(directory); IParser parser = null; switch (extension) { case ".json": parser = CreateParser(UserSelectFileType.JSON); break; case ".csv": parser = CreateParser(UserSelectFileType.CSV); break; case ".xml": parser = CreateParser(UserSelectFileType.XML); break; default: UserSelectFileType choice = consoleInterface.PromptFileTypeSelection("File type not recongised."); if (choice != UserSelectFileType.Return) { parser = CreateParser(choice); } break; } return(parser); }
static void Main(string[] args) { var config = new LoggingConfiguration(); var target = new FileTarget { FileName = @"C:\Work\Logs\SupportBank.log", Layout = @"${longdate} ${level} - ${logger}: ${message}" }; config.AddTarget("File Logger", target); config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, target)); LogManager.Configuration = config; var logger = NLog.LogManager.GetCurrentClassLogger(); logger.Info("Program Started"); ConsoleInterface.MainPrompt(); }