isCompatible() private method

private isCompatible ( int numMembers, String memberNames, Type memberTypes ) : bool
numMembers int
memberNames String
memberTypes System.Type
return bool
Example #1
0
        //internal BinaryCrossAppDomainMap crossAppDomainMap;

        internal void WriteObject(NameInfo nameInfo, NameInfo typeNameInfo, int numMembers, String[] memberNames, Type[] memberTypes, WriteObjectInfo[] memberObjectInfos)
        {
            InternalWriteItemNull();
            int assemId;

            nameInfo.Dump("WriteObject nameInfo");
            typeNameInfo.Dump("WriteObject typeNameInfo");

            int objectId = (int)nameInfo.NIobjectId;

            //if (objectId < 0)
            //	objectId = --m_nestedObjectCount;

            if (objectId > 0)
            {
                BCLDebug.Trace("BINARY", "-----Top Level Object-----");
            }

            String objectName = null;

            if (objectId < 0)
            {
                // Nested Object
                objectName = typeNameInfo.NIname;
            }
            else
            {
                // Non-Nested
                objectName = nameInfo.NIname;
            }
            SerTrace.Log(this, "WriteObject objectName ", objectName);

            if (objectMapTable == null)
            {
                objectMapTable = new Hashtable();
            }

            ObjectMapInfo objectMapInfo = (ObjectMapInfo)objectMapTable[objectName];

            if (objectMapInfo != null && objectMapInfo.isCompatible(numMembers, memberNames, memberTypes))
            {
                // Object
                if (binaryObject == null)
                {
                    binaryObject = new BinaryObject();
                }
                binaryObject.Set(objectId, objectMapInfo.objectId);
                binaryObject.Dump();
                binaryObject.Write(this);
            }
            else if (!typeNameInfo.NItransmitTypeOnObject)
            {
                // ObjectWithMap
                if (binaryObjectWithMap == null)
                {
                    binaryObjectWithMap = new BinaryObjectWithMap();
                }

                // BCL types are not placed into table
                assemId = (int)typeNameInfo.NIassemId;
                binaryObjectWithMap.Set(objectId, objectName, numMembers, memberNames, assemId);

                binaryObjectWithMap.Dump();
                binaryObjectWithMap.Write(this);
                if (objectMapInfo == null)
                {
                    objectMapTable.Add(objectName, new ObjectMapInfo(objectId, numMembers, memberNames, memberTypes));
                }
            }
            else
            {
                // ObjectWithMapTyped
                BinaryTypeEnum[] binaryTypeEnumA  = new BinaryTypeEnum[numMembers];
                Object[]         typeInformationA = new Object[numMembers];
                int[]            assemIdA         = new int[numMembers];
                for (int i = 0; i < numMembers; i++)
                {
                    Object typeInformation = null;

                    binaryTypeEnumA[i]  = BinaryConverter.GetBinaryTypeInfo(memberTypes[i], memberObjectInfos[i], null, objectWriter, out typeInformation, out assemId);
                    typeInformationA[i] = typeInformation;
                    assemIdA[i]         = assemId;
                    SerTrace.Log(this, "WriteObject ObjectWithMapTyped memberNames "
                                 , memberNames[i], ", memberType ", memberTypes[i], " binaryTypeEnum ", ((Enum)binaryTypeEnumA[i]).ToString()
                                 , ", typeInformation ", typeInformationA[i], " assemId ", assemIdA[i]);
                }

                if (binaryObjectWithMapTyped == null)
                {
                    binaryObjectWithMapTyped = new BinaryObjectWithMapTyped();
                }

                // BCL types are not placed in table
                assemId = (int)typeNameInfo.NIassemId;
                binaryObjectWithMapTyped.Set(objectId, objectName, numMembers, memberNames, binaryTypeEnumA, typeInformationA, assemIdA, assemId);

                binaryObjectWithMapTyped.Dump();
                binaryObjectWithMapTyped.Write(this);
                if (objectMapInfo == null)
                {
                    objectMapTable.Add(objectName, new ObjectMapInfo(objectId, numMembers, memberNames, memberTypes));
                }
            }
        }
        internal void WriteObject(NameInfo nameInfo, NameInfo typeNameInfo, int numMembers, string[] memberNames, Type[] memberTypes, WriteObjectInfo[] memberObjectInfos)
        {
            this.InternalWriteItemNull();
            int    objectId = (int)nameInfo.NIobjectId;
            string name     = objectId >= 0 ? nameInfo.NIname : typeNameInfo.NIname;

            if (this.objectMapTable == null)
            {
                this.objectMapTable = new Hashtable();
            }
            ObjectMapInfo objectMapInfo = (ObjectMapInfo)this.objectMapTable[(object)name];

            if (objectMapInfo != null && objectMapInfo.isCompatible(numMembers, memberNames, memberTypes))
            {
                if (this.binaryObject == null)
                {
                    this.binaryObject = new BinaryObject();
                }
                this.binaryObject.Set(objectId, objectMapInfo.objectId);
                this.binaryObject.Write(this);
            }
            else if (!typeNameInfo.NItransmitTypeOnObject)
            {
                if (this.binaryObjectWithMap == null)
                {
                    this.binaryObjectWithMap = new BinaryObjectWithMap();
                }
                int assemId = (int)typeNameInfo.NIassemId;
                this.binaryObjectWithMap.Set(objectId, name, numMembers, memberNames, assemId);
                this.binaryObjectWithMap.Dump();
                this.binaryObjectWithMap.Write(this);
                if (objectMapInfo != null)
                {
                    return;
                }
                this.objectMapTable.Add((object)name, (object)new ObjectMapInfo(objectId, numMembers, memberNames, memberTypes));
            }
            else
            {
                BinaryTypeEnum[] binaryTypeEnumA  = new BinaryTypeEnum[numMembers];
                object[]         typeInformationA = new object[numMembers];
                int[]            memberAssemIds   = new int[numMembers];
                int assemId;
                for (int index = 0; index < numMembers; ++index)
                {
                    object typeInformation = (object)null;
                    binaryTypeEnumA[index]  = BinaryConverter.GetBinaryTypeInfo(memberTypes[index], memberObjectInfos[index], (string)null, this.objectWriter, out typeInformation, out assemId);
                    typeInformationA[index] = typeInformation;
                    memberAssemIds[index]   = assemId;
                }
                if (this.binaryObjectWithMapTyped == null)
                {
                    this.binaryObjectWithMapTyped = new BinaryObjectWithMapTyped();
                }
                assemId = (int)typeNameInfo.NIassemId;
                this.binaryObjectWithMapTyped.Set(objectId, name, numMembers, memberNames, binaryTypeEnumA, typeInformationA, memberAssemIds, assemId);
                this.binaryObjectWithMapTyped.Write(this);
                if (objectMapInfo != null)
                {
                    return;
                }
                this.objectMapTable.Add((object)name, (object)new ObjectMapInfo(objectId, numMembers, memberNames, memberTypes));
            }
        }
        // Token: 0x0600527F RID: 21119 RVA: 0x001215D0 File Offset: 0x0011F7D0
        internal void WriteObject(NameInfo nameInfo, NameInfo typeNameInfo, int numMembers, string[] memberNames, Type[] memberTypes, WriteObjectInfo[] memberObjectInfos)
        {
            this.InternalWriteItemNull();
            int    num = (int)nameInfo.NIobjectId;
            string niname;

            if (num < 0)
            {
                niname = typeNameInfo.NIname;
            }
            else
            {
                niname = nameInfo.NIname;
            }
            if (this.objectMapTable == null)
            {
                this.objectMapTable = new Hashtable();
            }
            ObjectMapInfo objectMapInfo = (ObjectMapInfo)this.objectMapTable[niname];

            if (objectMapInfo != null && objectMapInfo.isCompatible(numMembers, memberNames, memberTypes))
            {
                if (this.binaryObject == null)
                {
                    this.binaryObject = new BinaryObject();
                }
                this.binaryObject.Set(num, objectMapInfo.objectId);
                this.binaryObject.Write(this);
                return;
            }
            if (!typeNameInfo.NItransmitTypeOnObject)
            {
                if (this.binaryObjectWithMap == null)
                {
                    this.binaryObjectWithMap = new BinaryObjectWithMap();
                }
                int num2 = (int)typeNameInfo.NIassemId;
                this.binaryObjectWithMap.Set(num, niname, numMembers, memberNames, num2);
                this.binaryObjectWithMap.Dump();
                this.binaryObjectWithMap.Write(this);
                if (objectMapInfo == null)
                {
                    this.objectMapTable.Add(niname, new ObjectMapInfo(num, numMembers, memberNames, memberTypes));
                    return;
                }
            }
            else
            {
                BinaryTypeEnum[] array  = new BinaryTypeEnum[numMembers];
                object[]         array2 = new object[numMembers];
                int[]            array3 = new int[numMembers];
                int num2;
                for (int i = 0; i < numMembers; i++)
                {
                    object obj = null;
                    array[i]  = BinaryConverter.GetBinaryTypeInfo(memberTypes[i], memberObjectInfos[i], null, this.objectWriter, out obj, out num2);
                    array2[i] = obj;
                    array3[i] = num2;
                }
                if (this.binaryObjectWithMapTyped == null)
                {
                    this.binaryObjectWithMapTyped = new BinaryObjectWithMapTyped();
                }
                num2 = (int)typeNameInfo.NIassemId;
                this.binaryObjectWithMapTyped.Set(num, niname, numMembers, memberNames, array, array2, array3, num2);
                this.binaryObjectWithMapTyped.Write(this);
                if (objectMapInfo == null)
                {
                    this.objectMapTable.Add(niname, new ObjectMapInfo(num, numMembers, memberNames, memberTypes));
                }
            }
        }
