コード例 #1
0
 public static void ReadStreamedObject(BinaryReader reader, IStreamedObject StreamedObject, object options)
 {
     if (ReadValueType(reader) == ValueType.StreamedObject)
     {
         reader.ReadInt64();
         StreamedObject.ReadStream(reader, options);
     }
     else
     {
         InvalidPropError(reader.BaseStream.Position - sizeof(byte));
     }
 }
コード例 #2
0
        public static void WriteStreamedObject(BinaryWriter writer, IStreamedObject StreamedObject)
        {
            // This version doesn't write a tag before the StreamedObject
            if (StreamedObject == null)
            {
                return;
            }
            WriteValueType(writer, ValueType.StreamedObject);
            var  pos = writer.BaseStream.Position;
            long L   = 0;

            writer.Write(L); // Reserve the place for the size of the block
            StreamedObject.WriteStream(writer, null);
            var pos2 = writer.BaseStream.Position;

            writer.BaseStream.Seek(pos, SeekOrigin.Begin);
            L = pos2 - pos - sizeof(long);
            writer.Write(L);
            writer.BaseStream.Seek(pos2, SeekOrigin.Begin);
        }
コード例 #3
0
        public static void WriteStreamedObject(BinaryWriter writer, IStreamedObject StreamedObject, Tags tag,
                                               object options)
        {
            if (StreamedObject == null)
            {
                return;
            }
            WriteTag(writer, tag);
            WriteValueType(writer, ValueType.StreamedObject);
            var  pos = writer.BaseStream.Position;
            long L   = 0;

            writer.Write(L); // Reserve the place for the size of the block
            StreamedObject.WriteStream(writer, options);
            var pos2 = writer.BaseStream.Position;

            writer.BaseStream.Seek(pos, SeekOrigin.Begin);
            L = pos2 - pos - sizeof(long);
            writer.Write(L);
            writer.BaseStream.Seek(pos2, SeekOrigin.Begin);
        }
コード例 #4
0
        public static void WriteTypedStreamedObject(BinaryWriter writer, IStreamedObject StreamedObject, Tags tag,
                                                    object options)
        {
            if (StreamedObject == null)
            {
                return;
            }
            WriteTag(writer, tag);
            WriteValueType(writer, ValueType.TypedStreamedObject);
            var  pos = writer.BaseStream.Position;
            long L   = 0;

            writer.Write(L); // Reserve the place for the size of the block
            // First write the type of the object - later on it'll be used to recreate the object
            WriteType(writer, StreamedObject.GetType());
            StreamedObject.WriteStream(writer, options);
            var pos2 = writer.BaseStream.Position;

            writer.BaseStream.Seek(pos, SeekOrigin.Begin);
            L = pos2 - pos - sizeof(long);
            writer.Write(L);
            writer.BaseStream.Seek(pos2, SeekOrigin.Begin);
        }
コード例 #5
0
 public static void ReadStreamedObject(BinaryReader reader, IStreamedObject StreamedObject)
 {
     ReadStreamedObject(reader, StreamedObject, null);
 }
コード例 #6
0
 public static void WriteTypedStreamedObject(BinaryWriter writer, IStreamedObject StreamedObject, Tags tag)
 {
     WriteTypedStreamedObject(writer, StreamedObject, tag, null);
 }