public void Skip(MemoryStream memoryStream)
 {
     memoryStream.ReadByte();
     memoryStream.ReadByte();
     memoryStream.ReadLEShort();
     byte typeId;
     do
     {
         typeId = memoryStream.PeekByte();
         var handler = BinarySerializationSegment.GetFor(typeId);
         handler.Skip(memoryStream);
     } while (typeId != BinarySerializationSegment.EndVariableLengthObjectSegment.TypeId);
 }
 public void Skip(MemoryStream memoryStream)
 {
     SkipPrefix(memoryStream);
     memoryStream.ReadStringHaving7bitVariableLengthInt32Prefix();
     short propertyCount = memoryStream.ReadLEShort();
     memoryStream.ReadLEShort();
     for (int i = 0; i < propertyCount; i++)
     {
         memoryStream.ReadStringHaving7bitVariableLengthInt32Prefix();
     }
     var propertyTypes = new List<byte>();
     for (int i = 0; i < propertyCount; i++)
     {
         propertyTypes.Add((byte)memoryStream.ReadByte());
     }
     int referencePropertyCount = propertyTypes.Count(x => x == (int)BinarySerializationPropertyType.Reference);
     for (int i = 0; i < referencePropertyCount; i++)
     {
         memoryStream.ReadStringHaving7bitVariableLengthInt32Prefix();
     }
     for (int i = 0; i < referencePropertyCount; i++)
     {
         byte typeId = memoryStream.PeekByte();
         var handler = BinarySerializationSegment.GetFor(typeId);
         handler.Skip(memoryStream);
     }
     byte nextTypeId = memoryStream.PeekByte();
     if (nextTypeId == BinarySerializationSegment.EndVariableLengthObjectSegment.TypeId)
     {
         BinarySerializationSegment.EndVariableLengthObjectSegment.Handler.Skip(memoryStream);
         nextTypeId = memoryStream.PeekByte();
     }
     if (nextTypeId != BinarySerializationSegment.VariableLengthObjectSegment.TypeId)
     {
         throw new ArgumentException("Expected next segment to be " + BinarySerializationSegment.VariableLengthObjectSegment.TypeId
                                     + " but was " + nextTypeId);
     }
     // the next segment should contain the text of the StackTrace
 }
 public void Skip(MemoryStream memoryStream)
 {
     memoryStream.ReadByte();
     memoryStream.ReadLEShort();
     memoryStream.ReadLEShort();
     memoryStream.ReadStringHaving7bitVariableLengthInt32Prefix();
     byte typeId;
     do
     {
         typeId = memoryStream.PeekByte();
         var handler = BinarySerializationSegment.GetFor(typeId);
         handler.Skip(memoryStream);
     } while (typeId != BinarySerializationSegment.EndVariableLengthObjectSegment.TypeId &&
              typeId != BinarySerializationSegment.ObjectReferenceSegment.TypeId);
 }
 private static void FindStackTraceSegment(MemoryStream stream)
 {
     stream.Position = 0;
     new BinarySerializationHeaderSegment().Skip(stream);
     var assemblyInfoSegment = BinarySerializationSegment.AssemblyInfoSegment.Handler;
     if (assemblyInfoSegment.IsMatch(stream))
     {
         assemblyInfoSegment.Skip(stream);
     }
     var exceptionClassSegment = new BinarySerializationPartialExceptionClassSegment();
     if (!exceptionClassSegment.IsMatch(stream))
     {
         throw new ArgumentException(String.Format("don't know how to handle segment type '0x{0:x2}'", stream.PeekByte()));
     }
     exceptionClassSegment.Skip(stream);
     exceptionClassSegment.SkipPrefix(stream);
 }
 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.RuntimeClassSegment.TypeId ||
            typeId == BinarySerializationSegment.ExternalClassSegment.TypeId;
 }
 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.ObjectReferenceSegment.TypeId;
 }
 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.BoxedPrimitiveSegment.TypeId;
 }
 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.ExternalVariableLengthObjectSegment.TypeId;
 }
 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.AssemblyInfoSegment.TypeId;
 }