Exemplo n.º 1
0
        static int ReplayMapGuide(MgReplayOptions options)
        {
            int ret = 0;

            try
            {
                options.Validate();

                var conn = ConnectionProviderRegistry.CreateConnection("Maestro.Http",
                                                                       "Url", options.MapAgentUri,
                                                                       "Username", options.Username,
                                                                       "Password", options.Password);

                var tileSvc = (ITileService)conn.GetService((int)ServiceType.Tile);

                var walker = new TileListWalker(options.TileListFile);
                walker.ResourceID = options.ResourceID;

                var seederOptions = new TileSeederOptions();
                seederOptions.MaxDegreeOfParallelism = options.MaxDegreeOfParallelism;
                seederOptions.ErrorLogger            = ErrorLogger;
                var seeder = new TileSeeder(tileSvc, 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);
        }
Exemplo n.º 2
0
        static int ReplayXYZ(XYZReplayOptions options)
        {
            int ret = 0;

            try
            {
                options.Validate();

                var xyz    = new XYZTileService(options.UrlTemplate);
                var walker = new TileListWalker(options.TileListFile);

                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);
        }