internal static SoapAttributeInfo GetMemberAttributeInfo(MemberInfo memberInfo, string name, Type type)
 {
     SoapAttributeInfo attributeInfo = new SoapAttributeInfo();
     ProcessTypeAttribute(type, attributeInfo);
     ProcessMemberInfoAttribute(memberInfo, attributeInfo);
     return attributeInfo;
 }
        internal static void ProcessMemberInfoAttribute(MemberInfo memberInfo, SoapAttributeInfo attributeInfo)
        {
            SoapAttribute cachedSoapAttribute = InternalRemotingServices.GetCachedSoapAttribute(memberInfo);

            if (cachedSoapAttribute.Embedded)
            {
                attributeInfo.m_attributeType |= SoapAttributeType.Embedded;
            }
            if (cachedSoapAttribute is SoapFieldAttribute)
            {
                SoapFieldAttribute attribute2 = (SoapFieldAttribute)cachedSoapAttribute;
                if (attribute2.UseAttribute)
                {
                    attributeInfo.m_attributeType |= SoapAttributeType.XmlAttribute;
                    attributeInfo.m_elementName    = attribute2.XmlElementName;
                    attributeInfo.m_nameSpace      = attribute2.XmlNamespace;
                }
                else if (attribute2.IsInteropXmlElement())
                {
                    attributeInfo.m_attributeType |= SoapAttributeType.XmlElement;
                    attributeInfo.m_elementName    = attribute2.XmlElementName;
                    attributeInfo.m_nameSpace      = attribute2.XmlNamespace;
                }
            }
        }
Exemple #3
0
 private void InternalInit()
 {
     this.obj                 = null;
     this.objectType          = null;
     this.count               = 0;
     this.isSi                = false;
     this.isNamed             = false;
     this.isTyped             = false;
     this.si                  = null;
     this.wireMemberNames     = null;
     this.wireMemberTypes     = null;
     this.cache               = null;
     this.lastPosition        = 0;
     this.numberMembersSeen   = 0;
     this.bfake               = false;
     this.bSoapFault          = false;
     this.majorVersion        = 0;
     this.minorVersion        = 0;
     this.typeAttributeInfo   = null;
     this.arrayElemObjectInfo = null;
     if (this.memberTypesList != null)
     {
         this.memberTypesList.Clear();
     }
 }
Exemple #4
0
        } // ProcessTypeAttribute

        internal static void ProcessMemberInfoAttribute(MemberInfo memberInfo, SoapAttributeInfo attributeInfo)
        {
            SoapAttribute attr = (SoapAttribute)
                                 InternalRemotingServices.GetCachedSoapAttribute(memberInfo);

            if (attr.Embedded)
            {
                attributeInfo.m_attributeType |= SoapAttributeType.Embedded;
            }

            // check for attribute and other junk
            if (attr is SoapFieldAttribute)
            {
                SoapFieldAttribute fieldAttr = (SoapFieldAttribute)attr;
                if (fieldAttr.UseAttribute)
                {
                    attributeInfo.m_attributeType |= SoapAttributeType.XmlAttribute;
                    attributeInfo.m_elementName    = fieldAttr.XmlElementName;
                    attributeInfo.m_nameSpace      = fieldAttr.XmlNamespace;
                }
                else
                {
                    if (fieldAttr.IsInteropXmlElement())
                    {
                        attributeInfo.m_attributeType |= SoapAttributeType.XmlElement;
                        attributeInfo.m_elementName    = fieldAttr.XmlElementName;
                        attributeInfo.m_nameSpace      = fieldAttr.XmlNamespace;
                    }
                }
            }
        } // ProcessMemberInfoAttribute
Exemple #5
0
 private void InitReadConstructor(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, string assemblyName)
 {
     if (objectType.IsArray)
     {
         this.arrayElemObjectInfo = Create(objectType.GetElementType(), surrogateSelector, context, this.objectManager, this.serObjectInfoInit, this.formatterConverter, assemblyName);
         this.typeAttributeInfo   = this.GetTypeAttributeInfo();
         this.InitNoMembers();
     }
     else
     {
         ISurrogateSelector selector = null;
         if (surrogateSelector != null)
         {
             this.serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out selector);
         }
         if (this.serializationSurrogate != null)
         {
             this.isSi = true;
         }
         else if (!(objectType == Converter.typeofObject) && Converter.typeofISerializable.IsAssignableFrom(objectType))
         {
             this.isSi = true;
         }
         if (this.isSi)
         {
             this.si = new SerializationInfo(objectType, this.formatterConverter);
             this.InitSiRead(assemblyName);
         }
         else
         {
             this.InitMemberInfo();
         }
     }
 }
Exemple #6
0
        private void InternalInit()
        {
            InternalST.Soap(this, objectInfoId, " objectType ", objectType, " InternalInit");
            obj               = null;
            objectType        = null;
            count             = 0;
            isSi              = false;
            isNamed           = false;
            isTyped           = false;
            si                = null;
            wireMemberNames   = null;
            wireMemberTypes   = null;
            cache             = null;
            lastPosition      = 0;
            numberMembersSeen = 0;

            bfake               = false;
            bSoapFault          = false;
            majorVersion        = 0;
            minorVersion        = 0;
            typeAttributeInfo   = null;
            arrayElemObjectInfo = null;



            // Si Read
            if (memberTypesList != null)
            {
                memberTypesList.Clear();
            }
        }
