// Token: 0x0600529B RID: 21147 RVA: 0x0012227C File Offset: 0x0012047C
 internal static void WriteStringWithCode(string value, __BinaryWriter sout)
 {
     if (value == null)
     {
         sout.WriteByte(17);
         return;
     }
     sout.WriteByte(18);
     sout.WriteString(value);
 }
 // Token: 0x060052A8 RID: 21160 RVA: 0x00122428 File Offset: 0x00120628
 public void Write(__BinaryWriter sout)
 {
     this.majorVersion = this.binaryFormatterMajorVersion;
     this.minorVersion = this.binaryFormatterMinorVersion;
     sout.WriteByte((byte)this.binaryHeaderEnum);
     sout.WriteInt32(this.topId);
     sout.WriteInt32(this.headerId);
     sout.WriteInt32(this.binaryFormatterMajorVersion);
     sout.WriteInt32(this.binaryFormatterMinorVersion);
 }
        private void Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo, string[] memberNames, Type[] memberTypes, object[] memberData, WriteObjectInfo[] memberObjectInfos)
        {
            int      length    = memberNames.Length;
            NameInfo nameInfo1 = (NameInfo)null;

            if (memberNameInfo != null)
            {
                memberNameInfo.NIobjectId = objectInfo.objectId;
                this.serWriter.WriteObject(memberNameInfo, typeNameInfo, length, memberNames, memberTypes, memberObjectInfos);
            }
            else if (objectInfo.objectId == this.topId && this.topName != null)
            {
                nameInfo1            = this.MemberToNameInfo(this.topName);
                nameInfo1.NIobjectId = objectInfo.objectId;
                this.serWriter.WriteObject(nameInfo1, typeNameInfo, length, memberNames, memberTypes, memberObjectInfos);
            }
            else if (objectInfo.objectType != Converter.typeofString)
            {
                typeNameInfo.NIobjectId = objectInfo.objectId;
                this.serWriter.WriteObject(typeNameInfo, (NameInfo)null, length, memberNames, memberTypes, memberObjectInfos);
            }
            if (memberNameInfo.NIisParentTypeOnObject)
            {
                memberNameInfo.NItransmitTypeOnObject = true;
                memberNameInfo.NIisParentTypeOnObject = false;
            }
            else
            {
                memberNameInfo.NItransmitTypeOnObject = false;
            }
            for (int index = 0; index < length; ++index)
            {
                this.WriteMemberSetup(objectInfo, memberNameInfo, typeNameInfo, memberNames[index], memberTypes[index], memberData[index], memberObjectInfos[index]);
            }
            if (memberNameInfo != null)
            {
                memberNameInfo.NIobjectId = objectInfo.objectId;
                this.serWriter.WriteObjectEnd(memberNameInfo, typeNameInfo);
            }
            else if (objectInfo.objectId == this.topId && this.topName != null)
            {
                this.serWriter.WriteObjectEnd(nameInfo1, typeNameInfo);
                this.PutNameInfo(nameInfo1);
            }
            else
            {
                if (objectInfo.objectType == Converter.typeofString)
                {
                    return;
                }
                __BinaryWriter binaryWriter = this.serWriter;
                NameInfo       nameInfo2    = typeNameInfo;
                binaryWriter.WriteObjectEnd(nameInfo2, nameInfo2);
            }
        }
 internal static void WriteStringWithCode(string value, __BinaryWriter sout)
 {
     if (value == null)
     {
         sout.WriteByte(0x11);
     }
     else
     {
         sout.WriteByte(0x12);
         sout.WriteString(value);
     }
 }
 internal static void WriteStringWithCode(string value, __BinaryWriter sout)
 {
     if (value == null)
     {
         sout.WriteByte(0x11);
     }
     else
     {
         sout.WriteByte(0x12);
         sout.WriteString(value);
     }
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte) this.binaryHeaderEnum);
     sout.WriteInt32(this.objectId);
     sout.WriteString(this.name);
     sout.WriteInt32(this.numMembers);
     for (int i = 0; i < this.numMembers; i++)
     {
         sout.WriteString(this.memberNames[i]);
     }
     if (this.assemId > 0)
     {
         sout.WriteInt32(this.assemId);
     }
 }
