Exemplo n.º 1
0
        internal void ReadAssembly(BinaryHeaderEnum binaryHeaderEnum)
        {
            SerTrace.Log(this, "ReadAssembly");
            BinaryAssembly record = new BinaryAssembly();

            if (binaryHeaderEnum == BinaryHeaderEnum.CrossAppDomainAssembly)
            {
                BinaryCrossAppDomainAssembly crossAppDomainAssembly = new BinaryCrossAppDomainAssembly();
                crossAppDomainAssembly.Read(this);
                crossAppDomainAssembly.Dump();
                record.assemId        = crossAppDomainAssembly.assemId;
                record.assemblyString = objectReader.CrossAppDomainArray(crossAppDomainAssembly.assemblyIndex) as String;
                if (record.assemblyString == null)
                {
                    throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_CrossAppDomainError"), "String", crossAppDomainAssembly.assemblyIndex));
                }
            }
            else
            {
                record.Read(this);
                record.Dump();
            }

            AssemIdToAssemblyTable[record.assemId] = new BinaryAssemblyInfo(record.assemblyString);
        }
Exemplo n.º 2
0
        private void ReadObjectNull(BinaryHeaderEnum binaryHeaderEnum)
        {
            if (_objectNull == null)
            {
                _objectNull = new ObjectNull();
            }
            _objectNull.Read(this, binaryHeaderEnum);

            ObjectProgress objectOp = (ObjectProgress)_stack.Peek();

            PRs.Init();
            PRs._parseTypeEnum   = InternalParseTypeE.Member;
            PRs._memberValueEnum = InternalMemberValueE.Null;

            if (objectOp._objectTypeEnum == InternalObjectTypeE.Object)
            {
                PRs._memberTypeEnum = InternalMemberTypeE.Field;
                PRs._name           = objectOp._name;
                PRs._dtType         = objectOp._dtType;
            }
            else
            {
                PRs._memberTypeEnum = InternalMemberTypeE.Item;
                PRs._consecutiveNullArrayEntryCount = _objectNull._nullCount;
                //only one null position has been incremented by GetNext
                //The position needs to be reset for the rest of the nulls
                objectOp.ArrayCountIncrement(_objectNull._nullCount - 1);
            }
            _objectReader.Parse(PRs);
        }
Exemplo n.º 3
0
        private void ReadObjectNull(BinaryHeaderEnum binaryHeaderEnum)
        {
            SerTrace.Log(this, "ReadObjectNull ");

            if (objectNull == null)
            {
                objectNull = new ObjectNull();
            }

            objectNull.Read(this, binaryHeaderEnum);
            objectNull.Dump();

            ObjectProgress objectOp = (ObjectProgress)stack.Peek();

            prs.Init();
            prs.PRparseTypeEnum   = InternalParseTypeE.Member;
            prs.PRmemberValueEnum = InternalMemberValueE.Null;

            if (objectOp.objectTypeEnum == InternalObjectTypeE.Object)
            {
                prs.PRmemberTypeEnum = InternalMemberTypeE.Field;
                prs.PRname           = objectOp.name;
                prs.PRdtType         = objectOp.dtType;
            }
            else
            {
                prs.PRmemberTypeEnum = InternalMemberTypeE.Item;
                prs.PRnullCount      = objectNull.nullCount;
                //only one null position has been incremented by GetNext
                //The position needs to be reset for the rest of the nulls
                objectOp.ArrayCountIncrement(objectNull.nullCount - 1);
            }
            objectReader.Parse(prs);
        }
Exemplo n.º 4
0
        internal void ReadMemberReference(BinaryHeaderEnum binaryHeaderEnum)
        {
            MemberReference memberReference = new MemberReference();

            memberReference.Read(reader);
            Dumper.Dump("MemberReference", memberReference);
        }
Exemplo n.º 5
0
        internal void ReadMemberPrimitiveTyped(BinaryHeaderEnum binaryHeaderEnum)
        {
            MemberPrimitiveTyped memberPrimitiveTyped = new MemberPrimitiveTyped();

            memberPrimitiveTyped.Read(reader);
            Dumper.Dump("Boxed Primitive", memberPrimitiveTyped);
        }
Exemplo n.º 6
0
        private void ReadObjectNull(BinaryHeaderEnum binaryHeaderEnum)
        {
            if (this.objectNull == null)
            {
                this.objectNull = new ObjectNull();
            }
            this.objectNull.Read(this, binaryHeaderEnum);
            this.objectNull.Dump();
            ObjectProgress objectProgress = (ObjectProgress)this.stack.Peek();

            this.prs.Init();
            this.prs.PRparseTypeEnum   = InternalParseTypeE.Member;
            this.prs.PRmemberValueEnum = InternalMemberValueE.Null;
            if (objectProgress.objectTypeEnum == InternalObjectTypeE.Object)
            {
                this.prs.PRmemberTypeEnum = InternalMemberTypeE.Field;
                this.prs.PRname           = objectProgress.name;
                this.prs.PRdtType         = objectProgress.dtType;
            }
            else
            {
                this.prs.PRmemberTypeEnum = InternalMemberTypeE.Item;
                this.prs.PRnullCount      = this.objectNull.nullCount;
                objectProgress.ArrayCountIncrement(this.objectNull.nullCount - 1);
            }
            this.objectReader.Parse(this.prs);
        }
Exemplo n.º 7
0
        internal void ReadObjectNull(BinaryHeaderEnum binaryHeaderEnum)
        {
            ObjectNull objectNull = new ObjectNull(binaryHeaderEnum);

            objectNull.Read(reader);
            Dumper.Dump("null", objectNull);
        }
Exemplo n.º 8
0
        private void ReadObjectNull(BinaryHeaderEnum binaryHeaderEnum)
        {
            if (_objectNull == null)
            {
                _objectNull = new ObjectNull();
            }
            _objectNull.Set(_objectNull.NullCount, binaryHeaderEnum);
            _objectNull.Read(this);
            ObjectProgress progress = (ObjectProgress)stack.Peek();

            PRs.Init();
            PRs.parseTypeEnum   = ParseTypeEnum.Member;
            PRs.memberValueEnum = MemberValueEnum.Null;
            if (progress._objectTypeEnum == ObjectTypeEnum.Object)
            {
                PRs.memberTypeEnum = MemberTypeEnum.Field;
                PRs.name           = progress._name;
                PRs.dtType         = progress._dtType;
            }
            else
            {
                PRs.memberTypeEnum = MemberTypeEnum.Item;
                PRs.consecutiveNullArrayEntryCount = _objectNull.NullCount;
                progress.ArrayCountIncrement(_objectNull.NullCount - 1);
            }
            objectReader.Parse(PRs);
        }
