public MapTile LoadSection(string hpiFileName, string sctFileName) { var key = HpiPath.Combine(hpiFileName, sctFileName); MapTile section; if (!this.tileCache.TryGetValue(key, out section)) { section = this.LoadSectionFromDisk(hpiFileName, sctFileName); this.tileCache[key] = section; } return(section); }
private void OpenFromHapi(string filename) { List <string> maps; bool readOnly; using (var h = new HpiArchive(filename)) { maps = GetMapNames(h).ToList(); } string mapName; switch (maps.Count) { case 0: this.dialogService.ShowError("No maps found in " + filename); return; case 1: mapName = maps.First(); readOnly = false; break; default: maps.Sort(); mapName = this.dialogService.AskUserToChooseMap(maps); readOnly = true; break; } if (mapName == null) { return; } var tntPath = HpiPath.Combine("maps", mapName + ".tnt"); this.model.Map = Maybe.Some(this.mapLoadingService.CreateFromHpi(filename, tntPath, readOnly)); }