Exemple #7
0
        internal static void ProcessTypeAttribute(Type type, SoapAttributeInfo attributeInfo)
        {
            SoapTypeAttribute attr = (SoapTypeAttribute)
                                     InternalRemotingServices.GetCachedSoapAttribute(type);

            if (attr.Embedded)
            {
                attributeInfo.m_attributeType |= SoapAttributeType.Embedded;
            }

            String xmlName, xmlNamespace;

            if (SoapServices.GetXmlElementForInteropType(type, out xmlName, out xmlNamespace))
            {
                attributeInfo.m_attributeType |= SoapAttributeType.XmlElement;
                attributeInfo.m_elementName    = xmlName;
                attributeInfo.m_nameSpace      = xmlNamespace;
            }

            if (SoapServices.GetXmlTypeForInteropType(type, out xmlName, out xmlNamespace))
            {
                attributeInfo.m_attributeType |= SoapAttributeType.XmlType;
                attributeInfo.m_typeName       = xmlName;
                attributeInfo.m_typeNamespace  = xmlNamespace;
            }
        } // ProcessTypeAttribute
        internal static SoapAttributeInfo GetMemberAttributeInfo(MemberInfo memberInfo, string name, Type type)
        {
            SoapAttributeInfo attributeInfo = new SoapAttributeInfo();

            ProcessTypeAttribute(type, attributeInfo);
            ProcessMemberInfoAttribute(memberInfo, attributeInfo);
            return(attributeInfo);
        }
 internal void GetMemberInfo(out string[] outMemberNames, out Type[] outMemberTypes, out object[] outMemberData, out SoapAttributeInfo[] outAttributeInfo)
 {
     outMemberNames = this.cache.memberNames;
     outMemberTypes = this.cache.memberTypes;
     outMemberData = this.memberData;
     outAttributeInfo = this.cache.memberAttributeInfos;
     if (this.isSi && !this.isNamed)
     {
         throw new SerializationException(SoapUtil.GetResourceString("Serialization_ISerializableMemberInfo"));
     }
 }
Exemple #10
0
        // Write Constructor used for array types or null members
        internal void InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo)
        {
            InternalST.Soap(this, objectInfoId, " Constructor 2 ", objectType);

            this.objectType                = objectType;
            this.context                   = context;
            this.serObjectInfoInit         = serObjectInfoInit;
            this.parentMemberAttributeInfo = attributeInfo;
            this.surrogateSelector         = surrogateSelector;
            this.converter                 = converter;

            if (objectType.IsArray)
            {
                arrayElemObjectInfo = Serialize(objectType.GetElementType(), surrogateSelector, context, serObjectInfoInit, converter, null);
                typeAttributeInfo   = GetTypeAttributeInfo();
                InitNoMembers();
                return;
            }

            typeAttributeInfo = GetTypeAttributeInfo();

            ISurrogateSelector surrogateSelectorTemp = null;

            if (surrogateSelector != null)
            {
                serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp);
            }

            if (serializationSurrogate != null)
            {
                isSi = true;
            }
            else if (objectType == Converter.typeofObject)
            {
            }
            else if (Converter.typeofISerializable.IsAssignableFrom(objectType))
            {
                isSi = true;
            }

            if (isSi)
            {
                si    = new SerializationInfo(objectType, converter);
                cache = new SerObjectInfoCache();
                cache.fullTypeName   = si.FullTypeName;
                cache.assemblyString = si.AssemblyName;
            }
            else
            {
                InitMemberInfo();
            }

            InternalST.Soap(this, objectInfoId, " ", objectType, " InitSerialize Exit ", isSi);
        }
 internal void InitSerialize(object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo, ObjectWriter objectWriter)
 {
     this.context                   = context;
     this.obj                       = obj;
     this.serObjectInfoInit         = serObjectInfoInit;
     this.parentMemberAttributeInfo = attributeInfo;
     this.surrogateSelector         = surrogateSelector;
     this.converter                 = converter;
     if (RemotingServices.IsTransparentProxy(obj))
     {
         this.objectType = Converter.typeofMarshalByRefObject;
     }
     else
     {
         this.objectType = obj.GetType();
     }
     if (this.objectType.IsArray)
     {
         this.arrayElemObjectInfo = Serialize(this.objectType.GetElementType(), surrogateSelector, context, serObjectInfoInit, converter, null);
         this.typeAttributeInfo   = this.GetTypeAttributeInfo();
         this.isArray             = true;
         this.InitNoMembers();
     }
     else
     {
         ISurrogateSelector selector;
         this.typeAttributeInfo = this.GetTypeAttributeInfo();
         objectWriter.ObjectManager.RegisterObject(obj);
         if ((surrogateSelector != null) && ((this.serializationSurrogate = surrogateSelector.GetSurrogate(this.objectType, context, out selector)) != null))
         {
             this.si = new SerializationInfo(this.objectType, converter);
             if (!this.objectType.IsPrimitive)
             {
                 this.serializationSurrogate.GetObjectData(obj, this.si, context);
             }
             this.InitSiWrite(objectWriter);
         }
         else if (obj is ISerializable)
         {
             if (!this.objectType.IsSerializable)
             {
                 throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_NonSerType"), new object[] { this.objectType.FullName, this.objectType.Module.Assembly.FullName }));
             }
             this.si = new SerializationInfo(this.objectType, converter);
             ((ISerializable)obj).GetObjectData(this.si, context);
             this.InitSiWrite(objectWriter);
         }
         else
         {
             this.InitMemberInfo();
         }
     }
 }