Exemplo n.º 9
0
        internal void Set(int objectId, int rank, int[] lengthA, int[] lowerBoundA, BinaryTypeEnum binaryTypeEnum, object typeInformation, BinaryArrayTypeEnum binaryArrayTypeEnum, int assemId)
        {
            _objectId = objectId;
            _binaryArrayTypeEnum = binaryArrayTypeEnum;
            _rank = rank;
            _lengthA = lengthA;
            _lowerBoundA = lowerBoundA;
            _binaryTypeEnum = binaryTypeEnum;
            _typeInformation = typeInformation;
            _assemId = assemId;

            _binaryHeaderEnum = BinaryHeaderEnum.Array;
            if (binaryArrayTypeEnum == BinaryArrayTypeEnum.Single)
            {
                if (binaryTypeEnum == BinaryTypeEnum.Primitive)
                {
                    _binaryHeaderEnum = BinaryHeaderEnum.ArraySinglePrimitive;
                }
                else if (binaryTypeEnum == BinaryTypeEnum.String)
                {
                    _binaryHeaderEnum = BinaryHeaderEnum.ArraySingleString;
                }
                else if (binaryTypeEnum == BinaryTypeEnum.Object)
                {
                    _binaryHeaderEnum = BinaryHeaderEnum.ArraySingleObject;
                }
            }
        }
Exemplo n.º 10
0
 internal void Set(int objectId, int rank, int[] lengthA, int[] lowerBoundA, BinaryTypeEnum binaryTypeEnum, object typeInformation, BinaryArrayTypeEnum binaryArrayTypeEnum, int assemId)
 {
     this.objectId            = objectId;
     this.binaryArrayTypeEnum = binaryArrayTypeEnum;
     this.rank             = rank;
     this.lengthA          = lengthA;
     this.lowerBoundA      = lowerBoundA;
     this.binaryTypeEnum   = binaryTypeEnum;
     this.typeInformation  = typeInformation;
     this.assemId          = assemId;
     this.binaryHeaderEnum = BinaryHeaderEnum.Array;
     if (binaryArrayTypeEnum != BinaryArrayTypeEnum.Single)
     {
         return;
     }
     if (binaryTypeEnum == BinaryTypeEnum.Primitive)
     {
         this.binaryHeaderEnum = BinaryHeaderEnum.ArraySinglePrimitive;
     }
     else if (binaryTypeEnum == BinaryTypeEnum.String)
     {
         this.binaryHeaderEnum = BinaryHeaderEnum.ArraySingleString;
     }
     else
     {
         if (binaryTypeEnum != BinaryTypeEnum.Object)
         {
             return;
         }
         this.binaryHeaderEnum = BinaryHeaderEnum.ArraySingleObject;
     }
 }
Exemplo n.º 11
0
        internal void Set(int objectId, int rank, int[] lengthA, int[]?lowerBoundA, BinaryTypeEnum binaryTypeEnum, object?typeInformation, BinaryArrayTypeEnum binaryArrayTypeEnum, int assemId)
        {
            _objectId            = objectId;
            _binaryArrayTypeEnum = binaryArrayTypeEnum;
            _rank            = rank;
            _lengthA         = lengthA;
            _lowerBoundA     = lowerBoundA;
            _binaryTypeEnum  = binaryTypeEnum;
            _typeInformation = typeInformation;
            _assemId         = assemId;

            _binaryHeaderEnum = BinaryHeaderEnum.Array;
            if (binaryArrayTypeEnum == BinaryArrayTypeEnum.Single)
            {
                if (binaryTypeEnum == BinaryTypeEnum.Primitive)
                {
                    _binaryHeaderEnum = BinaryHeaderEnum.ArraySinglePrimitive;
                }
                else if (binaryTypeEnum == BinaryTypeEnum.String)
                {
                    _binaryHeaderEnum = BinaryHeaderEnum.ArraySingleString;
                }
                else if (binaryTypeEnum == BinaryTypeEnum.Object)
                {
                    _binaryHeaderEnum = BinaryHeaderEnum.ArraySingleObject;
                }
            }
        }
 internal SerializationHeaderRecord(BinaryHeaderEnum binaryHeaderEnum, int topId, int headerId, int majorVersion, int minorVersion)
 {
     this._binaryHeaderEnum = binaryHeaderEnum;
     this._topId            = topId;
     this._headerId         = headerId;
     this._majorVersion     = majorVersion;
     this._minorVersion     = minorVersion;
 }
Exemplo n.º 13
0
        internal void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryArray record = new BinaryArray(binaryHeaderEnum);

            record.Read(reader);
            Dumper.Dump("BinaryArray", record);
            ReadAndDump(new ArrayOrClassEnumerator(record));
        }
Exemplo n.º 14
0
 internal SerializationHeaderRecord(BinaryHeaderEnum binaryHeaderEnum, int topId, int headerId, int majorVersion, int minorVersion)
 {
     _binaryHeaderEnum = binaryHeaderEnum;
     _topId = topId;
     _headerId = headerId;
     _majorVersion = majorVersion;
     _minorVersion = minorVersion;
 }
Exemplo n.º 15
0
 internal SerializationHeaderRecord(BinaryHeaderEnum binaryHeaderEnum, int topId, int headerId, int majorVersion, int minorVersion)
 {
     this.binaryFormatterMajorVersion = 1;
     this.binaryHeaderEnum            = binaryHeaderEnum;
     this.topId        = topId;
     this.headerId     = headerId;
     this.majorVersion = majorVersion;
     this.minorVersion = minorVersion;
 }
Exemplo n.º 16
0
 public void Read(BinaryReader input)
 {
     // binaryHeaderEnum has already been read
     binaryHeaderEnum = (BinaryHeaderEnum)input.ReadByte();
     topId            = input.ReadInt32();
     headerId         = input.ReadInt32();
     majorVersion     = input.ReadInt32();
     minorVersion     = input.ReadInt32();
 }
