public static async Task <int> Rip(string source, FileInfo output, int tileSize, bool noSoftwareField, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(source)) { throw new ArgumentException(nameof(source)); } if (output == null) { throw new ArgumentNullException(nameof(output)); } if (tileSize <= 0 || (tileSize % 16) != 0) { throw new ArgumentOutOfRangeException(nameof(tileSize)); } var uri = new Uri(source); var reporter = new RipperReporter(); var options = new DeepZoomRipperOptions { OutputTileSize = tileSize }; using (var ripper = new TracedDeepZoomRipper(options, output.FullName)) { await ripper.InitializeAsync(uri, cancellationToken); PrintSourceInformation(ripper, uri); Console.WriteLine(); Console.WriteLine("Output Information"); Console.WriteLine("TileSize: " + tileSize); Console.WriteLine(); Console.WriteLine(output.Exists ? $"Overriding TIFF file at {output.FullName}" : $"Saving TIFF file to {output.FullName}"); Console.WriteLine(); if (!noSoftwareField) { ripper.Software = ThisAssembly.AssemblyTitle + " " + ThisAssembly.AssemblyInformationalVersion; } var sw = new Stopwatch(); sw.Start(); await ripper.RipBaseLayerAsync(reporter, cancellationToken); #if DEBUG Console.WriteLine("Tile IO Count: " + ripper.TileIOCount); #endif Console.WriteLine(); await ripper.GenerateReducedResolutionLayerAsync(reporter, cancellationToken); Console.WriteLine(); sw.Stop(); Console.WriteLine("Operation completed."); Console.WriteLine("Elapsed time: " + sw.Elapsed); } return(0); }
public TracedDeepZoomRipper(DeepZoomRipperOptions options, string outputFile) : base(options, outputFile) { _ioCount = 0; }