예제 #1
0
파일: MockCPU.cs 프로젝트: rte-se/emul8
		public override void Load(PrimitiveReader reader)
		{
			var present = reader.ReadBoolean();
			if(present)
			{
				Placeholder = reader.ReadString();
			}
		}
예제 #2
0
파일: MappedMemory.cs 프로젝트: emul8/emul8
 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));
 }