Exemplo n.º 17
0
 internal void Set(int objectId, string name, int numMembers, string[] memberNames, int assemId)
 {
     this.ObjectId         = objectId;
     this.Name             = name;
     this.NumMembers       = numMembers;
     this.MemberNames      = memberNames;
     this.AssemId          = assemId;
     this.BinaryHeaderEnum = (assemId > 0) ? BinaryHeaderEnum.ObjectWithMapAssemId : BinaryHeaderEnum.ObjectWithMap;
 }
 internal SerializationHeaderRecord(BinaryHeaderEnum binaryHeaderEnum, int topId, int headerId, int majorVersion, int minorVersion)
 {
     this.binaryFormatterMajorVersion = 1;
     this.binaryHeaderEnum = binaryHeaderEnum;
     this.topId = topId;
     this.headerId = headerId;
     this.majorVersion = majorVersion;
     this.minorVersion = minorVersion;
 }
 private void DumpInternal()
 {
     if (BCLDebug.CheckEnabled("BINARY"))
     {
         for (int i = 0; i < this.numMembers; i++)
         {
         }
         BinaryHeaderEnum binaryHeaderEnum = this.binaryHeaderEnum;
     }
 }
Exemplo n.º 20
0
        internal void ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryObjectWithMapTyped bowm = new BinaryObjectWithMapTyped();

            bowm.binaryHeaderEnum = binaryHeaderEnum;
            bowm.Read(reader);
            Dumper.Dump("ObjectWithMapTyped", bowm);
            mapIdToMapTable[bowm.objectId] = bowm;
            ReadAndDump(new ArrayOrClassEnumerator(bowm));
        }
Exemplo n.º 21
0
        internal void Set(int objectId, string name, int numMembers, string[] memberNames, int assemId)
        {
            _objectId = objectId;
            _name = name;
            _numMembers = numMembers;
            _memberNames = memberNames;
            _assemId = assemId;

            _binaryHeaderEnum = assemId > 0 ?
                BinaryHeaderEnum.ObjectWithMapAssemId :
                BinaryHeaderEnum.ObjectWithMap;
        }
Exemplo n.º 22
0
        internal void Set(int objectId, string name, int numMembers, string[] memberNames, int assemId)
        {
            _objectId    = objectId;
            _name        = name;
            _numMembers  = numMembers;
            _memberNames = memberNames;
            _assemId     = assemId;

            _binaryHeaderEnum = assemId > 0 ?
                                BinaryHeaderEnum.ObjectWithMapAssemId :
                                BinaryHeaderEnum.ObjectWithMap;
        }
Exemplo n.º 23
0
 internal void ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
 {
     if (this.bowmt == null)
     {
         this.bowmt = new BinaryObjectWithMapTyped(binaryHeaderEnum);
     }
     else
     {
         this.bowmt.binaryHeaderEnum = binaryHeaderEnum;
     }
     this.bowmt.Read(this);
     this.ReadObjectWithMapTyped(this.bowmt);
 }
Exemplo n.º 24
0
 internal void ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
 {
     if (_bowmt == null)
     {
         _bowmt = new BinaryObjectWithMapTyped(binaryHeaderEnum);
     }
     else
     {
         _bowmt._binaryHeaderEnum = binaryHeaderEnum;
     }
     _bowmt.Read(this);
     ReadObjectWithMapTyped(_bowmt);
 }
Exemplo n.º 25
0
 internal void ReadObjectWithMap(BinaryHeaderEnum binaryHeaderEnum)
 {
     if (_bowm == null)
     {
         _bowm = new BinaryObjectWithMap(binaryHeaderEnum);
     }
     else
     {
         _bowm._binaryHeaderEnum = binaryHeaderEnum;
     }
     _bowm.Read(this);
     ReadObjectWithMap(_bowm);
 }
Exemplo n.º 26
0
 internal void ReadObjectWithMap(BinaryHeaderEnum binaryHeaderEnum)
 {
     if (this.bowm == null)
     {
         this.bowm = new BinaryObjectWithMap(binaryHeaderEnum);
     }
     else
     {
         this.bowm.binaryHeaderEnum = binaryHeaderEnum;
     }
     this.bowm.Read(this);
     this.bowm.Dump();
     this.ReadObjectWithMap(this.bowm);
 }
Exemplo n.º 27
0
 internal void ReadObjectWithMap(BinaryHeaderEnum binaryHeaderEnum)
 {
     SerTrace.Log(this, "ReadObjectWithMap");
     if (bowm == null)
     {
         bowm = new BinaryObjectWithMap(binaryHeaderEnum);
     }
     else
     {
         bowm.binaryHeaderEnum = binaryHeaderEnum;
     }
     bowm.Read(this);
     bowm.Dump();
     ReadObjectWithMap(bowm);
 }
Exemplo n.º 28
0
 internal void ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
 {
     SerTrace.Log(this, "ReadObjectWithMapTyped");
     if (bowmt == null)
     {
         bowmt = new BinaryObjectWithMapTyped(binaryHeaderEnum);
     }
     else
     {
         bowmt.binaryHeaderEnum = binaryHeaderEnum;
     }
     bowmt.Read(this);
     bowmt.Dump();
     ReadObjectWithMapTyped(bowmt);
 }
Exemplo n.º 29
0
 internal void ReadObjectString(BinaryHeaderEnum binaryHeaderEnum)
 {
     if (binaryHeaderEnum == BinaryHeaderEnum.ObjectString)
     {
         BinaryObjectString objectString = new BinaryObjectString();
         objectString.Read(reader);
         Dumper.Dump("String", objectString);
     }
     else
     {
         BinaryCrossAppDomainString crossAppDomainString = new BinaryCrossAppDomainString();
         crossAppDomainString.Read(reader);
         Dumper.Dump("CrossAppDomainString", crossAppDomainString);
     }
 }
Exemplo n.º 30
0
 internal void ReadMethodObject(BinaryHeaderEnum binaryHeaderEnum)
 {
     if (binaryHeaderEnum == BinaryHeaderEnum.MethodCall)
     {
         BinaryMethodCall bmc = new BinaryMethodCall();
         bmc.Read(reader);
         Dumper.Dump("Method Call", bmc);
     }
     else
     {
         BinaryMethodReturn bmc = new BinaryMethodReturn();
         bmc.Read(reader);
         Dumper.Dump("Method Call", bmc);
     }
 }
Exemplo n.º 31
0
 internal void ReadAssembly(BinaryHeaderEnum binaryHeaderEnum)
 {
     if (binaryHeaderEnum == BinaryHeaderEnum.CrossAppDomainAssembly)
     {
         BinaryCrossAppDomainAssembly crossAppDomainAssembly = new BinaryCrossAppDomainAssembly();
         crossAppDomainAssembly.Read(reader);
         Dumper.Dump("CrossAppDomainAssembly", crossAppDomainAssembly);
     }
     else
     {
         BinaryAssembly assemblyRecord = new BinaryAssembly();
         assemblyRecord.Read(reader);
         Dumper.Dump("AssemblyRecord", assemblyRecord);
         assemIdToAssemblyTable[assemblyRecord.assemId] = assemblyRecord.assemblyString;
     }
 }
