public void Serialize(SimpleDataSerializer s) { try { LogCalled(); for (ushort i = 0; i < SegmentBuffer.Length; ++i) { SegmentBuffer[i].Serialize(s); } for (int i = 0; i < SegmentEndBuffer.Length; ++i) { SegmentEndBuffer[i].Serialize(s); } //for (ushort i = 0; i < NodeBuffer.Length; ++i) { // NodeBuffer[i].Serialize(s); //} uint n = (uint)LaneBuffer.LongCount(_l => !_l.IsEmpty); s.WriteUInt32(n); for (uint i = 0; i < LaneBuffer.Length; ++i) { if (LaneBuffer[i].IsEmpty) { continue; } s.WriteUInt32(i); LaneBuffer[i].Serialize(s); } } catch (Exception ex) { ex.Log(); } }
public void Serialize(SimpleDataSerializer s) { try { Assertion.NotNull(s); LogCalled("s.version=" + s.Version); for (ushort i = 0; i < SegmentBuffer.Length; ++i) { SegmentBuffer[i].Serialize(s); } } catch (Exception ex) { ex.Log(); } try { for (int i = 0; i < SegmentEndBuffer.Length; ++i) { SegmentEndBuffer[i].Serialize(s); } } catch (Exception ex) { ex.Log(); } try { for (ushort i = 0; i < NodeBuffer.Length; ++i) { NodeBuffer[i].Serialize(s); } } catch (Exception ex) { ex.Log(); } try { var n0 = LaneBuffer.LongCount(_l => !_l.IsEmpty); uint n = (uint)(ulong)n0; Assertion.GT((uint)LaneBuffer.Length, n, $"LaneBuffer.Length > n | n0 = {n0}"); s.WriteUInt32(n); Log.Debug($"Serializing {n} lanes"); for (uint i = 0; i < LaneBuffer.Length; ++i) { if (LaneBuffer[i].IsEmpty) { continue; } s.WriteUInt32(i); LaneBuffer[i].Serialize(s); } } catch (Exception ex) { ex.Log(); } }