Exemple #12
0
        private SoapAttributeInfo GetTypeAttributeInfo()
        {
            if (this.arrayElemObjectInfo != null)
            {
                return(this.arrayElemObjectInfo.GetTypeAttributeInfo());
            }
            SoapAttributeInfo attributeInfo = null;

            attributeInfo = new SoapAttributeInfo();
            Attr.ProcessTypeAttribute(this.objectType, attributeInfo);
            return(attributeInfo);
        }
Exemple #13
0
        // Check for Interop type (SchemaType)
        private SoapAttributeInfo GetTypeAttributeInfo()
        {
            if (arrayElemObjectInfo != null)
            {
                return(arrayElemObjectInfo.GetTypeAttributeInfo());
            }

            SoapAttributeInfo attributeInfo = null;

            attributeInfo = new SoapAttributeInfo();

            Attr.ProcessTypeAttribute(objectType, attributeInfo);

            attributeInfo.Dump("type " + objectType);
            return(attributeInfo);
        }
 private void InternalInit()
 {
     this.obj                       = null;
     this.objectType                = null;
     this.isSi                      = false;
     this.isNamed                   = false;
     this.isTyped                   = false;
     this.si                        = null;
     this.cache                     = null;
     this.memberData                = null;
     this.isArray                   = false;
     this.objectId                  = 0L;
     this.assemId                   = 0L;
     this.lastPosition              = 0;
     this.typeAttributeInfo         = null;
     this.parentMemberAttributeInfo = null;
     this.arrayElemObjectInfo       = null;
 }
        private SoapAttributeInfo GetTypeAttributeInfo()
        {
            if (this.arrayElemObjectInfo != null)
            {
                return(this.arrayElemObjectInfo.GetTypeAttributeInfo());
            }
            SoapAttributeInfo attributeInfo = null;

            if (this.parentMemberAttributeInfo != null)
            {
                attributeInfo = this.parentMemberAttributeInfo;
            }
            else
            {
                attributeInfo = new SoapAttributeInfo();
            }
            Attr.ProcessTypeAttribute(this.objectType, attributeInfo);
            return(attributeInfo);
        }
Exemple #16
0
        // Specifies whether the embedded attribute is set for a member.

        internal bool IsEmbeddedAttribute(String name)
        {
            InternalST.Soap(this, objectInfoId, " ", objectType, " IsEmbedded Entry ", name);

            if (arrayElemObjectInfo != null)
            {
                return(arrayElemObjectInfo.IsEmbeddedAttribute(name));
            }

            bool isEmbedded = false;

            if (cache.memberAttributeInfos != null && cache.memberAttributeInfos.Length > 0)
            {
                SoapAttributeInfo attributeInfo = cache.memberAttributeInfos[Position(name)];
                isEmbedded = attributeInfo.IsEmbedded();
            }
            InternalST.Soap(this, objectInfoId, " ", objectType, " IsEmbedded Exit ", isEmbedded);
            return(isEmbedded);
        }
 internal void InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo)
 {
     this.objectType                = objectType;
     this.context                   = context;
     this.serObjectInfoInit         = serObjectInfoInit;
     this.parentMemberAttributeInfo = attributeInfo;
     this.surrogateSelector         = surrogateSelector;
     this.converter                 = converter;
     if (objectType.IsArray)
     {
         this.arrayElemObjectInfo = Serialize(objectType.GetElementType(), surrogateSelector, context, serObjectInfoInit, converter, null);
         this.typeAttributeInfo   = this.GetTypeAttributeInfo();
         this.InitNoMembers();
     }
     else
     {
         this.typeAttributeInfo = this.GetTypeAttributeInfo();
         ISurrogateSelector selector = null;
         if (surrogateSelector != null)
         {
             this.serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out selector);
         }
         if (this.serializationSurrogate != null)
         {
             this.isSi = true;
         }
         else if (!(objectType == Converter.typeofObject) && Converter.typeofISerializable.IsAssignableFrom(objectType))
         {
             this.isSi = true;
         }
         if (this.isSi)
         {
             this.si    = new SerializationInfo(objectType, converter);
             this.cache = new SerObjectInfoCache();
             this.cache.fullTypeName   = this.si.FullTypeName;
             this.cache.assemblyString = this.si.AssemblyName;
         }
         else
         {
             this.InitMemberInfo();
         }
     }
 }