Example #7
0
        internal void Serialize(Stream serializationStream, object graph, Header[] headers, bool fCheck)
        {
            if (serializationStream == null)
            {
                throw new ArgumentNullException("serializationStream", Environment.GetResourceString("ArgumentNull_WithParamName", (object)serializationStream));
            }
            ObjectWriter objectWriter = new ObjectWriter(this.m_surrogates, this.m_context, new InternalFE()
            {
                FEtypeFormat = this.m_typeFormat, FEserializerTypeEnum = InternalSerializerTypeE.Binary, FEassemblyFormat = this.m_assemblyFormat
            }, this.m_binder);
            __BinaryWriter serWriter = new __BinaryWriter(serializationStream, objectWriter, this.m_typeFormat);

            objectWriter.Serialize(graph, headers, serWriter, fCheck);
            this.m_crossAppDomainArray = objectWriter.crossAppDomainArray;
        }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte)this.binaryHeaderEnum);
     sout.WriteInt32(this.objectId);
     sout.WriteString(this.name);
     sout.WriteInt32(this.numMembers);
     for (int i = 0; i < this.numMembers; i++)
     {
         sout.WriteString(this.memberNames[i]);
     }
     if (this.assemId > 0)
     {
         sout.WriteInt32(this.assemId);
     }
 }
 // Token: 0x06005303 RID: 21251 RVA: 0x00123C0C File Offset: 0x00121E0C
 public void Write(__BinaryWriter sout)
 {
     if (this.nullCount == 1)
     {
         sout.WriteByte(10);
         return;
     }
     if (this.nullCount < 256)
     {
         sout.WriteByte(13);
         sout.WriteByte((byte)this.nullCount);
         return;
     }
     sout.WriteByte(14);
     sout.WriteInt32(this.nullCount);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte)this.binaryHeaderEnum);
     sout.WriteInt32(this.objectId);
     sout.WriteString(this.name);
     sout.WriteInt32(this.numMembers);
     for (int index = 0; index < this.numMembers; ++index)
     {
         sout.WriteString(this.memberNames[index]);
     }
     if (this.assemId <= 0)
     {
         return;
     }
     sout.WriteInt32(this.assemId);
 }
 internal static void WriteWithCode(Type type, object value, __BinaryWriter sout)
 {
     if (type == null)
     {
         sout.WriteByte(0x11);
     }
     else if (object.ReferenceEquals(type, Converter.typeofString))
     {
         WriteStringWithCode((string) value, sout);
     }
     else
     {
         InternalPrimitiveTypeE code = Converter.ToCode(type);
         sout.WriteByte((byte) code);
         sout.WriteValue(code, value);
     }
 }
 public void Write(__BinaryWriter sout)
 {
     if (this.nullCount == 1)
     {
         sout.WriteByte((byte)10);
     }
     else if (this.nullCount < 256)
     {
         sout.WriteByte((byte)13);
         sout.WriteByte((byte)this.nullCount);
     }
     else
     {
         sout.WriteByte((byte)14);
         sout.WriteInt32(this.nullCount);
     }
 }
 public void Write(__BinaryWriter sout)
 {
     if (this.nullCount == 1)
     {
         sout.WriteByte(10);
     }
     else if (this.nullCount < 0x100)
     {
         sout.WriteByte(13);
         sout.WriteByte((byte) this.nullCount);
     }
     else
     {
         sout.WriteByte(14);
         sout.WriteInt32(this.nullCount);
     }
 }
        // Token: 0x0600529C RID: 21148 RVA: 0x0012229C File Offset: 0x0012049C
        internal static void WriteWithCode(Type type, object value, __BinaryWriter sout)
        {
            if (type == null)
            {
                sout.WriteByte(17);
                return;
            }
            if (type == Converter.typeofString)
            {
                IOUtil.WriteStringWithCode((string)value, sout);
                return;
            }
            InternalPrimitiveTypeE internalPrimitiveTypeE = Converter.ToCode(type);

            sout.WriteByte((byte)internalPrimitiveTypeE);
            sout.WriteValue(internalPrimitiveTypeE, value);
        }
 internal static void WriteWithCode(Type type, object value, __BinaryWriter sout)
 {
     if (type == null)
     {
         sout.WriteByte(0x11);
     }
     else if (object.ReferenceEquals(type, Converter.typeofString))
     {
         WriteStringWithCode((string)value, sout);
     }
     else
     {
         InternalPrimitiveTypeE code = Converter.ToCode(type);
         sout.WriteByte((byte)code);
         sout.WriteValue(code, value);
     }
 }
        // Token: 0x060052F2 RID: 21234 RVA: 0x001237E4 File Offset: 0x001219E4
        public void Write(__BinaryWriter sout)
        {
            switch (this.binaryHeaderEnum)
            {
            case BinaryHeaderEnum.ArraySinglePrimitive:
                sout.WriteByte((byte)this.binaryHeaderEnum);
                sout.WriteInt32(this.objectId);
                sout.WriteInt32(this.lengthA[0]);
                sout.WriteByte((byte)((InternalPrimitiveTypeE)this.typeInformation));
                return;

            case BinaryHeaderEnum.ArraySingleObject:
                sout.WriteByte((byte)this.binaryHeaderEnum);
                sout.WriteInt32(this.objectId);
                sout.WriteInt32(this.lengthA[0]);
                return;

            case BinaryHeaderEnum.ArraySingleString:
                sout.WriteByte((byte)this.binaryHeaderEnum);
                sout.WriteInt32(this.objectId);
                sout.WriteInt32(this.lengthA[0]);
                return;

            default:
                sout.WriteByte((byte)this.binaryHeaderEnum);
                sout.WriteInt32(this.objectId);
                sout.WriteByte((byte)this.binaryArrayTypeEnum);
                sout.WriteInt32(this.rank);
                for (int i = 0; i < this.rank; i++)
                {
                    sout.WriteInt32(this.lengthA[i]);
                }
                if (this.binaryArrayTypeEnum == BinaryArrayTypeEnum.SingleOffset || this.binaryArrayTypeEnum == BinaryArrayTypeEnum.JaggedOffset || this.binaryArrayTypeEnum == BinaryArrayTypeEnum.RectangularOffset)
                {
                    for (int j = 0; j < this.rank; j++)
                    {
                        sout.WriteInt32(this.lowerBoundA[j]);
                    }
                }
                sout.WriteByte((byte)this.binaryTypeEnum);
                BinaryConverter.WriteTypeInfo(this.binaryTypeEnum, this.typeInformation, this.assemId, sout);
                return;
            }
        }
