static async Task <int> RunXYZAsync(XYZSeederOptions options)
        {
            int ret = 0;

            try
            {
                options.Validate();

                var xyz    = new XYZTileService(options.UrlTemplate);
                var walker = new XYZTileWalker(options.MinX, options.MinY, options.MaxX, options.MaxY, options.MaxZoomLevel ?? XYZTileWalker.DEFAULT_MAX_ZOOM_LEVEL);

                if (options.SpecificZoomLevels != null)
                {
                    walker.SetSpecificZoomLevels(options.SpecificZoomLevels);
                }

                var seederOptions = new TileSeederOptions();
                seederOptions.MaxDegreeOfParallelism = options.MaxDegreeOfParallelism;
                seederOptions.ErrorLogger            = ErrorLogger;
                var seeder = new TileSeeder(xyz, walker, seederOptions);

                var progress = new ConsoleProgress();
                var stats    = await seeder.RunAsync(progress);

                Console.WriteLine($"Rendered {stats.TilesRendered} tiles in {stats.Duration}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                ret = 1;
            }
            finally
            {
                if (options.Wait)
                {
                    Console.WriteLine("Press any key to continue");
                    Console.Read();
                }
            }
            return(ret);
        }
Exemple #2
0
        static int RunXYZ(XYZSeederOptions options)
        {
            int ret = 0;

            try
            {
                options.Validate();

                var xyz    = new XYZTileService(options.UrlTemplate);
                var walker = new XYZTileWalker(options.MinX, options.MinY, options.MaxX, options.MaxY);

                var seederOptions = new TileSeederOptions();
                seederOptions.MaxDegreeOfParallelism = options.MaxDegreeOfParallelism;
                seederOptions.ErrorLogger            = ErrorLogger;
                var seeder = new TileSeeder(xyz, walker, seederOptions);

                var progress = new ConsoleProgress();
                var stats    = seeder.Run(progress);

                Console.WriteLine($"Rendered {stats.TilesRendered} tiles in {stats.Duration}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                ret = 1;
            }
            finally
            {
                if (options.Wait)
                {
                    Console.WriteLine("Press any key to continue");
                    Console.Read();
                }
            }
            return(ret);
        }