Exemple #18
0
        private void InitReadConstructor(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, String assemblyName)
        {
            InternalST.Soap(this, objectInfoId, " ", objectType, " InitReadConstructor Entry ", objectType);

            if (objectType.IsArray)
            {
                arrayElemObjectInfo = Create(objectType.GetElementType(), surrogateSelector, context, objectManager, serObjectInfoInit, formatterConverter, assemblyName);
                typeAttributeInfo   = GetTypeAttributeInfo();
                InitNoMembers();
                return;
            }

            ISurrogateSelector surrogateSelectorTemp = null;

            if (surrogateSelector != null)
            {
                serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp);
            }

            if (serializationSurrogate != null)
            {
                isSi = true;
            }
            else if (objectType == Converter.typeofObject)
            {
            }
            else if (Converter.typeofISerializable.IsAssignableFrom(objectType))
            {
                isSi = true;
            }

            if (isSi)
            {
                si = new SerializationInfo(objectType, formatterConverter);
                InitSiRead(assemblyName);
            }
            else
            {
                InitMemberInfo();
            }
            InternalST.Soap(this, objectInfoId, " ", objectType, " InitReadConstructor Exit ", isSi);
        }
 internal static void ProcessTypeAttribute(Type type, SoapAttributeInfo attributeInfo)
 {
     string str;
     string str2;
     SoapTypeAttribute cachedSoapAttribute = (SoapTypeAttribute) InternalRemotingServices.GetCachedSoapAttribute(type);
     if (cachedSoapAttribute.Embedded)
     {
         attributeInfo.m_attributeType |= SoapAttributeType.Embedded;
     }
     if (SoapServices.GetXmlElementForInteropType(type, out str, out str2))
     {
         attributeInfo.m_attributeType |= SoapAttributeType.XmlElement;
         attributeInfo.m_elementName = str;
         attributeInfo.m_nameSpace = str2;
     }
     if (SoapServices.GetXmlTypeForInteropType(type, out str, out str2))
     {
         attributeInfo.m_attributeType |= SoapAttributeType.XmlType;
         attributeInfo.m_typeName = str;
         attributeInfo.m_typeNamespace = str2;
     }
 }
Exemple #20
0
        // Check for Interop type (SchemaType)
        private SoapAttributeInfo GetTypeAttributeInfo()
        {
            if (arrayElemObjectInfo != null)
            {
                return(arrayElemObjectInfo.GetTypeAttributeInfo());
            }

            SoapAttributeInfo attributeInfo = null;

            if (parentMemberAttributeInfo != null)
            {
                attributeInfo = parentMemberAttributeInfo;
            }
            else
            {
                attributeInfo = new SoapAttributeInfo();
            }

            Attr.ProcessTypeAttribute(objectType, attributeInfo);

            attributeInfo.Dump("type " + objectType);
            return(attributeInfo);
        }
Exemple #21
0
        private void InternalInit()
        {
            InternalST.Soap(this, objectInfoId, " InternalInit");
            obj        = null;
            objectType = null;
            isSi       = false;
            isNamed    = false;
            isTyped    = false;
            si         = null;
            cache      = null;
            memberData = null;
            isArray    = false;

            // Writing and Parsing information
            objectId = 0;
            assemId  = 0;

            // Added for Soap
            lastPosition              = 0;
            typeAttributeInfo         = null;
            parentMemberAttributeInfo = null;
            arrayElemObjectInfo       = null;
        }
        internal static void ProcessTypeAttribute(Type type, SoapAttributeInfo attributeInfo)
        {
            string            str;
            string            str2;
            SoapTypeAttribute cachedSoapAttribute = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute(type);

            if (cachedSoapAttribute.Embedded)
            {
                attributeInfo.m_attributeType |= SoapAttributeType.Embedded;
            }
            if (SoapServices.GetXmlElementForInteropType(type, out str, out str2))
            {
                attributeInfo.m_attributeType |= SoapAttributeType.XmlElement;
                attributeInfo.m_elementName    = str;
                attributeInfo.m_nameSpace      = str2;
            }
            if (SoapServices.GetXmlTypeForInteropType(type, out str, out str2))
            {
                attributeInfo.m_attributeType |= SoapAttributeType.XmlType;
                attributeInfo.m_typeName       = str;
                attributeInfo.m_typeNamespace  = str2;
            }
        }
 internal static void ProcessMemberInfoAttribute(MemberInfo memberInfo, SoapAttributeInfo attributeInfo)
 {
     SoapAttribute cachedSoapAttribute = InternalRemotingServices.GetCachedSoapAttribute(memberInfo);
     if (cachedSoapAttribute.Embedded)
     {
         attributeInfo.m_attributeType |= SoapAttributeType.Embedded;
     }
     if (cachedSoapAttribute is SoapFieldAttribute)
     {
         SoapFieldAttribute attribute2 = (SoapFieldAttribute) cachedSoapAttribute;
         if (attribute2.UseAttribute)
         {
             attributeInfo.m_attributeType |= SoapAttributeType.XmlAttribute;
             attributeInfo.m_elementName = attribute2.XmlElementName;
             attributeInfo.m_nameSpace = attribute2.XmlNamespace;
         }
         else if (attribute2.IsInteropXmlElement())
         {
             attributeInfo.m_attributeType |= SoapAttributeType.XmlElement;
             attributeInfo.m_elementName = attribute2.XmlElementName;
             attributeInfo.m_nameSpace = attribute2.XmlNamespace;
         }
     }
 }
 internal void Init()
 {
     NInameSpaceEnum        = InternalNameSpaceE.None;
     NIname                 = null;
     NIobjectId             = 0;
     NIassemId              = 0;
     NIprimitiveTypeEnum    = InternalPrimitiveTypeE.Invalid;
     NItype                 = null;
     NIisSealed             = false;
     NItransmitTypeOnObject = false;
     NItransmitTypeOnMember = false;
     NIisParentTypeOnObject = false;
     NIisMustUnderstand     = false;
     NInamespace            = null;
     NIheaderPrefix         = null;
     NIitemName             = null;
     NIisArray              = false;
     NIisArrayItem          = false;
     NIisTopLevelObject     = false;
     NIisNestedObject       = false;
     NIisHeader             = false;
     NIisRemoteRecord       = false;
     NIattributeInfo        = null;
 }
 internal void Init()
 {
     this.NInameSpaceEnum = InternalNameSpaceE.None;
     this.NIname = null;
     this.NIobjectId = 0L;
     this.NIassemId = 0L;
     this.NIprimitiveTypeEnum = InternalPrimitiveTypeE.Invalid;
     this.NItype = null;
     this.NIisSealed = false;
     this.NItransmitTypeOnObject = false;
     this.NItransmitTypeOnMember = false;
     this.NIisParentTypeOnObject = false;
     this.NIisMustUnderstand = false;
     this.NInamespace = null;
     this.NIheaderPrefix = null;
     this.NIitemName = null;
     this.NIisArray = false;
     this.NIisArrayItem = false;
     this.NIisTopLevelObject = false;
     this.NIisNestedObject = false;
     this.NIisHeader = false;
     this.NIisRemoteRecord = false;
     this.NIattributeInfo = null;
 }