Example #17
0
        // Commences the process of serializing the entire graph.  All of the data (in the appropriate format
        // is emitted onto the stream).
        internal void Serialize(Stream serializationStream, Object graph, Header[] headers, bool fCheck)
        {
            if (serializationStream == null)
            {
                throw new ArgumentNullException("serializationStream", String.Format(Environment.GetResourceString("ArgumentNull_WithParamName"), serializationStream));
            }
            SerTrace.Log(this, "Serialize Entry");

            InternalFE formatterEnums = new InternalFE();

            formatterEnums.FEtypeFormat         = m_typeFormat;
            formatterEnums.FEserializerTypeEnum = InternalSerializerTypeE.Binary;
            formatterEnums.FEassemblyFormat     = m_assemblyFormat;
            ObjectWriter   sow          = new ObjectWriter(serializationStream, m_surrogates, m_context, formatterEnums);
            __BinaryWriter binaryWriter = new __BinaryWriter(serializationStream, sow, m_typeFormat);

            sow.Serialize(graph, headers, binaryWriter, fCheck);
            m_crossAppDomainArray = sow.crossAppDomainArray;
        }
Example #18
0
 // Token: 0x060052BF RID: 21183 RVA: 0x001228C8 File Offset: 0x00120AC8
 internal void Write(__BinaryWriter sout)
 {
     sout.WriteByte(21);
     sout.WriteInt32((int)this.messageEnum);
     IOUtil.WriteStringWithCode(this.methodName, sout);
     IOUtil.WriteStringWithCode(this.typeName, sout);
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInline))
     {
         IOUtil.WriteStringWithCode((string)this.callContext, sout);
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInline))
     {
         sout.WriteInt32(this.args.Length);
         for (int i = 0; i < this.args.Length; i++)
         {
             IOUtil.WriteWithCode(this.argTypes[i], this.args[i], sout);
         }
     }
 }