Exemplo n.º 32
0
        internal void Set(int objectId, string name, int numMembers, string[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, object?[] typeInformationA, int[] memberAssemIds, int assemId)
        {
            _objectId         = objectId;
            _assemId          = assemId;
            _name             = name;
            _numMembers       = numMembers;
            _memberNames      = memberNames;
            _binaryTypeEnumA  = binaryTypeEnumA;
            _typeInformationA = typeInformationA;
            _memberAssemIds   = memberAssemIds;
            _assemId          = assemId;

            _binaryHeaderEnum = assemId > 0 ?
                                BinaryHeaderEnum.ObjectWithMapTypedAssemId :
                                BinaryHeaderEnum.ObjectWithMapTyped;
        }
 internal void Set(int objectId, string name, int numMembers, string[] memberNames, int assemId)
 {
     this.objectId    = objectId;
     this.name        = name;
     this.numMembers  = numMembers;
     this.memberNames = memberNames;
     this.assemId     = assemId;
     if (assemId > 0)
     {
         this.binaryHeaderEnum = BinaryHeaderEnum.ObjectWithMapAssemId;
     }
     else
     {
         this.binaryHeaderEnum = BinaryHeaderEnum.ObjectWithMap;
     }
 }
Exemplo n.º 34
0
        internal void Set(int objectId, string name, int numMembers, string[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, object[] typeInformationA, int[] memberAssemIds, int assemId)
        {
            _objectId = objectId;
            _assemId = assemId;
            _name = name;
            _numMembers = numMembers;
            _memberNames = memberNames;
            _binaryTypeEnumA = binaryTypeEnumA;
            _typeInformationA = typeInformationA;
            _memberAssemIds = memberAssemIds;
            _assemId = assemId;

            _binaryHeaderEnum = assemId > 0 ?
                 BinaryHeaderEnum.ObjectWithMapTypedAssemId :
                 BinaryHeaderEnum.ObjectWithMapTyped;
        }
Exemplo n.º 35
0
 public void Read(BinaryParser input, BinaryHeaderEnum binaryHeaderEnum)
 {
     //binaryHeaderEnum = input.ReadByte(); already read
     switch (binaryHeaderEnum)
     {
         case BinaryHeaderEnum.ObjectNull:
             _nullCount = 1;
             break;
         case BinaryHeaderEnum.ObjectNullMultiple256:
             _nullCount = input.ReadByte();
             break;
         case BinaryHeaderEnum.ObjectNullMultiple:
             _nullCount = input.ReadInt32();
             break;
     }
 }
 internal void Set(int objectId, string name, int numMembers, string[] memberNames, int assemId)
 {
     this.objectId = objectId;
     this.name = name;
     this.numMembers = numMembers;
     this.memberNames = memberNames;
     this.assemId = assemId;
     if (assemId > 0)
     {
         this.binaryHeaderEnum = BinaryHeaderEnum.ObjectWithMapAssemId;
     }
     else
     {
         this.binaryHeaderEnum = BinaryHeaderEnum.ObjectWithMap;
     }
 }
 public void Read(__BinaryParser input)
 {
     byte[] buffer = input.ReadBytes(0x11);
     if (buffer.Length < 0x11)
     {
         __Error.EndOfFile();
     }
     this.majorVersion = GetInt32(buffer, 9);
     if (this.majorVersion > this.binaryFormatterMajorVersion)
     {
         throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFormat", new object[] { BitConverter.ToString(buffer) }));
     }
     this.binaryHeaderEnum = (BinaryHeaderEnum) buffer[0];
     this.topId = GetInt32(buffer, 1);
     this.headerId = GetInt32(buffer, 5);
     this.minorVersion = GetInt32(buffer, 13);
 }
Exemplo n.º 38
0
        public void Read(__BinaryParser input, BinaryHeaderEnum binaryHeaderEnum)
        {
            switch (binaryHeaderEnum)
            {
            case BinaryHeaderEnum.ObjectNull:
                this.nullCount = 1;
                break;

            case BinaryHeaderEnum.ObjectNullMultiple256:
                this.nullCount = (int)input.ReadByte();
                break;

            case BinaryHeaderEnum.ObjectNullMultiple:
                this.nullCount = input.ReadInt32();
                break;
            }
        }
 internal void Set(int objectId, string name, int numMembers, string[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, object[] typeInformationA, int[] memberAssemIds, int assemId)
 {
     this.objectId = objectId;
     this.assemId = assemId;
     this.name = name;
     this.numMembers = numMembers;
     this.memberNames = memberNames;
     this.binaryTypeEnumA = binaryTypeEnumA;
     this.typeInformationA = typeInformationA;
     this.memberAssemIds = memberAssemIds;
     this.assemId = assemId;
     if (assemId > 0)
     {
         this.binaryHeaderEnum = BinaryHeaderEnum.ObjectWithMapTypedAssemId;
     }
     else
     {
         this.binaryHeaderEnum = BinaryHeaderEnum.ObjectWithMapTyped;
     }
 }
Exemplo n.º 40
0
        public void Read(BinaryParser input)
        {
            byte[] headerBytes = input.ReadBytes(17);

            // Throw if we couldnt read header bytes
            if (headerBytes.Length < 17)
            {
                throw new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF);
            }

            _majorVersion = GetInt32(headerBytes, 9);
            if (_majorVersion > BinaryFormatterMajorVersion)
            {
                throw new SerializationException(SR.Format(SR.Serialization_InvalidFormat, BitConverter.ToString(headerBytes)));
            }

            // binaryHeaderEnum has already been read
            _binaryHeaderEnum = (BinaryHeaderEnum)headerBytes[0];
            _topId = GetInt32(headerBytes, 1);
            _headerId = GetInt32(headerBytes, 5);
            _minorVersion = GetInt32(headerBytes, 13);
        }
        public void Read(__BinaryParser input, BinaryHeaderEnum binaryHeaderEnum)
        {
            switch (binaryHeaderEnum)
            {
                case BinaryHeaderEnum.ObjectNull:
                    this.nullCount = 1;
                    return;

                case BinaryHeaderEnum.MessageEnd:
                case BinaryHeaderEnum.Assembly:
                    break;

                case BinaryHeaderEnum.ObjectNullMultiple256:
                    this.nullCount = input.ReadByte();
                    return;

                case BinaryHeaderEnum.ObjectNullMultiple:
                    this.nullCount = input.ReadInt32();
                    break;

                default:
                    return;
            }
        }
Exemplo n.º 42
0
 internal void ReadObjectWithMap(BinaryHeaderEnum binaryHeaderEnum)
 {
     if (_bowm == null)
     {
         _bowm = new BinaryObjectWithMap(binaryHeaderEnum);
     }
     else
     {
         _bowm._binaryHeaderEnum = binaryHeaderEnum;
     }
     _bowm.Read(this);
     ReadObjectWithMap(_bowm);
 }
Exemplo n.º 43
0
        internal void ReadAssembly(BinaryHeaderEnum binaryHeaderEnum)
        {
            var record = new BinaryAssembly();
            if (binaryHeaderEnum == BinaryHeaderEnum.CrossAppDomainAssembly)
            {
                var crossAppDomainAssembly = new BinaryCrossAppDomainAssembly();
                crossAppDomainAssembly.Read(this);
                record._assemId = crossAppDomainAssembly._assemId;
                record._assemblyString = _objectReader.CrossAppDomainArray(crossAppDomainAssembly._assemblyIndex) as string;
                if (record._assemblyString == null)
                {
                    throw new SerializationException(SR.Format(SR.Serialization_CrossAppDomainError, "String", crossAppDomainAssembly._assemblyIndex));
                }
            }
            else
            {
                record.Read(this);
            }

            AssemIdToAssemblyTable[record._assemId] = new BinaryAssemblyInfo(record._assemblyString);
        }
Exemplo n.º 44
0
        [System.Security.SecurityCritical]  // auto-generated
        private void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryAssemblyInfo assemblyInfo = null;
            SerTrace.Log( this, "ReadArray ");
            BinaryArray record = new BinaryArray(binaryHeaderEnum);
            record.Read(this);
#if _DEBUG                        
            record.Dump();

            SerTrace.Log( this, "Read 1 ",((Enum)binaryHeaderEnum).ToString());
#endif
            if (record.binaryTypeEnum == BinaryTypeEnum.ObjectUser)
            {
                if (record.assemId < 1)
                    throw new SerializationException(Environment.GetResourceString("Serialization_AssemblyId",record.typeInformation));

                assemblyInfo = (BinaryAssemblyInfo)AssemIdToAssemblyTable[record.assemId];
                SerTrace.Log( this, "ReadArray  lookup assemIdToAssembly assemId ",record.assemId," assembly ",assemblyInfo.assemblyString);                                
            }
            else
                assemblyInfo = SystemAssemblyInfo; //Urt assembly

            ObjectProgress op = GetOp();
            ParseRecord pr = op.pr;

            op.objectTypeEnum = InternalObjectTypeE.Array;
            op.binaryTypeEnum = record.binaryTypeEnum;
            op.typeInformation = record.typeInformation;

            ObjectProgress objectOp = (ObjectProgress)stack.PeekPeek();
            if ((objectOp == null) || (record.objectId > 0))
            {
                // Non-Nested Object
                op.name = "System.Array";
                pr.PRparseTypeEnum = InternalParseTypeE.Object;
                op.memberValueEnum = InternalMemberValueE.Empty;                                    
            }
            else
            {
                // Nested Object            
                pr.PRparseTypeEnum = InternalParseTypeE.Member;
                pr.PRmemberValueEnum = InternalMemberValueE.Nested;
                op.memberValueEnum = InternalMemberValueE.Nested;                       

                switch (objectOp.objectTypeEnum)
                {
                case InternalObjectTypeE.Object:
                    pr.PRname = objectOp.name;                                  
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Field;
                    op.memberTypeEnum = InternalMemberTypeE.Field;                  
                    pr.PRkeyDt = objectOp.name;
                    pr.PRdtType = objectOp.dtType;
                    break;
                case InternalObjectTypeE.Array:
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Item;
                    op.memberTypeEnum = InternalMemberTypeE.Item;                   
                    break;
                default:
                    throw new SerializationException(Environment.GetResourceString("Serialization_ObjectTypeEnum",((Enum)objectOp.objectTypeEnum).ToString()));                                              
                }
            }


            pr.PRobjectId = objectReader.GetId((long)record.objectId);
            if (pr.PRobjectId == topId)
                pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
            else if ((headerId > 0) &&(pr.PRobjectId == headerId))
                pr.PRobjectPositionEnum = InternalObjectPositionE.Headers; // Headers are an array of header objects
            else
                pr.PRobjectPositionEnum    = InternalObjectPositionE.Child;

            pr.PRobjectTypeEnum = InternalObjectTypeE.Array;

            BinaryConverter.TypeFromInfo(record.binaryTypeEnum, record.typeInformation, objectReader, assemblyInfo,
                                         out pr.PRarrayElementTypeCode, out pr.PRarrayElementTypeString,
                                         out pr.PRarrayElementType, out pr.PRisArrayVariant);

            pr.PRdtTypeCode = InternalPrimitiveTypeE.Invalid;


            pr.PRrank = record.rank;
            pr.PRlengthA = record.lengthA;
            pr.PRlowerBoundA = record.lowerBoundA;
            bool isPrimitiveArray = false;

            switch (record.binaryArrayTypeEnum)
            {
            case BinaryArrayTypeEnum.Single:
            case BinaryArrayTypeEnum.SingleOffset:                  
                op.numItems = record.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Single;
                if (Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode) &&
                    (record.lowerBoundA[0] == 0))
                {
                    isPrimitiveArray = true;
                    ReadArrayAsBytes(pr);
                }
                break;
            case BinaryArrayTypeEnum.Jagged:
            case BinaryArrayTypeEnum.JaggedOffset:                  
                op.numItems = record.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Jagged;                 
                break;
            case BinaryArrayTypeEnum.Rectangular:
            case BinaryArrayTypeEnum.RectangularOffset:                 
                int arrayLength = 1;
                for (int i=0; i<record.rank; i++)
                    arrayLength = arrayLength*record.lengthA[i];
                op.numItems = arrayLength;
                pr.PRarrayTypeEnum = InternalArrayTypeE.Rectangular;                                        
                break;
            default:
                throw new SerializationException(Environment.GetResourceString("Serialization_ArrayType",((Enum)record.binaryArrayTypeEnum).ToString()));
            }

            if (!isPrimitiveArray)
                stack.Push(op);
            else
            {
                PutOp(op);
            }

            SerTrace.Log( this, "ReadArray ",((Enum)record.binaryArrayTypeEnum).ToString()," length ",op.numItems);             
            objectReader.Parse(pr);

            if (isPrimitiveArray)
            {
                pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
                objectReader.Parse(pr);
            }
        }