Example #4
0
        internal void WriteObject(NameInfo nameInfo, NameInfo typeNameInfo, int numMembers, string[] memberNames, Type[] memberTypes, WriteObjectInfo[] memberObjectInfos)
        {
            this.InternalWriteItemNull();
            int    nIobjectId = (int)nameInfo.NIobjectId;
            string name       = null;

            if (nIobjectId < 0)
            {
                name = typeNameInfo.NIname;
            }
            else
            {
                name = nameInfo.NIname;
            }
            if (this.objectMapTable == null)
            {
                this.objectMapTable = new Hashtable();
            }
            ObjectMapInfo info = (ObjectMapInfo)this.objectMapTable[name];

            if ((info != null) && info.isCompatible(numMembers, memberNames, memberTypes))
            {
                if (this.binaryObject == null)
                {
                    this.binaryObject = new BinaryObject();
                }
                this.binaryObject.Set(nIobjectId, info.objectId);
                this.binaryObject.Write(this);
            }
            else
            {
                int nIassemId;
                if (!typeNameInfo.NItransmitTypeOnObject)
                {
                    if (this.binaryObjectWithMap == null)
                    {
                        this.binaryObjectWithMap = new BinaryObjectWithMap();
                    }
                    nIassemId = (int)typeNameInfo.NIassemId;
                    this.binaryObjectWithMap.Set(nIobjectId, name, numMembers, memberNames, nIassemId);
                    this.binaryObjectWithMap.Dump();
                    this.binaryObjectWithMap.Write(this);
                    if (info == null)
                    {
                        this.objectMapTable.Add(name, new ObjectMapInfo(nIobjectId, numMembers, memberNames, memberTypes));
                    }
                }
                else
                {
                    BinaryTypeEnum[] binaryTypeEnumA  = new BinaryTypeEnum[numMembers];
                    object[]         typeInformationA = new object[numMembers];
                    int[]            memberAssemIds   = new int[numMembers];
                    for (int i = 0; i < numMembers; i++)
                    {
                        object typeInformation = null;
                        binaryTypeEnumA[i]  = BinaryConverter.GetBinaryTypeInfo(memberTypes[i], memberObjectInfos[i], null, this.objectWriter, out typeInformation, out nIassemId);
                        typeInformationA[i] = typeInformation;
                        memberAssemIds[i]   = nIassemId;
                    }
                    if (this.binaryObjectWithMapTyped == null)
                    {
                        this.binaryObjectWithMapTyped = new BinaryObjectWithMapTyped();
                    }
                    nIassemId = (int)typeNameInfo.NIassemId;
                    this.binaryObjectWithMapTyped.Set(nIobjectId, name, numMembers, memberNames, binaryTypeEnumA, typeInformationA, memberAssemIds, nIassemId);
                    this.binaryObjectWithMapTyped.Write(this);
                    if (info == null)
                    {
                        this.objectMapTable.Add(name, new ObjectMapInfo(nIobjectId, numMembers, memberNames, memberTypes));
                    }
                }
            }
        }