protected override Task <int> Execute(ImportCommandArguments arguments) { Tracing.Info("import - import posts from external source"); if (!Importers.Any(e => string.Equals(e, arguments.ImportType, StringComparison.InvariantCultureIgnoreCase))) { Tracing.Info("Requested import type not found: {0}", arguments.ImportType); return(Task.FromResult(1)); } if (string.Equals("wordpress", arguments.ImportType, StringComparison.InvariantCultureIgnoreCase)) { var wordpressImporter = new WordpressImport(FileSystem, arguments.Source, arguments.ImportFile); wordpressImporter.Import(); } else if (string.Equals("blogger", arguments.ImportType, StringComparison.InvariantCultureIgnoreCase)) { var bloggerImporter = new BloggerImport(FileSystem, arguments.Source, arguments.ImportFile); bloggerImporter.Import(); } Tracing.Info("Import complete"); return(Task.FromResult(0)); }
#pragma warning restore 649 public void Execute(IEnumerable <string> arguments) { Tracing.Info("import - import posts from external source"); parameters.Parse(arguments); if (!Importers.Any(e => String.Equals(e, parameters.ImportType, StringComparison.InvariantCultureIgnoreCase))) { Tracing.Info("Requested import type not found: {0}", parameters.ImportType); return; } if (string.Equals("wordpress", parameters.ImportType, StringComparison.InvariantCultureIgnoreCase)) { var wordpressImporter = new WordpressImport(fileSystem, parameters.Path, parameters.ImportPath); wordpressImporter.Import(); } else if (string.Equals("blogger", parameters.ImportType, StringComparison.InvariantCultureIgnoreCase)) { var bloggerImporter = new BloggerImport(fileSystem, parameters.Path, parameters.ImportPath); bloggerImporter.Import(); } Tracing.Info("Import complete"); }
public WordpressImportTests() { publishedTimeStamp = new DateTimeOffset(2010, 02, 06, 11, 22, 38, TimeSpan.Zero); var datePublished = publishedTimeStamp.ToString("ddd, dd MMM yyyy hh:mm:ss zzzzz"); outputFileName = string.Format("{0}_posts\\{1}-hello-world.md", BaseSite, publishedTimeStamp.ToString("yyyy-MM-dd")); fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { ImportFile, new MockFileData(string.Format(ImportContent, datePublished)) } }); wordpressImporter = new WordpressImport(fileSystem, BaseSite, ImportFile); }