Exemple #26
0
        // Write Constructor used for array types or null members
        internal void InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo)
        {

            InternalST.Soap( this, objectInfoId," Constructor 2 ",objectType);     

            this.objectType = objectType;
            this.context = context;
            this.serObjectInfoInit = serObjectInfoInit;
            this.parentMemberAttributeInfo = attributeInfo;         
            this.surrogateSelector = surrogateSelector;
            this.converter = converter;

            if (objectType.IsArray)
            {
                arrayElemObjectInfo = Serialize(objectType.GetElementType(), surrogateSelector, context, serObjectInfoInit, converter, null);
                typeAttributeInfo = GetTypeAttributeInfo();
                InitNoMembers();
                return;         
            }

            typeAttributeInfo = GetTypeAttributeInfo();

            ISurrogateSelector surrogateSelectorTemp = null;

            if (surrogateSelector!=null)
                serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp);

            if (serializationSurrogate != null)
            {
                isSi = true;
            }
            else if (objectType == Converter.typeofObject)
            {
            }
            else if (Converter.typeofISerializable.IsAssignableFrom(objectType))
                isSi = true;

            if (isSi)
            {
                si = new SerializationInfo(objectType, converter);
                cache = new SerObjectInfoCache();
                cache.fullTypeName = si.FullTypeName;
                cache.assemblyString = si.AssemblyName;
            }
            else
            {
                InitMemberInfo();
            }

            InternalST.Soap( this,objectInfoId," ", objectType," InitSerialize Exit ",isSi);       
        }
Exemple #27
0
 internal static WriteObjectInfo Serialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo)
 {
     WriteObjectInfo soi = GetObjectInfo(serObjectInfoInit);         
     soi.InitSerialize(objectType, surrogateSelector, context, serObjectInfoInit, converter, attributeInfo);
     return soi;         
 }
Exemple #28
0
        } // ProcessTypeAttribute


        internal static void ProcessMemberInfoAttribute(MemberInfo memberInfo, SoapAttributeInfo attributeInfo)
        {
            SoapAttribute attr = (SoapAttribute)
                                 InternalRemotingServices.GetCachedSoapAttribute(memberInfo);

            if (attr.Embedded)
                attributeInfo.m_attributeType |= SoapAttributeType.Embedded;

            // check for attribute and other junk
            if (attr is SoapFieldAttribute)
            {
                SoapFieldAttribute fieldAttr = (SoapFieldAttribute)attr;
                if (fieldAttr.UseAttribute)
                {
                    attributeInfo.m_attributeType |= SoapAttributeType.XmlAttribute;
                    attributeInfo.m_elementName = fieldAttr.XmlElementName;
                    attributeInfo.m_nameSpace = fieldAttr.XmlNamespace;
                }
                else
                {
                    if (fieldAttr.IsInteropXmlElement())
                    {
                        attributeInfo.m_attributeType |= SoapAttributeType.XmlElement;
                        attributeInfo.m_elementName = fieldAttr.XmlElementName;
                        attributeInfo.m_nameSpace = fieldAttr.XmlNamespace;
                    }
                }
            }
        } // ProcessMemberInfoAttribute
Exemple #29
0
        internal static void ProcessTypeAttribute(Type type, SoapAttributeInfo attributeInfo)
        {
            SoapTypeAttribute attr = (SoapTypeAttribute)
                                     InternalRemotingServices.GetCachedSoapAttribute(type);

            if (attr.Embedded)
                attributeInfo.m_attributeType |= SoapAttributeType.Embedded;

            String xmlName, xmlNamespace;

            if (SoapServices.GetXmlElementForInteropType(type, out xmlName, out xmlNamespace))
            {
                attributeInfo.m_attributeType |= SoapAttributeType.XmlElement;
                attributeInfo.m_elementName = xmlName;
                attributeInfo.m_nameSpace = xmlNamespace;
            }

            if (SoapServices.GetXmlTypeForInteropType(type, out xmlName, out xmlNamespace))
            {
                attributeInfo.m_attributeType |= SoapAttributeType.XmlType;
                attributeInfo.m_typeName = xmlName;
                attributeInfo.m_typeNamespace = xmlNamespace;
            }

        } // ProcessTypeAttribute