Exemplo n.º 45
0
        [System.Security.SecurityCritical]  // auto-generated
        private void ReadObjectString(BinaryHeaderEnum binaryHeaderEnum)
        {
            SerTrace.Log( this, "ReadObjectString");

            if (objectString == null)
                objectString = new BinaryObjectString();

            if (binaryHeaderEnum == BinaryHeaderEnum.ObjectString)
            {
                objectString.Read(this);
                objectString.Dump();
            }
            else
            {
                if (crossAppDomainString == null)
                    crossAppDomainString = new BinaryCrossAppDomainString();
                crossAppDomainString.Read(this);
                crossAppDomainString.Dump();
                objectString.value = objectReader.CrossAppDomainArray(crossAppDomainString.value) as String;
                if (objectString.value == null)
                    throw new SerializationException(Environment.GetResourceString("Serialization_CrossAppDomainError","String", crossAppDomainString.value));

                objectString.objectId = crossAppDomainString.objectId;
            }

            prs.Init();
            prs.PRparseTypeEnum = InternalParseTypeE.Object;
            prs.PRobjectId = objectReader.GetId(objectString.objectId);

            if (prs.PRobjectId == topId)
                prs.PRobjectPositionEnum = InternalObjectPositionE.Top;

            prs.PRobjectTypeEnum = InternalObjectTypeE.Object;

            ObjectProgress objectOp = (ObjectProgress)stack.Peek();

            prs.PRvalue = objectString.value;
            prs.PRkeyDt = "System.String";
            prs.PRdtType = Converter.typeofString;
            prs.PRdtTypeCode = InternalPrimitiveTypeE.Invalid;
            prs.PRvarValue = objectString.value; //Need to set it because ObjectReader is picking up value from variant, not pr.PRvalue

            if (objectOp == null)
            {
                // Top level String
                SerTrace.Log( this, "ReadObjectString, Non-Nested");            
                prs.PRparseTypeEnum = InternalParseTypeE.Object;
                prs.PRname = "System.String";
            }
            else
            {
                // Nested in an Object

                SerTrace.Log( this, "ReadObjectString, Nested");
                prs.PRparseTypeEnum = InternalParseTypeE.Member;
                prs.PRmemberValueEnum = InternalMemberValueE.InlineValue;

                switch (objectOp.objectTypeEnum)
                {
                case InternalObjectTypeE.Object:
                    prs.PRname = objectOp.name;
                    prs.PRmemberTypeEnum = InternalMemberTypeE.Field;
                    break;
                case InternalObjectTypeE.Array:                 
                    prs.PRmemberTypeEnum = InternalMemberTypeE.Item;
                    break;
                default:
                    throw new SerializationException(Environment.GetResourceString("Serialization_ObjectTypeEnum",((Enum)objectOp.objectTypeEnum).ToString()));                      
                }

            }

            objectReader.Parse(prs);
        }
 internal BinaryArray(BinaryHeaderEnum binaryHeaderEnum)
 {
     this.binaryHeaderEnum = binaryHeaderEnum;
 }
