示例#1
0
        public void Exec(SubCommandRunningContext context)
        {
            var builder = new XRefArchiveBuilder();

            if (Uri.TryCreate(_options.Uri, UriKind.RelativeOrAbsolute, out Uri uri))
            {
                builder.DownloadAsync(uri, _options.ArchiveFile).Wait();
            }
            else
            {
                Logger.LogError($"Invalid uri: {_options.Uri}");
            }
        }
示例#2
0
        public async Task TestDownload()
        {
            const string ZipFile = "test.zip";
            var          builder = new XRefArchiveBuilder();

            Assert.True(await builder.DownloadAsync(new Uri("http://dotnet.github.io/docfx/xrefmap.yml"), ZipFile));

            using (var xar = XRefArchive.Open(ZipFile, XRefArchiveMode.Read))
            {
                var map = xar.GetMajor();
                Assert.True(map.HrefUpdated);
                Assert.True(map.Sorted);
                Assert.NotNull(map.References);
                Assert.Null(map.Redirections);
            }
            File.Delete(ZipFile);
        }
示例#3
0
        public void Exec(SubCommandRunningContext context)
        {
            if (string.IsNullOrWhiteSpace(_options.ArchiveFile))
            {
                Logger.LogError("Please provide output file.");
                return;
            }
            var builder = new XRefArchiveBuilder();

            if (Uri.TryCreate(_options.Uri, UriKind.RelativeOrAbsolute, out Uri uri))
            {
                builder.DownloadAsync(uri, _options.ArchiveFile).Wait();
            }
            else
            {
                Logger.LogError($"Invalid uri: {_options.Uri}");
            }
        }