Exemple #30
0
        // Write constructor
        internal void InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo)
        {
            InternalST.Soap( this, objectInfoId," Constructor 1 ",obj);        
            this.context = context;
            this.obj = obj;
            this.serObjectInfoInit = serObjectInfoInit;
            this.parentMemberAttributeInfo = attributeInfo;
            this.surrogateSelector = surrogateSelector;
            this.converter = converter;
            ISurrogateSelector surrogateSelectorTemp;

            if (RemotingServices.IsTransparentProxy(obj))
                objectType = Converter.typeofMarshalByRefObject;
            else
                objectType = obj.GetType();

            if (objectType.IsArray)
            {
                arrayElemObjectInfo = Serialize(objectType.GetElementType(), surrogateSelector, context, serObjectInfoInit, converter, null);
                typeAttributeInfo = GetTypeAttributeInfo();
                isArray = true;
                InitNoMembers();
                return;
            }

            InternalST.Soap( this, objectInfoId," Constructor 1 trace 2");

            typeAttributeInfo = GetTypeAttributeInfo();

            if (surrogateSelector != null && (serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp)) != null)
            {
                InternalST.Soap( this, objectInfoId," Constructor 1 trace 3");         
                si = new SerializationInfo(objectType, converter);
                if (!objectType.IsPrimitive)
                    serializationSurrogate.GetObjectData(obj, si, context);
                InitSiWrite();
            }
            else if (obj is ISerializable)
            {
                if (!objectType.IsSerializable)
                {
                    throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_NonSerType"), 
                                                                   objectType.FullName, objectType.Module.Assembly.FullName));
                }
                si = new SerializationInfo(objectType, converter);
                ((ISerializable)obj).GetObjectData(si, context);
                InternalST.Soap( this, objectInfoId," Constructor 1 trace 4 ISerializable "+objectType);                       
                InitSiWrite();
            }
            else
            {
                InternalST.Soap(this, objectInfoId," Constructor 1 trace 5");
                InitMemberInfo();
            }
        }
Exemple #31
0
 internal void Dump(string value)
 {
     SoapAttributeInfo nIattributeInfo = this.NIattributeInfo;
 }
Exemple #32
0
        private void InternalInit()
        {
            InternalST.Soap( this, objectInfoId," objectType ",objectType," InternalInit");                                                                                        
            obj = null;
            objectType = null;
            count = 0;
            isSi = false;
            isNamed = false;
            isTyped = false;
            si = null;
            wireMemberNames = null;
            wireMemberTypes = null;
            cache = null;
            lastPosition = 0;
            numberMembersSeen = 0;

            bfake = false;
            bSoapFault = false;
            majorVersion = 0;
            minorVersion = 0;
            typeAttributeInfo = null;
            arrayElemObjectInfo = null;



            // Si Read
            if (memberTypesList != null)
            {
                memberTypesList.Clear();
            }

        }
 internal static WriteObjectInfo Serialize(object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo, ObjectWriter objectWriter)
 {
     WriteObjectInfo objectInfo = GetObjectInfo(serObjectInfoInit);
     objectInfo.InitSerialize(obj, surrogateSelector, context, serObjectInfoInit, converter, attributeInfo, objectWriter);
     return objectInfo;
 }
Exemple #34
0
        private void InternalInit()
        {
            InternalST.Soap( this, objectInfoId," InternalInit");                                                                                        
            obj = null;
            objectType = null;
            isSi = false;
            isNamed = false;
            isTyped = false;
            si = null;
            cache = null;
            memberData = null;
            isArray = false;

            // Writing and Parsing information
            objectId = 0;
            assemId = 0;

            // Added for Soap
            lastPosition = 0;
            typeAttributeInfo = null;
            parentMemberAttributeInfo = null;
            arrayElemObjectInfo = null;
        }
 internal void InitSerialize(object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo, ObjectWriter objectWriter)
 {
     this.context = context;
     this.obj = obj;
     this.serObjectInfoInit = serObjectInfoInit;
     this.parentMemberAttributeInfo = attributeInfo;
     this.surrogateSelector = surrogateSelector;
     this.converter = converter;
     if (RemotingServices.IsTransparentProxy(obj))
     {
         this.objectType = Converter.typeofMarshalByRefObject;
     }
     else
     {
         this.objectType = obj.GetType();
     }
     if (this.objectType.IsArray)
     {
         this.arrayElemObjectInfo = Serialize(this.objectType.GetElementType(), surrogateSelector, context, serObjectInfoInit, converter, null);
         this.typeAttributeInfo = this.GetTypeAttributeInfo();
         this.isArray = true;
         this.InitNoMembers();
     }
     else
     {
         ISurrogateSelector selector;
         this.typeAttributeInfo = this.GetTypeAttributeInfo();
         objectWriter.ObjectManager.RegisterObject(obj);
         if ((surrogateSelector != null) && ((this.serializationSurrogate = surrogateSelector.GetSurrogate(this.objectType, context, out selector)) != null))
         {
             this.si = new SerializationInfo(this.objectType, converter);
             if (!this.objectType.IsPrimitive)
             {
                 this.serializationSurrogate.GetObjectData(obj, this.si, context);
             }
             this.InitSiWrite(objectWriter);
         }
         else if (obj is ISerializable)
         {
             if (!this.objectType.IsSerializable)
             {
                 throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_NonSerType"), new object[] { this.objectType.FullName, this.objectType.Module.Assembly.FullName }));
             }
             this.si = new SerializationInfo(this.objectType, converter);
             ((ISerializable) obj).GetObjectData(this.si, context);
             this.InitSiWrite(objectWriter);
         }
         else
         {
             this.InitMemberInfo();
         }
     }
 }
 private SoapAttributeInfo GetTypeAttributeInfo()
 {
     if (this.arrayElemObjectInfo != null)
     {
         return this.arrayElemObjectInfo.GetTypeAttributeInfo();
     }
     SoapAttributeInfo attributeInfo = null;
     if (this.parentMemberAttributeInfo != null)
     {
         attributeInfo = this.parentMemberAttributeInfo;
     }
     else
     {
         attributeInfo = new SoapAttributeInfo();
     }
     Attr.ProcessTypeAttribute(this.objectType, attributeInfo);
     return attributeInfo;
 }