Exemplo n.º 47
0
        private void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryAssemblyInfo assemblyInfo = null;
            BinaryArray record = new BinaryArray(binaryHeaderEnum);
            record.Read(this);

            if (record._binaryTypeEnum == BinaryTypeEnum.ObjectUser)
            {
                if (record._assemId < 1)
                {
                    throw new SerializationException(SR.Format(SR.Serialization_AssemblyId, record._typeInformation));
                }
                assemblyInfo = (BinaryAssemblyInfo)AssemIdToAssemblyTable[record._assemId];
            }
            else
            {
                assemblyInfo = SystemAssemblyInfo; //Urt assembly
            }

            ObjectProgress op = GetOp();
            ParseRecord pr = op._pr;

            op._objectTypeEnum = InternalObjectTypeE.Array;
            op._binaryTypeEnum = record._binaryTypeEnum;
            op._typeInformation = record._typeInformation;

            ObjectProgress objectOp = (ObjectProgress)_stack.PeekPeek();
            if ((objectOp == null) || (record._objectId > 0))
            {
                // Non-Nested Object
                op._name = "System.Array";
                pr._parseTypeEnum = InternalParseTypeE.Object;
                op._memberValueEnum = InternalMemberValueE.Empty;
            }
            else
            {
                // Nested Object            
                pr._parseTypeEnum = InternalParseTypeE.Member;
                pr._memberValueEnum = InternalMemberValueE.Nested;
                op._memberValueEnum = InternalMemberValueE.Nested;

                switch (objectOp._objectTypeEnum)
                {
                    case InternalObjectTypeE.Object:
                        pr._name = objectOp._name;
                        pr._memberTypeEnum = InternalMemberTypeE.Field;
                        op._memberTypeEnum = InternalMemberTypeE.Field;
                        pr._keyDt = objectOp._name;
                        pr._dtType = objectOp._dtType;
                        break;
                    case InternalObjectTypeE.Array:
                        pr._memberTypeEnum = InternalMemberTypeE.Item;
                        op._memberTypeEnum = InternalMemberTypeE.Item;
                        break;
                    default:
                        throw new SerializationException(SR.Format(SR.Serialization_ObjectTypeEnum, objectOp._objectTypeEnum.ToString()));
                }
            }

            pr._objectId = _objectReader.GetId(record._objectId);
            if (pr._objectId == _topId)
            {
                pr._objectPositionEnum = InternalObjectPositionE.Top;
            }
            else if ((_headerId > 0) && (pr._objectId == _headerId))
            {
                pr._objectPositionEnum = InternalObjectPositionE.Headers; // Headers are an array of header objects
            }
            else
            {
                pr._objectPositionEnum = InternalObjectPositionE.Child;
            }

            pr._objectTypeEnum = InternalObjectTypeE.Array;

            BinaryTypeConverter.TypeFromInfo(record._binaryTypeEnum, record._typeInformation, _objectReader, assemblyInfo,
                                         out pr._arrayElementTypeCode, out pr._arrayElementTypeString,
                                         out pr._arrayElementType, out pr._isArrayVariant);

            pr._dtTypeCode = InternalPrimitiveTypeE.Invalid;

            pr._rank = record._rank;
            pr._lengthA = record._lengthA;
            pr._lowerBoundA = record._lowerBoundA;
            bool isPrimitiveArray = false;

            switch (record._binaryArrayTypeEnum)
            {
                case BinaryArrayTypeEnum.Single:
                case BinaryArrayTypeEnum.SingleOffset:
                    op._numItems = record._lengthA[0];
                    pr._arrayTypeEnum = InternalArrayTypeE.Single;
                    if (Converter.IsWriteAsByteArray(pr._arrayElementTypeCode) &&
                        (record._lowerBoundA[0] == 0))
                    {
                        isPrimitiveArray = true;
                        ReadArrayAsBytes(pr);
                    }
                    break;
                case BinaryArrayTypeEnum.Jagged:
                case BinaryArrayTypeEnum.JaggedOffset:
                    op._numItems = record._lengthA[0];
                    pr._arrayTypeEnum = InternalArrayTypeE.Jagged;
                    break;
                case BinaryArrayTypeEnum.Rectangular:
                case BinaryArrayTypeEnum.RectangularOffset:
                    int arrayLength = 1;
                    for (int i = 0; i < record._rank; i++)
                        arrayLength = arrayLength * record._lengthA[i];
                    op._numItems = arrayLength;
                    pr._arrayTypeEnum = InternalArrayTypeE.Rectangular;
                    break;
                default:
                    throw new SerializationException(SR.Format(SR.Serialization_ArrayType, record._binaryArrayTypeEnum.ToString()));
            }

            if (!isPrimitiveArray)
            {
                _stack.Push(op);
            }
            else
            {
                PutOp(op);
            }

            _objectReader.Parse(pr);

            if (isPrimitiveArray)
            {
                pr._parseTypeEnum = InternalParseTypeE.ObjectEnd;
                _objectReader.Parse(pr);
            }
        }
