public override void Load(PrimitiveReader reader) { var present = reader.ReadBoolean(); if(present) { Placeholder = reader.ReadString(); } }
public void Load(PrimitiveReader reader) { // checking magic var magic = reader.ReadUInt32(); if(magic != Magic) { throw new InvalidOperationException("Memory: Cannot resume state from stream: Invalid magic."); } SegmentSize = reader.ReadInt32(); size = reader.ReadUInt32(); if(emptyCtorUsed) { Init(); } var realSegmentsCount = 0; for(var i = 0; i < segments.Length; i++) { var isTouched = reader.ReadBoolean(); if(!isTouched) { continue; } var compressedSegmentSize = reader.ReadInt32(); var compressedBuffer = reader.ReadBytes(compressedSegmentSize); TouchSegment(i); realSegmentsCount++; LZ4Codec.Decode64(compressedBuffer, segments[i], SegmentSize); } this.NoisyLog(string.Format("{0} segments loaded from stream, of which {1} had content.", segments.Length, realSegmentsCount)); }