Exemple #37
0
        internal static WriteObjectInfo Serialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo)
        {
            WriteObjectInfo soi = GetObjectInfo(serObjectInfoInit);

            soi.InitSerialize(objectType, surrogateSelector, context, serObjectInfoInit, converter, attributeInfo);
            return(soi);
        }
        internal static WriteObjectInfo Serialize(object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo, ObjectWriter objectWriter)
        {
            WriteObjectInfo objectInfo = GetObjectInfo(serObjectInfoInit);

            objectInfo.InitSerialize(obj, surrogateSelector, context, serObjectInfoInit, converter, attributeInfo, objectWriter);
            return(objectInfo);
        }
Exemple #39
0
        // Return the information about the object's members

        internal  void GetMemberInfo(out String[] outMemberNames, out Type[] outMemberTypes, out Object[] outMemberData, out SoapAttributeInfo[] outAttributeInfo)
        {
            outMemberNames = cache.memberNames;
            outMemberTypes = cache.memberTypes;
            outMemberData = memberData;
            outAttributeInfo = cache.memberAttributeInfos;

            if (isSi)
            {
                if (!isNamed)
                    throw new SerializationException(SoapUtil.GetResourceString("Serialization_ISerializableMemberInfo"));
            }
        }
Exemple #40
0
        // Check for Interop type (SchemaType)
        private SoapAttributeInfo GetTypeAttributeInfo()
        {
            if (arrayElemObjectInfo != null)
                return arrayElemObjectInfo.GetTypeAttributeInfo();

            SoapAttributeInfo attributeInfo = null;
            if (parentMemberAttributeInfo != null)
                attributeInfo = parentMemberAttributeInfo;
            else
                attributeInfo = new SoapAttributeInfo();

            Attr.ProcessTypeAttribute(objectType, attributeInfo);       

            attributeInfo.Dump("type "+objectType);         
            return attributeInfo;
        }
 private void InitReadConstructor(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, string assemblyName)
 {
     if (objectType.IsArray)
     {
         this.arrayElemObjectInfo = Create(objectType.GetElementType(), surrogateSelector, context, this.objectManager, this.serObjectInfoInit, this.formatterConverter, assemblyName);
         this.typeAttributeInfo = this.GetTypeAttributeInfo();
         this.InitNoMembers();
     }
     else
     {
         ISurrogateSelector selector = null;
         if (surrogateSelector != null)
         {
             this.serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out selector);
         }
         if (this.serializationSurrogate != null)
         {
             this.isSi = true;
         }
         else if (!(objectType == Converter.typeofObject) && Converter.typeofISerializable.IsAssignableFrom(objectType))
         {
             this.isSi = true;
         }
         if (this.isSi)
         {
             this.si = new SerializationInfo(objectType, this.formatterConverter);
             this.InitSiRead(assemblyName);
         }
         else
         {
             this.InitMemberInfo();
         }
     }
 }
