示例#1
0
 public static ReadOnlyMemorySlice <byte> LockExtractMemory(IBinaryReadStream stream, long min, long max)
 {
     lock (stream)
     {
         stream.Position = min;
         var size = checked ((int)(max - min));
         if (stream.IsPersistantBacking)
         {
             return(stream.ReadMemory(size));
         }
         else
         {
             byte[] data = new byte[size];
             stream.Read(data);
             return(data);
         }
     }
 }