public override XmlLevelData ConvertToXml(Level level) { // LevelRoot var levelRoot = new XmlLevelRoot { Name = level.Name, AngryTime = level.AngryTime, Size = converter.Convert <Size, XmlCoord>(level.Size), Objects = level.Objects.Values.Select(converter.Convert <LevelObject, XmlLevelObject>).ToList(), Rooms = level.Rooms.Values.Select(converter.Convert <Room, XmlLevelRoom>).ToList(), }; // StringRoot var entries = new List <XmlString>(); var allLocalizationString = getFromAllLevelObject(level, lo => (id: lo.Id, strings: lo.Localization.Strings)) .Concat(level.ObjectDependentLocalizations.Select(pair => (id: pair.Key, strings: pair.Value.Strings))); foreach (var loc in allLocalizationString) { foreach (var str in loc.strings) { entries.Add(new() { Name = loc.id, Category = str.Key, Text = str.Value, }); } } var stringsRoot = new XmlStringsRoot { Entries = entries.Distinct(new XmlStringsEqualityComparer()).ToList(), }; return(new() { LevelRoot = levelRoot, StringsRoot = stringsRoot, // Right now the UI only changes the above mentiont things }); }
private static XmlStringsRoot UnifyStrings(XmlStringsRoot generic, XmlStringsRoot level) => new()