Exemple #42
0
        private void InitReadConstructor(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, String assemblyName)
        {
            InternalST.Soap( this,objectInfoId," ", objectType," InitReadConstructor Entry ",objectType);

            if (objectType.IsArray)
            {
                arrayElemObjectInfo = Create(objectType.GetElementType(), surrogateSelector, context, objectManager, serObjectInfoInit, formatterConverter, assemblyName);
                typeAttributeInfo = GetTypeAttributeInfo();
                InitNoMembers();
                return;         
            }

            ISurrogateSelector surrogateSelectorTemp = null;

            if (surrogateSelector!=null)
                serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp);

            if (serializationSurrogate != null)
            {
                isSi = true;
            }
            else if (objectType == Converter.typeofObject)
            {
            }
            else if (Converter.typeofISerializable.IsAssignableFrom(objectType))
                isSi = true;

            if (isSi)
            {
                si = new SerializationInfo(objectType, formatterConverter);
                InitSiRead(assemblyName);
            }
            else
            {
                InitMemberInfo();
            }
            InternalST.Soap( this,objectInfoId," ", objectType," InitReadConstructor Exit ",isSi);     
        }
 private SoapAttributeInfo GetTypeAttributeInfo()
 {
     if (this.arrayElemObjectInfo != null)
     {
         return this.arrayElemObjectInfo.GetTypeAttributeInfo();
     }
     SoapAttributeInfo attributeInfo = null;
     attributeInfo = new SoapAttributeInfo();
     Attr.ProcessTypeAttribute(this.objectType, attributeInfo);
     return attributeInfo;
 }
 internal void InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo)
 {
     this.objectType = objectType;
     this.context = context;
     this.serObjectInfoInit = serObjectInfoInit;
     this.parentMemberAttributeInfo = attributeInfo;
     this.surrogateSelector = surrogateSelector;
     this.converter = converter;
     if (objectType.IsArray)
     {
         this.arrayElemObjectInfo = Serialize(objectType.GetElementType(), surrogateSelector, context, serObjectInfoInit, converter, null);
         this.typeAttributeInfo = this.GetTypeAttributeInfo();
         this.InitNoMembers();
     }
     else
     {
         this.typeAttributeInfo = this.GetTypeAttributeInfo();
         ISurrogateSelector selector = null;
         if (surrogateSelector != null)
         {
             this.serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out selector);
         }
         if (this.serializationSurrogate != null)
         {
             this.isSi = true;
         }
         else if (!(objectType == Converter.typeofObject) && Converter.typeofISerializable.IsAssignableFrom(objectType))
         {
             this.isSi = true;
         }
         if (this.isSi)
         {
             this.si = new SerializationInfo(objectType, converter);
             this.cache = new SerObjectInfoCache();
             this.cache.fullTypeName = this.si.FullTypeName;
             this.cache.assemblyString = this.si.AssemblyName;
         }
         else
         {
             this.InitMemberInfo();
         }
     }
 }
 private void InternalInit()
 {
     this.obj = null;
     this.objectType = null;
     this.isSi = false;
     this.isNamed = false;
     this.isTyped = false;
     this.si = null;
     this.cache = null;
     this.memberData = null;
     this.isArray = false;
     this.objectId = 0L;
     this.assemId = 0L;
     this.lastPosition = 0;
     this.typeAttributeInfo = null;
     this.parentMemberAttributeInfo = null;
     this.arrayElemObjectInfo = null;
 }
Exemple #46
0
        // Write constructor
        internal void InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo, ObjectWriter objectWriter)
        {
            InternalST.Soap(this, objectInfoId, " Constructor 1 ", obj);
            this.context                   = context;
            this.obj                       = obj;
            this.serObjectInfoInit         = serObjectInfoInit;
            this.parentMemberAttributeInfo = attributeInfo;
            this.surrogateSelector         = surrogateSelector;
            this.converter                 = converter;
            ISurrogateSelector surrogateSelectorTemp;

            if (RemotingServices.IsTransparentProxy(obj))
            {
                objectType = Converter.typeofMarshalByRefObject;
            }
            else
            {
                objectType = obj.GetType();
            }

            if (objectType.IsArray)
            {
                arrayElemObjectInfo = Serialize(objectType.GetElementType(), surrogateSelector, context, serObjectInfoInit, converter, null);
                typeAttributeInfo   = GetTypeAttributeInfo();
                isArray             = true;
                InitNoMembers();
                return;
            }

            InternalST.Soap(this, objectInfoId, " Constructor 1 trace 2");

            typeAttributeInfo = GetTypeAttributeInfo();

            objectWriter.ObjectManager.RegisterObject(obj);
            if (surrogateSelector != null && (serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp)) != null)
            {
                InternalST.Soap(this, objectInfoId, " Constructor 1 trace 3");
                si = new SerializationInfo(objectType, converter);
                if (!objectType.IsPrimitive)
                {
                    serializationSurrogate.GetObjectData(obj, si, context);
                }
                InitSiWrite(objectWriter);
            }
            else if (obj is ISerializable)
            {
                if (!objectType.IsSerializable)
                {
                    throw new SerializationException(String.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_NonSerType"),
                                                                   objectType.FullName, objectType.Module.Assembly.FullName));
                }
                si = new SerializationInfo(objectType, converter);
                ((ISerializable)obj).GetObjectData(si, context);
                InternalST.Soap(this, objectInfoId, " Constructor 1 trace 4 ISerializable " + objectType);
                InitSiWrite(objectWriter);
            }
            else
            {
                InternalST.Soap(this, objectInfoId, " Constructor 1 trace 5");
                InitMemberInfo();
            }
        }
 private void InternalInit()
 {
     this.obj = null;
     this.objectType = null;
     this.count = 0;
     this.isSi = false;
     this.isNamed = false;
     this.isTyped = false;
     this.si = null;
     this.wireMemberNames = null;
     this.wireMemberTypes = null;
     this.cache = null;
     this.lastPosition = 0;
     this.numberMembersSeen = 0;
     this.bfake = false;
     this.bSoapFault = false;
     this.majorVersion = 0;
     this.minorVersion = 0;
     this.typeAttributeInfo = null;
     this.arrayElemObjectInfo = null;
     if (this.memberTypesList != null)
     {
         this.memberTypesList.Clear();
     }
 }