private void WriteAppFile(string outputFileName, IEnumerable <CustomisationLocalised> localisedData, LanguageDetail language, Dictionary <string, InventoryDescription> itemNames) { List <AppGameItemLang> appBlock = new List <AppGameItemLang>(); List <AppGameItemBase> appBlockBaseItems = new List <AppGameItemBase>(); foreach (CustomisationLocalised blockLocalised in localisedData) { foreach (CustomisationItemLocalised blockLoc in blockLocalised.Items) { if (GuidExclusion.All.Any(a => a.Equals(blockLoc.ItemId.Replace("_male", string.Empty).Replace("_female", string.Empty)))) { continue; } CustomisationItemLocalised relocalised = (language.LanguageType == LanguageType.English) ? blockLoc : blockLoc.ReLocaliseItem(itemNames); AppGameItem full = AppFileBlockMapper.ToAppFile(relocalised, blockLocalised.Category); if (!_appImagesRepo.FileExists("items", full.AppId)) { continue; } appBlock.Add(full.ToLang()); string image = GetItemImage(full.AppId); appBlockBaseItems.Add(full.ToBase(image)); } } _appFileSysRepo.WriteBackToJsonFile(appBlockBaseItems, outputFileName); _appFileSysRepo.WriteBackToJsonFile(appBlock, GetJsonLang(language.LanguageAppFolder, outputFileName)); }
public static CustomisationItemLocalised ReLocaliseItem(this CustomisationItemLocalised gameItem, Dictionary <string, InventoryDescription> itemNames) { string locName = itemNames.GetTitle(gameItem.ItemId); if (!string.IsNullOrEmpty(locName)) { gameItem.Name = locName; } return(gameItem); }
public static AppGameItem ToAppFile(CustomisationItemLocalised localisedData, string category) { AppGameItem recipe = new AppGameItem { AppId = localisedData.AppId, Flammable = false, PhysicsMaterial = "", Title = localisedData.Name, Description = category, Color = string.Empty, Ratings = null, Box = null, CustomisationSource = localisedData.Tier, }; return(recipe); }