예제 #1
0
        public async Task <ConsoleOutput> TestMap()
        {
            var options = new MapOptions
            {
                Data = new StateData
                {
                    Fips    = "02",
                    Name    = "alaska",
                    Display = "Alaska"
                },
                Width  = 960,
                Height = 960
            };

            return(await options.CreateMap(env));
        }
예제 #2
0
        public static async Task <ConsoleOutput> CreateMap(this MapOptions options, IWebHostEnvironment env)
        {
            var guid = Guid.NewGuid();

            options.Path    = $"{env.ContentRootPath}/wwwroot/mapping/";
            options.OutPath = $"{env.ContentRootPath}/wwwroot/mapping/{guid.ToString()}/";
            options.UnzipMap();

            var result = await options.CreateMap();

            if (!result.HasError)
            {
                result.Result = await File.ReadAllTextAsync($"{options.OutPath}{options.Data.Name}.json");
            }

            if (Directory.Exists(options.OutPath))
            {
                Directory.Delete(options.OutPath, true);
            }

            return(result);
        }
예제 #3
0
 public async Task <ConsoleOutput> CreateMap([FromBody] MapOptions options) => await options.CreateMap(env);