private static void Import(Opts opts) { Authenticate(opts); Generate(opts); var managerResult = opts.ImportRelto.HasValue ? ImportManager.CreateFileImportManagerAsync(opts.DekiApi, opts.ImportRelto.Value, opts.OutputPath, new Result <ImportManager>()) : ImportManager.CreateFileImportManagerAsync(opts.DekiApi, opts.ImportReltoPath, opts.OutputPath, new Result <ImportManager>()); managerResult.Block(); if (managerResult.HasException) { Directory.Delete(opts.OutputPath, true); throw new Exception(string.Format("Import failed: {0}", managerResult.Exception.Message), managerResult.Exception); } ImportManager manager = managerResult.Value; manager.MaxRetries = opts.Retries; Result result = manager.ImportAsync(new Result()); int completed = 0; Console.WriteLine("Importing Documentation..."); while (!result.HasFinished) { Thread.Sleep(200); if (manager.CompletedItems <= completed) { continue; } Console.WriteLine(" {0}/{1}", manager.CompletedItems, manager.TotalItems); completed = manager.CompletedItems; } Directory.Delete(opts.OutputPath, true); if (result.HasException) { var importException = result.Exception as ImportException; if (importException != null) { Console.WriteLine("Import failed on Item:\r\n{0}", importException.ManifestItem.ToPrettyString()); } throw new Exception(string.Format("Import failed: {0}", result.Exception.Message), result.Exception); } }