SharedStationRecordsSystem.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. namespace Content.Shared.StationRecords;
  2. public abstract class SharedStationRecordsSystem : EntitySystem
  3. {
  4. public StationRecordKey? Convert((NetEntity, uint)? input)
  5. {
  6. return input == null ? null : Convert(input.Value);
  7. }
  8. public (NetEntity, uint)? Convert(StationRecordKey? input)
  9. {
  10. return input == null ? null : Convert(input.Value);
  11. }
  12. public StationRecordKey Convert((NetEntity, uint) input)
  13. {
  14. return new StationRecordKey(input.Item2, GetEntity(input.Item1));
  15. }
  16. public (NetEntity, uint) Convert(StationRecordKey input)
  17. {
  18. return (GetNetEntity(input.OriginStation), input.Id);
  19. }
  20. public List<(NetEntity, uint)> Convert(ICollection<StationRecordKey> input)
  21. {
  22. var result = new List<(NetEntity, uint)>(input.Count);
  23. foreach (var entry in input)
  24. {
  25. result.Add(Convert(entry));
  26. }
  27. return result;
  28. }
  29. public List<StationRecordKey> Convert(ICollection<(NetEntity, uint)> input)
  30. {
  31. var result = new List<StationRecordKey>(input.Count);
  32. foreach (var entry in input)
  33. {
  34. result.Add(Convert(entry));
  35. }
  36. return result;
  37. }
  38. }