public override MissionObjects Serialize(Record record) { var missionObjects = new MissionObjects(); var objectRecords = record.GetRecords(); foreach (MultipleRecords multipleRecords in objectRecords) { if (SoldiersSerializer.IsSolder(multipleRecords)) { var enemySoldier = SoldiersSerializer.Serialize(multipleRecords); if (enemySoldier != null) { missionObjects.Soldiers.Add(enemySoldier); } } if (CommandosSerializer.IsCommado(multipleRecords)) { var commando = CommandosSerializer.Serialize(multipleRecords); if (commando != null) { missionObjects.Commandos.Add(commando); } } } return(missionObjects); }
public override string GetMultipleRecordString(MissionObjects input) { var stringBuilder = new StringBuilder(); stringBuilder.Append($"[ {MissionObjects} ("); stringBuilder.Append($" {SoldiersSerializer.GetSoldiersRecordString(input.Soldiers)} "); stringBuilder.Append($" {CommandosSerializer.GetCommandosRecordString(input.Commandos)} "); stringBuilder.Append($") ]"); return(stringBuilder.ToString()); }