Example #19
0
 // Token: 0x060052C8 RID: 21192 RVA: 0x00122EBC File Offset: 0x001210BC
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(22);
     sout.WriteInt32((int)this.messageEnum);
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueInline))
     {
         IOUtil.WriteWithCode(this.returnType, this.returnValue, sout);
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInline))
     {
         IOUtil.WriteStringWithCode((string)this.callContext, sout);
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInline))
     {
         sout.WriteInt32(this.args.Length);
         for (int i = 0; i < this.args.Length; i++)
         {
             IOUtil.WriteWithCode(this.argTypes[i], this.args[i], sout);
         }
     }
 }
 // Token: 0x060052ED RID: 21229 RVA: 0x00123558 File Offset: 0x00121758
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte)this.binaryHeaderEnum);
     sout.WriteInt32(this.objectId);
     sout.WriteString(this.name);
     sout.WriteInt32(this.numMembers);
     for (int i = 0; i < this.numMembers; i++)
     {
         sout.WriteString(this.memberNames[i]);
     }
     for (int j = 0; j < this.numMembers; j++)
     {
         sout.WriteByte((byte)this.binaryTypeEnumA[j]);
     }
     for (int k = 0; k < this.numMembers; k++)
     {
         BinaryConverter.WriteTypeInfo(this.binaryTypeEnumA[k], this.typeInformationA[k], this.memberAssemIds[k], sout);
     }
     if (this.assemId > 0)
     {
         sout.WriteInt32(this.assemId);
     }
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte) this.binaryHeaderEnum);
     sout.WriteInt32(this.objectId);
     sout.WriteString(this.name);
     sout.WriteInt32(this.numMembers);
     for (int i = 0; i < this.numMembers; i++)
     {
         sout.WriteString(this.memberNames[i]);
     }
     for (int j = 0; j < this.numMembers; j++)
     {
         sout.WriteByte((byte) this.binaryTypeEnumA[j]);
     }
     for (int k = 0; k < this.numMembers; k++)
     {
         BinaryConverter.WriteTypeInfo(this.binaryTypeEnumA[k], this.typeInformationA[k], this.memberAssemIds[k], sout);
     }
     if (this.assemId > 0)
     {
         sout.WriteInt32(this.assemId);
     }
 }
Example #22
0
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte)this.binaryHeaderEnum);
     sout.WriteInt32(this.objectId);
     sout.WriteString(this.name);
     sout.WriteInt32(this.numMembers);
     for (int index = 0; index < this.numMembers; ++index)
     {
         sout.WriteString(this.memberNames[index]);
     }
     for (int index = 0; index < this.numMembers; ++index)
     {
         sout.WriteByte((byte)this.binaryTypeEnumA[index]);
     }
     for (int index = 0; index < this.numMembers; ++index)
     {
         BinaryConverter.WriteTypeInfo(this.binaryTypeEnumA[index], this.typeInformationA[index], this.memberAssemIds[index], sout);
     }
     if (this.assemId <= 0)
     {
         return;
     }
     sout.WriteInt32(this.assemId);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte)6);
     sout.WriteInt32(this.objectId);
     sout.WriteString(this.value);
 }
