Example #1
0
 internal void DeserializeImp(SimpleDataSerializer s)
 {
     try {
         LogCalled();
         for (ushort i = 0; i < SegmentBuffer.Length; ++i)
         {
             SegmentBuffer[i].Deserialize(s);
         }
         for (int i = 0; i < SegmentEndBuffer.Length; ++i)
         {
             SegmentEndBuffer[i].Deserialize(s);
         }
         //for (ushort i = 0; i < NodeBuffer.Length; ++i) {
         //  NodeBuffer[i].Serialize(s);
         //}
         uint n = s.ReadUInt32();
         for (uint i = 0; i < n; ++i)
         {
             uint laneID = s.ReadUInt32();
             LaneBuffer[laneID].Deserialize(s);
         }
     } catch (Exception ex) {
         ex.Log();
     }
 }
        internal void DeserializeImp(SimpleDataSerializer s)
        {
            try {
                Assertion.NotNull(s);
                LogCalled("s.version=" + s.Version);
                for (ushort i = 0; i < SegmentBuffer.Length; ++i)
                {
                    SegmentBuffer[i].Deserialize(s);
                }
            } catch (Exception ex) { ex.Log("failed to deserialize segments"); }
            try {
                for (int i = 0; i < SegmentEndBuffer.Length; ++i)
                {
                    SegmentEndBuffer[i].Deserialize(s);
                }
            } catch (Exception ex) { ex.Log("failed to deserialize segment ends"); }
            try {
                for (ushort i = 0; i < NodeBuffer.Length; ++i)
                {
                    NodeBuffer[i].Deserialize(s);
                }
            } catch (Exception ex) { ex.Log("failed to deserialize nodes"); }

            try {
                uint n = s.ReadUInt32();
                Assertion.GT((uint)LaneBuffer.Length, n, "LaneBuffer.Length > n");
                Log.Debug($"deserializing {n} lanes");
                for (uint i = 0; i < n; ++i)
                {
                    uint laneID = s.ReadUInt32();
                    Assertion.GT((uint)LaneBuffer.Length, laneID, "LaneBuffer.Length > laneID");
                    LaneBuffer[laneID].Deserialize(s);
                }
            } catch (Exception ex) {
                ex.Log($"failed to deserialize lanes");
            }
        }