private void FullEmptyCategoriesTxTChecked(IEnumerable <TileCategory> list, IEnumerable <ItemData> datalist, TileCategory tileCategory) { var style = new TileStyle(); foreach (ItemData itemData in datalist) { Tile tile = null; int number = itemData.Id; 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.Tiles.Count > 0 && tileCategory.FindStyleByName(style.Name) == null) { tileCategory.AddStyle(style); } var st2 = tileCategory.FindStyleByName(name); if (st2 == null) { style = new TileStyle { Name = name } } ; else { style = st2; } } style.AddTile(new Tile() { Id = number, Name = itemData.Name }); } } tileCategory.AddStyle(style); }
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); }