Example #24
0
        internal void Serialize(object graph, Header[] inHeaders, __BinaryWriter serWriter, bool fCheck)
        {
            if (graph == null)
            {
                throw new ArgumentNullException("graph", Environment.GetResourceString("ArgumentNull_Graph"));
            }
            if (serWriter == null)
            {
                throw new ArgumentNullException("serWriter", Environment.GetResourceString("ArgumentNull_WithParamName", (object)"serWriter"));
            }
            if (fCheck)
            {
                CodeAccessPermission.Demand(PermissionType.SecuritySerialization);
            }
            this.serWriter = serWriter;
            this.headers   = inHeaders;
            serWriter.WriteBegin();
            long headerId          = 0;
            bool flag1             = false;
            bool flag2             = false;
            IMethodCallMessage mcm = graph as IMethodCallMessage;

            if (mcm != null)
            {
                flag1 = true;
                graph = (object)this.WriteMethodCall(mcm);
            }
            else
            {
                IMethodReturnMessage mrm = graph as IMethodReturnMessage;
                if (mrm != null)
                {
                    flag2 = true;
                    graph = (object)this.WriteMethodReturn(mrm);
                }
            }
            if (graph == null)
            {
                this.WriteSerializedStreamHeader(this.topId, headerId);
                if (flag1)
                {
                    serWriter.WriteMethodCall();
                }
                else if (flag2)
                {
                    serWriter.WriteMethodReturn();
                }
                serWriter.WriteSerializationHeaderEnd();
                serWriter.WriteEnd();
            }
            else
            {
                this.m_idGenerator        = new ObjectIDGenerator();
                this.m_objectQueue        = new Queue();
                this.m_formatterConverter = (IFormatterConverter) new FormatterConverter();
                this.serObjectInfoInit    = new SerObjectInfoInit();
                bool isNew;
                this.topId = this.InternalGetId(graph, false, (Type)null, out isNew);
                this.WriteSerializedStreamHeader(this.topId, this.headers == null ? -1L : this.InternalGetId((object)this.headers, false, (Type)null, out isNew));
                if (flag1)
                {
                    serWriter.WriteMethodCall();
                }
                else if (flag2)
                {
                    serWriter.WriteMethodReturn();
                }
                if (this.headers != null && this.headers.Length != 0)
                {
                    this.m_objectQueue.Enqueue((object)this.headers);
                }
                if (graph != null)
                {
                    this.m_objectQueue.Enqueue(graph);
                }
                object next;
                long   objID;
                while ((next = this.GetNext(out objID)) != null)
                {
                    WriteObjectInfo objectInfo1;
                    if (next is WriteObjectInfo)
                    {
                        objectInfo1 = (WriteObjectInfo)next;
                    }
                    else
                    {
                        objectInfo1         = WriteObjectInfo.Serialize(next, this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this, this.m_binder);
                        objectInfo1.assemId = this.GetAssemblyId(objectInfo1);
                    }
                    objectInfo1.objectId = objID;
                    NameInfo        nameInfo1   = this.TypeToNameInfo(objectInfo1);
                    WriteObjectInfo objectInfo2 = objectInfo1;
                    NameInfo        nameInfo2   = nameInfo1;
                    this.Write(objectInfo2, nameInfo2, nameInfo2);
                    this.PutNameInfo(nameInfo1);
                    objectInfo1.ObjectEnd();
                }
                serWriter.WriteSerializationHeaderEnd();
                serWriter.WriteEnd();
                this.m_objectManager.RaiseOnSerializedEvent();
            }
        }
 internal void Serialize(object graph, Header[] inHeaders, __BinaryWriter serWriter, bool fCheck)
 {
     if (graph == null)
     {
         throw new ArgumentNullException("graph", Environment.GetResourceString("ArgumentNull_Graph"));
     }
     if (serWriter == null)
     {
         throw new ArgumentNullException("serWriter", Environment.GetResourceString("ArgumentNull_WithParamName", new object[] { "serWriter" }));
     }
     if (fCheck)
     {
         CodeAccessPermission.Demand(PermissionType.SecuritySerialization);
     }
     this.serWriter = serWriter;
     this.headers = inHeaders;
     serWriter.WriteBegin();
     long headerId = 0L;
     bool flag2 = false;
     bool flag3 = false;
     IMethodCallMessage mcm = graph as IMethodCallMessage;
     if (mcm != null)
     {
         flag2 = true;
         graph = this.WriteMethodCall(mcm);
     }
     else
     {
         IMethodReturnMessage mrm = graph as IMethodReturnMessage;
         if (mrm != null)
         {
             flag3 = true;
             graph = this.WriteMethodReturn(mrm);
         }
     }
     if (graph == null)
     {
         this.WriteSerializedStreamHeader(this.topId, headerId);
         if (flag2)
         {
             serWriter.WriteMethodCall();
         }
         else if (flag3)
         {
             serWriter.WriteMethodReturn();
         }
         serWriter.WriteSerializationHeaderEnd();
         serWriter.WriteEnd();
     }
     else
     {
         object obj2;
         long num2;
         bool flag;
         this.m_idGenerator = new ObjectIDGenerator();
         this.m_objectQueue = new Queue();
         this.m_formatterConverter = new FormatterConverter();
         this.serObjectInfoInit = new SerObjectInfoInit();
         this.topId = this.InternalGetId(graph, false, null, out flag);
         if (this.headers != null)
         {
             headerId = this.InternalGetId(this.headers, false, null, out flag);
         }
         else
         {
             headerId = -1L;
         }
         this.WriteSerializedStreamHeader(this.topId, headerId);
         if (flag2)
         {
             serWriter.WriteMethodCall();
         }
         else if (flag3)
         {
             serWriter.WriteMethodReturn();
         }
         if ((this.headers != null) && (this.headers.Length > 0))
         {
             this.m_objectQueue.Enqueue(this.headers);
         }
         if (graph != null)
         {
             this.m_objectQueue.Enqueue(graph);
         }
         while ((obj2 = this.GetNext(out num2)) != null)
         {
             WriteObjectInfo objectInfo = null;
             if (obj2 is WriteObjectInfo)
             {
                 objectInfo = (WriteObjectInfo) obj2;
             }
             else
             {
                 objectInfo = WriteObjectInfo.Serialize(obj2, this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this, this.m_binder);
                 objectInfo.assemId = this.GetAssemblyId(objectInfo);
             }
             objectInfo.objectId = num2;
             NameInfo memberNameInfo = this.TypeToNameInfo(objectInfo);
             this.Write(objectInfo, memberNameInfo, memberNameInfo);
             this.PutNameInfo(memberNameInfo);
             objectInfo.ObjectEnd();
         }
         serWriter.WriteSerializationHeaderEnd();
         serWriter.WriteEnd();
         this.m_objectManager.RaiseOnSerializedEvent();
     }
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(0x12);
     sout.WriteInt32(this.crossAppDomainArrayIndex);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(0x13);
     sout.WriteInt32(this.objectId);
     sout.WriteInt32(this.value);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(8);
     sout.WriteByte((byte) this.primitiveTypeEnum);
     sout.WriteValue(this.primitiveTypeEnum, this.value);
 }
