private void GenerateHtml( RegionRect mapRegionArea, string appDir, string worldName, Dictionary <RegionPoint, DateTime> regions) { Logger.Information("Generating HTML"); if (!Directory.Exists(_dest)) { Directory.CreateDirectory(_dest); } // using (var zipArchive = ZipFile.OpenRead(Path.Combine(appDir, "Templates", "Web.zip"))) // { // foreach (var entry in zipArchive.Entries) // { // if (entry.Length != 0L) // { // var str = Path.Combine(_dest, entry.FullName); // var directoryName = Path.GetDirectoryName(str); // if (directoryName != null && !Directory.Exists(directoryName)) // Directory.CreateDirectory(directoryName); // entry.ExtractToFile(str, true); // } // } // } var dimInfo = @"var UnminedMapProperties = { minZoom: {minZoom}, maxZoom: {maxZoom}, defaultZoom: {defaultZoom}, imageFormat: ""{imageFormat}"", minRegionX: {minRegionX}, minRegionZ: {minRegionZ}, maxRegionX: {maxRegionX}, maxRegionZ: {maxRegionZ}, worldName: ""{worldName}"" }"; File.WriteAllText(Path.Combine(_dest, "unmined.map.regions.js"), "var UnminedMapRegions = [" + string.Join(",", regions.Keys.Select(r => string.Format("{{x:{0},z:{1}}}", r.X, r.Z))) + "];" + Environment.NewLine); var path = Path.Combine(_dest, "unmined.map.properties.js"); if (!File.Exists(path)) { using var st = File.CreateText(path); st.Write(dimInfo); st.Close(); } var players = Path.Combine(_dest, "lambda.players.js"); var markers = Path.Combine(_dest, "lambda.markers.js"); if (!File.Exists(players)) { using var st = File.CreateText(players); st.Write(@"var LambdaPlayers = [];"); st.Close(); } if (!File.Exists(markers)) { using var st = File.CreateText(markers); st.Write(@"var LambdaPOIs = []; var LambdaInfra = [];"); st.Close(); } var str1 = dimInfo.Replace("{minZoom}", "-6").Replace("{maxZoom}", "0") .Replace("{defaultZoom}", "0").Replace("{imageFormat}", "jpg").Replace("{minRegionX}", mapRegionArea.Left.ToString(CultureInfo.InvariantCulture)); var num = mapRegionArea.Top; var newValue1 = num.ToString(CultureInfo.InvariantCulture); var str2 = str1.Replace("{minRegionZ}", newValue1); num = mapRegionArea.Right - 1; var newValue2 = num.ToString(CultureInfo.InvariantCulture); File.WriteAllText(path, str2.Replace("{maxRegionX}", newValue2) .Replace("{maxRegionZ}", (mapRegionArea.Bottom - 1).ToString(CultureInfo.InvariantCulture)) .Replace("{worldName}", worldName)); }