Exemplo n.º 48
0
        internal void ReadAssembly(BinaryHeaderEnum binaryHeaderEnum)
        {
            SerTrace.Log( this, "ReadAssembly");
            BinaryAssembly record = new BinaryAssembly();
            if (binaryHeaderEnum == BinaryHeaderEnum.CrossAppDomainAssembly)
            {
                BinaryCrossAppDomainAssembly crossAppDomainAssembly = new BinaryCrossAppDomainAssembly();
                crossAppDomainAssembly.Read(this);
                crossAppDomainAssembly.Dump();
                record.assemId = crossAppDomainAssembly.assemId;
                record.assemblyString = objectReader.CrossAppDomainArray(crossAppDomainAssembly.assemblyIndex) as String;
                if (record.assemblyString == null)
                    throw new SerializationException(Environment.GetResourceString("Serialization_CrossAppDomainError","String", crossAppDomainAssembly.assemblyIndex));

            }
            else
            {
                record.Read(this);
                record.Dump();
            }

            AssemIdToAssemblyTable[record.assemId] = new BinaryAssemblyInfo(record.assemblyString);
        }
Exemplo n.º 49
0
        [System.Security.SecurityCritical]  // auto-generated
        private void ReadObjectNull(BinaryHeaderEnum binaryHeaderEnum)
        {
            SerTrace.Log( this, "ReadObjectNull ");

            if (objectNull == null)
                objectNull = new ObjectNull();

            objectNull.Read(this, binaryHeaderEnum);
            objectNull.Dump();

            ObjectProgress objectOp = (ObjectProgress)stack.Peek();

            prs.Init();
            prs.PRparseTypeEnum = InternalParseTypeE.Member;
            prs.PRmemberValueEnum = InternalMemberValueE.Null;

            if (objectOp.objectTypeEnum == InternalObjectTypeE.Object)
            {
                prs.PRmemberTypeEnum = InternalMemberTypeE.Field;
                prs.PRname = objectOp.name;
                prs.PRdtType = objectOp.dtType;         
            }
            else
            {
                prs.PRmemberTypeEnum = InternalMemberTypeE.Item;
                prs.PRnullCount = objectNull.nullCount; 
                //only one null position has been incremented by GetNext
                //The position needs to be reset for the rest of the nulls
                objectOp.ArrayCountIncrement(objectNull.nullCount-1); 
            }
            objectReader.Parse(prs);
        }
 // Read constructor 
 internal BinaryArray(BinaryHeaderEnum binaryHeaderEnum) 
 {
     SerTrace.Log( this, "BinaryArray Constructor 2 ",   ((Enum)binaryHeaderEnum).ToString()); 
     this.binaryHeaderEnum = binaryHeaderEnum;
 }
        internal void Set(Int32 objectId, Int32 rank, Int32[] lengthA, Int32[] lowerBoundA, BinaryTypeEnum binaryTypeEnum, Object typeInformation, BinaryArrayTypeEnum binaryArrayTypeEnum, int assemId)
        { 
            SerTrace.Log( this, "BinaryArray Set objectId ",objectId," rank ",rank," ",((Enum)binaryTypeEnum).ToString(),", assemId ",assemId); 
            this.objectId = objectId;
            this.binaryArrayTypeEnum = binaryArrayTypeEnum; 
            this.rank = rank;
            this.lengthA = lengthA;
            this.lowerBoundA = lowerBoundA;
            this.binaryTypeEnum = binaryTypeEnum; 
            this.typeInformation = typeInformation;
            this.assemId = assemId; 
            binaryHeaderEnum = BinaryHeaderEnum.Array; 

            if (binaryArrayTypeEnum == BinaryArrayTypeEnum.Single) 
            {
                if (binaryTypeEnum == BinaryTypeEnum.Primitive)
                    binaryHeaderEnum = BinaryHeaderEnum.ArraySinglePrimitive;
                else if (binaryTypeEnum == BinaryTypeEnum.String) 
                    binaryHeaderEnum = BinaryHeaderEnum.ArraySingleString;
                else if (binaryTypeEnum == BinaryTypeEnum.Object) 
                    binaryHeaderEnum = BinaryHeaderEnum.ArraySingleObject; 
            }
            SerTrace.Log( this, "BinaryArray Set Exit ",((Enum)binaryHeaderEnum).ToString()); 
        }
 internal SerializationHeaderRecord(BinaryHeaderEnum binaryHeaderEnum, Int32 topId, Int32 headerId, Int32 majorVersion, Int32 minorVersion)
 { 
     this.binaryHeaderEnum = binaryHeaderEnum; 
     this.topId = topId;
     this.headerId = headerId; 
     this.majorVersion = majorVersion;
     this.minorVersion = minorVersion;
 }
 public  void Read(__BinaryParser input, BinaryHeaderEnum binaryHeaderEnum) 
 {
     //binaryHeaderEnum = input.ReadByte(); already read 
     switch (binaryHeaderEnum) 
     {
         case BinaryHeaderEnum.ObjectNull: 
             nullCount = 1;
             break;
         case BinaryHeaderEnum.ObjectNullMultiple256:
             nullCount = input.ReadByte(); 
             //Console.WriteLine("Read nullCount "+nullCount);
             break; 
         case BinaryHeaderEnum.ObjectNullMultiple: 
             nullCount = input.ReadInt32();
             //Console.WriteLine("Read nullCount "+nullCount); 
             break;
     }
 }
