public override void Populate() { var txtFileLines = File.ReadAllLines(DataManager.Location.LocalPath + "roofs.txt"); var typeNames = txtFileLines[1].Split(Separators); TileCategory category = null; for (int i = 2; i < txtFileLines.Length; i++) { var infos = txtFileLines[i].Split('\t'); if (infos[1] == "0") { category = new TileCategory(Int32.Parse(infos[2]), TypeTile.Roofs) {Name = infos.Last()}; Categories.Add(category); } var style = new TileStyle(); category.AddStyle(style); style.Name = infos.Last(); style.Id = Int32.Parse(infos[1]); for (int j = 3; j < typeNames.Length - 3; j++) { if (infos[j] != "0") { var tile = new TileRoof { Id = uint.Parse(infos[j]) }; style.AddTile(tile); tile.Position = (j-2); } } } }
public override void Populate() { var txtFileLines = File.ReadAllLines(DataManager.Location.LocalPath + "floors.txt"); var typeNames = txtFileLines[1].Split(Separators); for (int i = 2; i < txtFileLines.Length; i++) { var infos = txtFileLines[i].Split('\t'); var category = new TileCategory(); category.Name = infos.Last(); var style = new TileStyle(); category.AddStyle(style); for (int j = 1; j < typeNames.Length-2; j++) { if(infos[j]!="0") { var tile = new TileFloor {Id = uint.Parse(infos[j])}; style.AddTile(tile); tile.Position= j; } } Categories.Add(category); } }
private void FullEmptyCategoriesTxTChecked(IEnumerable<TileCategory> list, IEnumerable<ModelItemData> datalist, TileCategory tileCategory) { var style = new TileStyle(); foreach (var itemData in datalist) { Tile tile; uint number = itemData.EntryId; var tiles = from cat in list let t = cat.FindTile(number) where t != null select t; tile = tiles.FirstOrDefault(); if (tile == null) { string name = string.Format("{0}-{1}", tileCategory.Name, itemData.Name.Replace(tileCategory.Name, "").Split(Separator2, StringSplitOptions . RemoveEmptyEntries) .FirstOrDefault()); if (string.IsNullOrEmpty(style.Name) || style.Name != name) { if (style.List.Count > 0 && tileCategory.FindStyleByName(style.Name) == null) { tileCategory.AddStyle(style); } var st2 = tileCategory.FindStyleByName(name); style = st2 ?? new TileStyle { Name = name }; } switch (tileCategory.TypeTile) { case TypeTile.Wall: { style.AddTile(new TileWall() { Id = number, Name = itemData.Name }); break; } case TypeTile.Roofs: { style.AddTile(new TileRoof() { Id = number, Name = itemData.Name }); break; } case TypeTile.Floor: { style.AddTile(new TileFloor() { Id = number, Name = itemData.Name }); break; } default: { style.AddTile(new Tile { Id = number, Name = itemData.Name }); break; } } } } tileCategory.AddStyle(style); }