Example #29
0
 // Token: 0x060052FD RID: 21245 RVA: 0x00123BC6 File Offset: 0x00121DC6
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(9);
     sout.WriteInt32(this.idRef);
 }
        internal static void WriteTypeInfo(BinaryTypeEnum binaryTypeEnum, object typeInformation, int assemId, __BinaryWriter sout)
        {
            switch (binaryTypeEnum)
            {
                case BinaryTypeEnum.Primitive:
                case BinaryTypeEnum.PrimitiveArray:
                    sout.WriteByte((byte) ((InternalPrimitiveTypeE) typeInformation));
                    return;

                case BinaryTypeEnum.String:
                case BinaryTypeEnum.Object:
                case BinaryTypeEnum.ObjectArray:
                case BinaryTypeEnum.StringArray:
                    return;

                case BinaryTypeEnum.ObjectUrt:
                    sout.WriteString(typeInformation.ToString());
                    return;

                case BinaryTypeEnum.ObjectUser:
                    sout.WriteString(typeInformation.ToString());
                    sout.WriteInt32(assemId);
                    return;
            }
            throw new SerializationException(Environment.GetResourceString("Serialization_TypeWrite", new object[] { binaryTypeEnum.ToString() }));
        }
Example #31
0
 // Token: 0x060052DF RID: 21215 RVA: 0x0012330E File Offset: 0x0012150E
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(8);
     sout.WriteByte((byte)this.primitiveTypeEnum);
     sout.WriteValue(this.primitiveTypeEnum, this.value);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteValue(this.typeInformation, this.value);
 }