Exemplo n.º 54
0
 internal void ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
 {
     if (_bowmt == null)
     {
         _bowmt = new BinaryObjectWithMapTyped(binaryHeaderEnum);
     }
     else
     {
         _bowmt._binaryHeaderEnum = binaryHeaderEnum;
     }
     _bowmt.Read(this);
     ReadObjectWithMapTyped(_bowmt);
 }
Exemplo n.º 55
0
        private void ReadObjectString(BinaryHeaderEnum binaryHeaderEnum)
        {
            if (_objectString == null)
            {
                _objectString = new BinaryObjectString();
            }

            if (binaryHeaderEnum == BinaryHeaderEnum.ObjectString)
            {
                _objectString.Read(this);
            }
            else
            {
                if (_crossAppDomainString == null)
                {
                    _crossAppDomainString = new BinaryCrossAppDomainString();
                }
                _crossAppDomainString.Read(this);
                _objectString._value = _objectReader.CrossAppDomainArray(_crossAppDomainString._value) as string;
                if (_objectString._value == null)
                {
                    throw new SerializationException(SR.Format(SR.Serialization_CrossAppDomainError, "String", _crossAppDomainString._value));
                }

                _objectString._objectId = _crossAppDomainString._objectId;
            }

            PRs.Init();
            PRs._parseTypeEnum = InternalParseTypeE.Object;
            PRs._objectId = _objectReader.GetId(_objectString._objectId);

            if (PRs._objectId == _topId)
            {
                PRs._objectPositionEnum = InternalObjectPositionE.Top;
            }

            PRs._objectTypeEnum = InternalObjectTypeE.Object;

            ObjectProgress objectOp = (ObjectProgress)_stack.Peek();

            PRs._value = _objectString._value;
            PRs._keyDt = "System.String";
            PRs._dtType = Converter.s_typeofString;
            PRs._dtTypeCode = InternalPrimitiveTypeE.Invalid;
            PRs._varValue = _objectString._value; //Need to set it because ObjectReader is picking up value from variant, not pr.PRvalue

            if (objectOp == null)
            {
                // Top level String
                PRs._parseTypeEnum = InternalParseTypeE.Object;
                PRs._name = "System.String";
            }
            else
            {
                // Nested in an Object

                PRs._parseTypeEnum = InternalParseTypeE.Member;
                PRs._memberValueEnum = InternalMemberValueE.InlineValue;

                switch (objectOp._objectTypeEnum)
                {
                    case InternalObjectTypeE.Object:
                        PRs._name = objectOp._name;
                        PRs._memberTypeEnum = InternalMemberTypeE.Field;
                        break;
                    case InternalObjectTypeE.Array:
                        PRs._memberTypeEnum = InternalMemberTypeE.Item;
                        break;
                    default:
                        throw new SerializationException(SR.Format(SR.Serialization_ObjectTypeEnum, objectOp._objectTypeEnum.ToString()));
                }
            }

            _objectReader.Parse(PRs);
        }
Exemplo n.º 56
0
 [System.Security.SecurityCritical]  // auto-generated
 internal void ReadMethodObject(BinaryHeaderEnum binaryHeaderEnum)
 {
     SerTrace.Log( this, "ReadMethodObject");
     if (binaryHeaderEnum == BinaryHeaderEnum.MethodCall)
     {
         BinaryMethodCall record = new BinaryMethodCall();
         record.Read(this);
         record.Dump();
         objectReader.SetMethodCall(record);
     }
     else
     {
         BinaryMethodReturn record = new BinaryMethodReturn();
         record.Read(this);
         record.Dump();
         objectReader.SetMethodReturn(record);
     }
 }
Exemplo n.º 57
0
        private void ReadObjectNull(BinaryHeaderEnum binaryHeaderEnum)
        {
            if (_objectNull == null)
            {
                _objectNull = new ObjectNull();
            }
            _objectNull.Read(this, binaryHeaderEnum);

            ObjectProgress objectOp = (ObjectProgress)_stack.Peek();

            PRs.Init();
            PRs._parseTypeEnum = InternalParseTypeE.Member;
            PRs._memberValueEnum = InternalMemberValueE.Null;

            if (objectOp._objectTypeEnum == InternalObjectTypeE.Object)
            {
                PRs._memberTypeEnum = InternalMemberTypeE.Field;
                PRs._name = objectOp._name;
                PRs._dtType = objectOp._dtType;
            }
            else
            {
                PRs._memberTypeEnum = InternalMemberTypeE.Item;
                PRs._consecutiveNullArrayEntryCount = _objectNull._nullCount;
                //only one null position has been incremented by GetNext
                //The position needs to be reset for the rest of the nulls
                objectOp.ArrayCountIncrement(_objectNull._nullCount - 1);
            }
            _objectReader.Parse(PRs);
        }
Exemplo n.º 58
0
 [System.Security.SecurityCritical]  // auto-generated
 internal void ReadObjectWithMap(BinaryHeaderEnum binaryHeaderEnum)
 {
     SerTrace.Log( this, "ReadObjectWithMap");
     if (bowm == null)
         bowm = new BinaryObjectWithMap(binaryHeaderEnum);
     else
         bowm.binaryHeaderEnum = binaryHeaderEnum;
     bowm.Read(this);
     bowm.Dump();
     ReadObjectWithMap(bowm);
 }
        [System.Security.SecurityCritical] // implements Critical method
        public  void Read(__BinaryParser input) 
        {
            byte [] headerBytes = input.ReadBytes(17); 
            // Throw if we couldnt read header bytes 
            if (headerBytes.Length < 17)
                __Error.EndOfFile(); 

            majorVersion = GetInt32(headerBytes, 9);
            if (majorVersion > binaryFormatterMajorVersion)
                throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFormat", BitConverter.ToString(headerBytes))); 

            // binaryHeaderEnum has already been read 
            binaryHeaderEnum = (BinaryHeaderEnum)headerBytes[0]; 
            topId = GetInt32(headerBytes, 1);
            headerId = GetInt32(headerBytes, 5); 
            minorVersion = GetInt32(headerBytes, 13);
        }
Exemplo n.º 60
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)     
        {
            SerTrace.Log( this, "ReadObjectWithMapTyped");
            if (bowmt == null)
                bowmt = new BinaryObjectWithMapTyped(binaryHeaderEnum);
            else
                bowmt.binaryHeaderEnum = binaryHeaderEnum;
            bowmt.Read(this);
#if _DEBUG            
            bowmt.Dump();
#endif
            ReadObjectWithMapTyped(bowmt);
        }