diff --git a/QSB/EyeOfTheUniverse/ForestOfGalaxies/Messages/KillGalaxiesMessage.cs b/QSB/EyeOfTheUniverse/ForestOfGalaxies/Messages/KillGalaxiesMessage.cs index 5b11edea..58c8838b 100644 --- a/QSB/EyeOfTheUniverse/ForestOfGalaxies/Messages/KillGalaxiesMessage.cs +++ b/QSB/EyeOfTheUniverse/ForestOfGalaxies/Messages/KillGalaxiesMessage.cs @@ -16,22 +16,13 @@ namespace QSB.EyeOfTheUniverse.ForestOfGalaxies.Messages public override void Serialize(NetworkWriter writer) { base.Serialize(writer); - writer.Write(_deathDelays.Count); - foreach (var item in _deathDelays) - { - writer.Write(item); - } + writer.WriteList(_deathDelays); } public override void Deserialize(NetworkReader reader) { base.Deserialize(reader); - var length = reader.Read(); - _deathDelays = new List(length); - for (var i = 0; i < length; i++) - { - _deathDelays.Add(reader.Read()); - } + _deathDelays = reader.ReadList(); } public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; diff --git a/QSB/SaveSync/Messages/GameStateMessage.cs b/QSB/SaveSync/Messages/GameStateMessage.cs index 2c0988dd..562592ff 100644 --- a/QSB/SaveSync/Messages/GameStateMessage.cs +++ b/QSB/SaveSync/Messages/GameStateMessage.cs @@ -40,11 +40,7 @@ namespace QSB.SaveSync.Messages writer.Write(LaunchCodesGiven); writer.Write(LoopCount); - writer.Write(KnownFrequencies.Length); - foreach (var item in KnownFrequencies) - { - writer.Write(item); - } + writer.WriteArray(KnownFrequencies); writer.Write(KnownSignals.Count); foreach (var (name, discovered) in KnownSignals) @@ -62,12 +58,7 @@ namespace QSB.SaveSync.Messages LaunchCodesGiven = reader.Read(); LoopCount = reader.Read(); - var frequenciesLength = reader.Read(); - KnownFrequencies = new bool[frequenciesLength]; - for (var i = 0; i < frequenciesLength; i++) - { - KnownFrequencies[i] = reader.Read(); - } + KnownFrequencies = reader.ReadArray(); var signalsLength = reader.Read(); KnownSignals = new Dictionary(signalsLength); diff --git a/QSB/TriggerSync/Messages/TriggerResyncMessage.cs b/QSB/TriggerSync/Messages/TriggerResyncMessage.cs index 6e99f463..f08de5bf 100644 --- a/QSB/TriggerSync/Messages/TriggerResyncMessage.cs +++ b/QSB/TriggerSync/Messages/TriggerResyncMessage.cs @@ -21,18 +21,13 @@ namespace QSB.TriggerSync.Messages public override void Serialize(NetworkWriter writer) { base.Serialize(writer); - writer.Write(_playerIds.Length); - _playerIds.ForEach(writer.Write); + writer.WriteArray(_playerIds); } public override void Deserialize(NetworkReader reader) { base.Deserialize(reader); - _playerIds = new uint[reader.ReadInt()]; - for (var i = 0; i < _playerIds.Length; i++) - { - _playerIds[i] = reader.ReadUInt(); - } + _playerIds = reader.ReadArray(); } public override void OnReceiveRemote()