Example #33
0
 // Token: 0x060052B4 RID: 21172 RVA: 0x001225B4 File Offset: 0x001207B4
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(20);
     sout.WriteInt32(this.assemId);
     sout.WriteInt32(this.assemblyIndex);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(20);
     sout.WriteInt32(this.assemId);
     sout.WriteInt32(this.assemblyIndex);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(12);
     sout.WriteInt32(this.assemId);
     sout.WriteString(this.assemblyString);
 }
        public void Write(__BinaryWriter sout)
        {
            switch (this.binaryHeaderEnum)
            {
                case BinaryHeaderEnum.ArraySinglePrimitive:
                    sout.WriteByte((byte) this.binaryHeaderEnum);
                    sout.WriteInt32(this.objectId);
                    sout.WriteInt32(this.lengthA[0]);
                    sout.WriteByte((byte) ((InternalPrimitiveTypeE) this.typeInformation));
                    return;

                case BinaryHeaderEnum.ArraySingleObject:
                    sout.WriteByte((byte) this.binaryHeaderEnum);
                    sout.WriteInt32(this.objectId);
                    sout.WriteInt32(this.lengthA[0]);
                    return;

                case BinaryHeaderEnum.ArraySingleString:
                    sout.WriteByte((byte) this.binaryHeaderEnum);
                    sout.WriteInt32(this.objectId);
                    sout.WriteInt32(this.lengthA[0]);
                    return;
            }
            sout.WriteByte((byte) this.binaryHeaderEnum);
            sout.WriteInt32(this.objectId);
            sout.WriteByte((byte) this.binaryArrayTypeEnum);
            sout.WriteInt32(this.rank);
            for (int i = 0; i < this.rank; i++)
            {
                sout.WriteInt32(this.lengthA[i]);
            }
            if (((this.binaryArrayTypeEnum == BinaryArrayTypeEnum.SingleOffset) || (this.binaryArrayTypeEnum == BinaryArrayTypeEnum.JaggedOffset)) || (this.binaryArrayTypeEnum == BinaryArrayTypeEnum.RectangularOffset))
            {
                for (int j = 0; j < this.rank; j++)
                {
                    sout.WriteInt32(this.lowerBoundA[j]);
                }
            }
            sout.WriteByte((byte) this.binaryTypeEnum);
            BinaryConverter.WriteTypeInfo(this.binaryTypeEnum, this.typeInformation, this.assemId, sout);
        }
Example #37
0
        internal void Serialize(object graph, Header[] inHeaders, __BinaryWriter serWriter, bool fCheck)
        {
            if (graph == null)
            {
                throw new ArgumentNullException("graph", Environment.GetResourceString("ArgumentNull_Graph"));
            }
            if (serWriter == null)
            {
                throw new ArgumentNullException("serWriter", Environment.GetResourceString("ArgumentNull_WithParamName", new object[] { "serWriter" }));
            }
            if (fCheck)
            {
                CodeAccessPermission.Demand(PermissionType.SecuritySerialization);
            }
            this.serWriter = serWriter;
            this.headers   = inHeaders;
            serWriter.WriteBegin();
            long headerId          = 0L;
            bool flag2             = false;
            bool flag3             = false;
            IMethodCallMessage mcm = graph as IMethodCallMessage;

            if (mcm != null)
            {
                flag2 = true;
                graph = this.WriteMethodCall(mcm);
            }
            else
            {
                IMethodReturnMessage mrm = graph as IMethodReturnMessage;
                if (mrm != null)
                {
                    flag3 = true;
                    graph = this.WriteMethodReturn(mrm);
                }
            }
            if (graph == null)
            {
                this.WriteSerializedStreamHeader(this.topId, headerId);
                if (flag2)
                {
                    serWriter.WriteMethodCall();
                }
                else if (flag3)
                {
                    serWriter.WriteMethodReturn();
                }
                serWriter.WriteSerializationHeaderEnd();
                serWriter.WriteEnd();
            }
            else
            {
                object obj2;
                long   num2;
                bool   flag;
                this.m_idGenerator        = new ObjectIDGenerator();
                this.m_objectQueue        = new Queue();
                this.m_formatterConverter = new FormatterConverter();
                this.serObjectInfoInit    = new SerObjectInfoInit();
                this.topId = this.InternalGetId(graph, false, null, out flag);
                if (this.headers != null)
                {
                    headerId = this.InternalGetId(this.headers, false, null, out flag);
                }
                else
                {
                    headerId = -1L;
                }
                this.WriteSerializedStreamHeader(this.topId, headerId);
                if (flag2)
                {
                    serWriter.WriteMethodCall();
                }
                else if (flag3)
                {
                    serWriter.WriteMethodReturn();
                }
                if ((this.headers != null) && (this.headers.Length > 0))
                {
                    this.m_objectQueue.Enqueue(this.headers);
                }
                if (graph != null)
                {
                    this.m_objectQueue.Enqueue(graph);
                }
                while ((obj2 = this.GetNext(out num2)) != null)
                {
                    WriteObjectInfo objectInfo = null;
                    if (obj2 is WriteObjectInfo)
                    {
                        objectInfo = (WriteObjectInfo)obj2;
                    }
                    else
                    {
                        objectInfo         = WriteObjectInfo.Serialize(obj2, this.m_surrogates, this.m_context, this.serObjectInfoInit, this.m_formatterConverter, this, this.m_binder);
                        objectInfo.assemId = this.GetAssemblyId(objectInfo);
                    }
                    objectInfo.objectId = num2;
                    NameInfo memberNameInfo = this.TypeToNameInfo(objectInfo);
                    this.Write(objectInfo, memberNameInfo, memberNameInfo);
                    this.PutNameInfo(memberNameInfo);
                    objectInfo.ObjectEnd();
                }
                serWriter.WriteSerializationHeaderEnd();
                serWriter.WriteEnd();
                this.m_objectManager.RaiseOnSerializedEvent();
            }
        }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(0x16);
     sout.WriteInt32((int) this.messageEnum);
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueInline))
     {
         IOUtil.WriteWithCode(this.returnType, this.returnValue, sout);
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInline))
     {
         IOUtil.WriteStringWithCode((string) this.callContext, sout);
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInline))
     {
         sout.WriteInt32(this.args.Length);
         for (int i = 0; i < this.args.Length; i++)
         {
             IOUtil.WriteWithCode(this.argTypes[i], this.args[i], sout);
         }
     }
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(1);
     sout.WriteInt32(this.objectId);
     sout.WriteInt32(this.mapId);
 }
Example #40
0
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte)1);
     sout.WriteInt32(this.objectId);
     sout.WriteInt32(this.mapId);
 }
 // Token: 0x060052F7 RID: 21239 RVA: 0x00123B64 File Offset: 0x00121D64
 public void Write(__BinaryWriter sout)
 {
     sout.WriteValue(this.typeInformation, this.value);
 }
        internal static void WriteTypeInfo(BinaryTypeEnum binaryTypeEnum, object typeInformation, int assemId, __BinaryWriter sout)
        {
            switch (binaryTypeEnum)
            {
            case BinaryTypeEnum.Primitive:
            case BinaryTypeEnum.PrimitiveArray:
                sout.WriteByte((byte)(InternalPrimitiveTypeE)typeInformation);
                break;

            case BinaryTypeEnum.String:
                break;

            case BinaryTypeEnum.Object:
                break;

            case BinaryTypeEnum.ObjectUrt:
                sout.WriteString(typeInformation.ToString());
                break;

            case BinaryTypeEnum.ObjectUser:
                sout.WriteString(typeInformation.ToString());
                sout.WriteInt32(assemId);
                break;

            case BinaryTypeEnum.ObjectArray:
                break;

            case BinaryTypeEnum.StringArray:
                break;

            default:
                throw new SerializationException(Environment.GetResourceString("Serialization_TypeWrite", (object)binaryTypeEnum.ToString()));
            }
        }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(9);
     sout.WriteInt32(this.idRef);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte)12);
     sout.WriteInt32(this.assemId);
     sout.WriteString(this.assemblyString);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte(6);
     sout.WriteInt32(this.objectId);
     sout.WriteString(this.value);
 }
 public void Write(__BinaryWriter sout)
 {
     sout.WriteByte((byte)11);
 }
 internal void Write(__BinaryWriter sout)
 {
     sout.WriteByte(0x15);
     sout.WriteInt32((int) this.messageEnum);
     IOUtil.WriteStringWithCode(this.methodName, sout);
     IOUtil.WriteStringWithCode(this.typeName, sout);
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInline))
     {
         IOUtil.WriteStringWithCode((string) this.callContext, sout);
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInline))
     {
         sout.WriteInt32(this.args.Length);
         for (int i = 0; i < this.args.Length; i++)
         {
             IOUtil.WriteWithCode(this.argTypes[i], this.args[i], sout);
         }
     }
 }