internal virtual void Fixup(ParseRecord record, ParseRecord parent)
        {
            object pRnewObj = record.PRnewObj;
            switch (this.valueFixupEnum)
            {
                case ValueFixupEnum.Array:
                    this.arrayObj.SetValue(pRnewObj, this.indexMap);
                    return;

                case ValueFixupEnum.Header:
                    break;

                case ValueFixupEnum.Member:
                    if (!this.objectInfo.isSi)
                    {
                        MemberInfo memberInfo = this.objectInfo.GetMemberInfo(this.memberName);
                        this.objectInfo.objectManager.RecordFixup(parent.PRobjectId, memberInfo, record.PRobjectId);
                        break;
                    }
                    this.objectInfo.objectManager.RecordDelayedFixup(parent.PRobjectId, this.memberName, record.PRobjectId);
                    return;

                default:
                    return;
            }
        }
        private void ParseMemberEnd(ParseRecord pr)
        {
            switch (pr.PRmemberTypeEnum)
            {
                case InternalMemberTypeE.Field:
                    if (pr.PRmemberValueEnum != InternalMemberValueE.Nested)
                    {
                        break;
                    }
                    this.ParseObjectEnd(pr);
                    return;

                case InternalMemberTypeE.Item:
                    this.ParseArrayMemberEnd(pr);
                    return;

                default:
                    if (pr.PRmemberValueEnum == InternalMemberValueE.Nested)
                    {
                        this.ParseObjectEnd(pr);
                        return;
                    }
                    this.ParseError(pr, (ParseRecord) this.stack.Peek());
                    break;
            }
        }
 private void ParseMember(ParseRecord pr)
 {
     ParseRecord parentPr = (ParseRecord) this.stack.Peek();
     if (parentPr != null)
     {
         string pRname = parentPr.PRname;
     }
     if ((parentPr.PRdtType == Converter.typeofSoapFault) && (pr.PRname.ToLower(CultureInfo.InvariantCulture) == "faultstring"))
     {
         this.faultString = pr.PRvalue;
     }
     if ((parentPr.PRobjectPositionEnum == InternalObjectPositionE.Top) && !this.isTopObjectResolved)
     {
         if (pr.PRdtType == Converter.typeofString)
         {
             this.ParseString(pr, parentPr);
         }
         this.topStack.Push(pr.Copy());
     }
     else
     {
         switch (pr.PRmemberTypeEnum)
         {
             case InternalMemberTypeE.Item:
                 this.ParseArrayMember(pr);
                 return;
         }
         if (parentPr.PRobjectInfo != null)
         {
             parentPr.PRobjectInfo.AddMemberSeen();
         }
         bool flag = ((this.IsFakeTopObject && (parentPr.PRobjectPositionEnum == InternalObjectPositionE.Top)) && (parentPr.PRobjectInfo != null)) && (parentPr.PRdtType != Converter.typeofSoapFault);
         if ((pr.PRdtType == null) && parentPr.PRobjectInfo.isTyped)
         {
             if (flag)
             {
                 pr.PRdtType = parentPr.PRobjectInfo.GetType(this.paramPosition++);
             }
             else
             {
                 pr.PRdtType = parentPr.PRobjectInfo.GetType(pr.PRname);
             }
             if (pr.PRdtType == null)
             {
                 throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_TypeResolved"), new object[] { parentPr.PRnewObj + " " + pr.PRname }));
             }
             pr.PRdtTypeCode = Converter.ToCode(pr.PRdtType);
         }
         else if (flag)
         {
             this.paramPosition++;
         }
         if (pr.PRmemberValueEnum == InternalMemberValueE.Null)
         {
             parentPr.PRobjectInfo.AddValue(pr.PRname, null);
         }
         else if (pr.PRmemberValueEnum == InternalMemberValueE.Nested)
         {
             this.ParseObject(pr);
             this.stack.Push(pr);
             if ((pr.PRobjectInfo != null) && pr.PRobjectInfo.objectType.IsValueType)
             {
                 if (this.IsFakeTopObject)
                 {
                     parentPr.PRobjectInfo.AddParamName(pr.PRname);
                 }
                 pr.PRisValueTypeFixup = true;
                 this.valueFixupStack.Push(new ValueFixup(parentPr.PRnewObj, pr.PRname, parentPr.PRobjectInfo));
             }
             else
             {
                 parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRnewObj);
             }
         }
         else if (pr.PRmemberValueEnum == InternalMemberValueE.Reference)
         {
             object obj2 = this.m_objectManager.GetObject(pr.PRidRef);
             if (obj2 == null)
             {
                 parentPr.PRobjectInfo.AddValue(pr.PRname, null);
                 parentPr.PRobjectInfo.RecordFixup(parentPr.PRobjectId, pr.PRname, pr.PRidRef);
             }
             else
             {
                 parentPr.PRobjectInfo.AddValue(pr.PRname, obj2);
             }
         }
         else if (pr.PRmemberValueEnum == InternalMemberValueE.InlineValue)
         {
             if (pr.PRdtType == Converter.typeofString)
             {
                 this.ParseString(pr, parentPr);
                 parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRvalue);
             }
             else if (pr.PRdtTypeCode != InternalPrimitiveTypeE.Invalid)
             {
                 object pRvarValue = null;
                 if (pr.PRvarValue != null)
                 {
                     pRvarValue = pr.PRvarValue;
                 }
                 else
                 {
                     pRvarValue = Converter.FromString(pr.PRvalue, pr.PRdtTypeCode);
                 }
                 if ((pr.PRdtTypeCode == InternalPrimitiveTypeE.QName) && (pRvarValue != null))
                 {
                     SoapQName name = (SoapQName) pRvarValue;
                     if (name.Key != null)
                     {
                         if (name.Key.Length == 0)
                         {
                             name.Namespace = (string) this.soapHandler.keyToNamespaceTable["xmlns"];
                         }
                         else
                         {
                             name.Namespace = (string) this.soapHandler.keyToNamespaceTable["xmlns:" + name.Key];
                         }
                     }
                 }
                 parentPr.PRobjectInfo.AddValue(pr.PRname, pRvarValue);
             }
             else if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64)
             {
                 parentPr.PRobjectInfo.AddValue(pr.PRname, Convert.FromBase64String(this.FilterBin64(pr.PRvalue)));
             }
             else if ((pr.PRdtType != Converter.typeofObject) || (pr.PRvalue == null))
             {
                 if ((pr.PRdtType != null) && pr.PRdtType.IsEnum)
                 {
                     object obj3 = Enum.Parse(pr.PRdtType, pr.PRvalue);
                     parentPr.PRobjectInfo.AddValue(pr.PRname, obj3);
                 }
                 else if ((pr.PRdtType != null) && (pr.PRdtType == Converter.typeofTypeArray))
                 {
                     parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRvarValue);
                 }
                 else
                 {
                     if (!pr.PRisRegistered && (pr.PRobjectId > 0L))
                     {
                         if (pr.PRvalue == null)
                         {
                             pr.PRvalue = "";
                         }
                         this.RegisterObject(pr.PRvalue, pr, parentPr);
                     }
                     if (pr.PRdtType == Converter.typeofSystemVoid)
                     {
                         parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRdtType);
                     }
                     else if (parentPr.PRobjectInfo.isSi)
                     {
                         parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRvalue);
                     }
                 }
             }
             else if ((parentPr != null) && (parentPr.PRdtType == Converter.typeofHeader))
             {
                 pr.PRdtType = Converter.typeofString;
                 this.ParseString(pr, parentPr);
                 parentPr.PRobjectInfo.AddValue(pr.PRname, pr.PRvalue);
             }
         }
         else
         {
             this.ParseError(pr, parentPr);
         }
     }
 }
 private void ParseArrayMemberEnd(ParseRecord pr)
 {
     if (pr.PRmemberValueEnum == InternalMemberValueE.Nested)
     {
         this.ParseObjectEnd(pr);
     }
 }
 private void ParseArray(ParseRecord pr)
 {
     if (pr.PRobjectId < 1L)
     {
         pr.PRobjectId = this.GetId("GenId-" + this.objectIds);
     }
     if ((pr.PRarrayElementType != null) && pr.PRarrayElementType.IsEnum)
     {
         pr.PRisEnum = true;
     }
     if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64)
     {
         if (pr.PRvalue == null)
         {
             pr.PRnewObj = new byte[0];
             this.CheckSecurity(pr);
         }
         else if (pr.PRdtType == Converter.typeofSoapBase64Binary)
         {
             pr.PRnewObj = SoapBase64Binary.Parse(pr.PRvalue);
             this.CheckSecurity(pr);
         }
         else if (pr.PRvalue.Length > 0)
         {
             pr.PRnewObj = Convert.FromBase64String(this.FilterBin64(pr.PRvalue));
             this.CheckSecurity(pr);
         }
         else
         {
             pr.PRnewObj = new byte[0];
             this.CheckSecurity(pr);
         }
         if (this.stack.Peek() == pr)
         {
             this.stack.Pop();
         }
         if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
         {
             this.topObject = pr.PRnewObj;
             this.isTopObjectResolved = true;
         }
         ParseRecord objectPr = (ParseRecord) this.stack.Peek();
         this.RegisterObject(pr.PRnewObj, pr, objectPr);
     }
     else if ((pr.PRnewObj != null) && Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode))
     {
         if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
         {
             this.topObject = pr.PRnewObj;
             this.isTopObjectResolved = true;
         }
         ParseRecord record2 = (ParseRecord) this.stack.Peek();
         this.RegisterObject(pr.PRnewObj, pr, record2);
     }
     else if ((pr.PRarrayTypeEnum == InternalArrayTypeE.Jagged) || (pr.PRarrayTypeEnum == InternalArrayTypeE.Single))
     {
         if ((pr.PRlowerBoundA == null) || (pr.PRlowerBoundA[0] == 0))
         {
             pr.PRnewObj = Array.CreateInstance(pr.PRarrayElementType, (pr.PRrank > 0) ? pr.PRlengthA[0] : 0);
             pr.PRisLowerBound = false;
         }
         else
         {
             pr.PRnewObj = Array.CreateInstance(pr.PRarrayElementType, pr.PRlengthA, pr.PRlowerBoundA);
             pr.PRisLowerBound = true;
         }
         if (pr.PRarrayTypeEnum == InternalArrayTypeE.Single)
         {
             if (!pr.PRisLowerBound && Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode))
             {
                 pr.PRprimitiveArray = new PrimitiveArray(pr.PRarrayElementTypeCode, (Array) pr.PRnewObj);
             }
             else if (!pr.PRarrayElementType.IsValueType && (pr.PRlowerBoundA == null))
             {
                 pr.PRobjectA = (object[]) pr.PRnewObj;
             }
         }
         this.CheckSecurity(pr);
         if (pr.PRobjectPositionEnum == InternalObjectPositionE.Headers)
         {
             this.headers = (Header[]) pr.PRnewObj;
         }
         pr.PRindexMap = new int[1];
     }
     else
     {
         if (pr.PRarrayTypeEnum != InternalArrayTypeE.Rectangular)
         {
             throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_ArrayType"), new object[] { pr.PRarrayTypeEnum.ToString() }));
         }
         pr.PRisLowerBound = false;
         if (pr.PRlowerBoundA != null)
         {
             for (int j = 0; j < pr.PRrank; j++)
             {
                 if (pr.PRlowerBoundA[j] != 0)
                 {
                     pr.PRisLowerBound = true;
                 }
             }
         }
         if (!pr.PRisLowerBound)
         {
             pr.PRnewObj = Array.CreateInstance(pr.PRarrayElementType, pr.PRlengthA);
         }
         else
         {
             pr.PRnewObj = Array.CreateInstance(pr.PRarrayElementType, pr.PRlengthA, pr.PRlowerBoundA);
         }
         this.CheckSecurity(pr);
         int num3 = 1;
         for (int i = 0; i < pr.PRrank; i++)
         {
             num3 *= pr.PRlengthA[i];
         }
         pr.PRindexMap = new int[pr.PRrank];
         pr.PRrectangularMap = new int[pr.PRrank];
         pr.PRlinearlength = num3;
     }
 }
 private void NextRectangleMap(ParseRecord pr)
 {
     for (int i = pr.PRrank - 1; i > -1; i--)
     {
         if (pr.PRrectangularMap[i] < (pr.PRlengthA[i] - 1))
         {
             pr.PRrectangularMap[i]++;
             if (i < (pr.PRrank - 1))
             {
                 for (int j = i + 1; j < pr.PRrank; j++)
                 {
                     pr.PRrectangularMap[j] = 0;
                 }
             }
             Array.Copy(pr.PRrectangularMap, pr.PRindexMap, pr.PRrank);
             return;
         }
     }
 }
 private void RegisterObject(object obj, ParseRecord pr, ParseRecord objectPr)
 {
     if (!pr.PRisRegistered)
     {
         pr.PRisRegistered = true;
         SerializationInfo si = null;
         long idOfContainingObj = 0L;
         MemberInfo member = null;
         int[] arrayIndex = null;
         if (objectPr != null)
         {
             arrayIndex = objectPr.PRindexMap;
             idOfContainingObj = objectPr.PRobjectId;
             if ((objectPr.PRobjectInfo != null) && !objectPr.PRobjectInfo.isSi)
             {
                 member = objectPr.PRobjectInfo.GetMemberInfo(pr.PRname);
             }
         }
         if (pr.PRobjectInfo != null)
         {
             si = pr.PRobjectInfo.si;
         }
         this.m_objectManager.RegisterObject(obj, pr.PRobjectId, si, idOfContainingObj, member, arrayIndex);
     }
 }
 private void ParseSerializedStreamHeaderEnd(ParseRecord pr)
 {
     this.stack.Pop();
 }
Exemple #9
0
        private ParseRecord GetPr()
        {
            ParseRecord pr = null;

            if (!prPool.IsEmpty())
            {
                pr = (ParseRecord)prPool.Pop();
                pr.Init();
            }
            else
                pr = new ParseRecord();

            return pr;
        }
Exemple #10
0
        private void ProcessHeaderEnd(ParseRecord pr)
        {
            InternalST.Soap( this,"ProcessHeaderEnd ");
            pr.Dump();

            if (headerList == null)
                return; // Empty header array


            // Object End
            ParseRecord headerPr = GetPr();
            headerPr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
            headerPr.PRobjectTypeEnum = InternalObjectTypeE.Array;
            headerList.Add(headerPr);

            headerPr = (ParseRecord)headerList[0];
            headerPr = (ParseRecord)headerList[0];
            headerPr.PRlengthA[0] = headerArrayLength;
            headerPr.PRobjectPositionEnum = InternalObjectPositionE.Headers;            

            for (int i=0; i<headerList.Count; i++)
            {
                InternalST.Soap( this, "Parse Header Record ",i);
                InternalST.Soap( this,"ObjectReader.Parse 9");              
                objectReader.Parse((ParseRecord)headerList[i]);
            }

            for (int i=0; i<headerList.Count; i++)
                PutPr((ParseRecord)headerList[i]);
        }
Exemple #11
0
        private void ProcessHeaderMemberEnd(ParseRecord pr)
        {
            ParseRecord headerPr = null;

            InternalST.Soap( this,"ProcessHeaderMemberEnd HeaderState ",((Enum)headerState).ToString());
            pr.Dump(); 

            if (headerState == HeaderStateEnum.NestedObject)
            {
                ParseRecord newPr = pr.Copy();
                headerList.Add(newPr);
            }
            else
            {
                // Member End
                headerPr = GetPr();
                headerPr.PRparseTypeEnum = InternalParseTypeE.MemberEnd;
                headerPr.PRmemberTypeEnum = InternalMemberTypeE.Field;
                headerPr.PRmemberValueEnum = pr.PRmemberValueEnum;
                headerPr.PRisHeaderRoot = true;
                headerList.Add(headerPr);

                // Item End
                headerPr = GetPr();
                headerPr.PRparseTypeEnum = InternalParseTypeE.MemberEnd;
                headerPr.PRmemberTypeEnum = InternalMemberTypeE.Item;
                headerPr.PRmemberValueEnum = InternalMemberValueE.Nested;
                headerPr.PRisHeaderRoot = true;             
                headerList.Add(headerPr);
            }
        }
Exemple #12
0
        private void ProcessHeaderMember(ParseRecord pr)
        {
            ParseRecord headerPr;

            InternalST.Soap( this,"ProcessHeaderMember HeaderState ",((Enum)headerState).ToString());
            pr.Dump(); 

            if (headerState == HeaderStateEnum.NestedObject)
            {
                // Nested object in Header member
                ParseRecord newPr = pr.Copy();
                headerList.Add(newPr);
                return;
            }

            // Item record
            headerPr = GetPr();
            headerPr.PRparseTypeEnum = InternalParseTypeE.Member;
            headerPr.PRmemberTypeEnum = InternalMemberTypeE.Item;
            headerPr.PRmemberValueEnum = InternalMemberValueE.Nested;
            headerPr.PRisHeaderRoot = true;
            headerArrayLength++;
            headerList.Add(headerPr);

            // Name field
            headerPr = GetPr();
            headerPr.PRparseTypeEnum = InternalParseTypeE.Member;
            headerPr.PRmemberTypeEnum = InternalMemberTypeE.Field;
            headerPr.PRmemberValueEnum = InternalMemberValueE.InlineValue;
            headerPr.PRisHeaderRoot = true;
            headerPr.PRname = "Name";
            headerPr.PRvalue = pr.PRname;
            headerPr.PRdtType = SoapUtil.typeofString;
            headerPr.PRdtTypeCode = InternalPrimitiveTypeE.Invalid;
            headerList.Add(headerPr);

            // Namespace field
            headerPr = GetPr();
            headerPr.PRparseTypeEnum = InternalParseTypeE.Member;
            headerPr.PRmemberTypeEnum = InternalMemberTypeE.Field;
            headerPr.PRmemberValueEnum = InternalMemberValueE.InlineValue;
            headerPr.PRisHeaderRoot = true;
            headerPr.PRname = "HeaderNamespace";
            headerPr.PRvalue = pr.PRxmlNameSpace;
            headerPr.PRdtType = SoapUtil.typeofString;
            headerPr.PRdtTypeCode = InternalPrimitiveTypeE.Invalid;
            headerList.Add(headerPr);

            // MustUnderstand Field
            headerPr = GetPr();
            headerPr.PRparseTypeEnum = InternalParseTypeE.Member;
            headerPr.PRmemberTypeEnum = InternalMemberTypeE.Field;
            headerPr.PRmemberValueEnum = InternalMemberValueE.InlineValue;
            headerPr.PRisHeaderRoot = true;         
            headerPr.PRname = "MustUnderstand";
            if (pr.PRisMustUnderstand)
                headerPr.PRvarValue = true;
            else
                headerPr.PRvarValue = false;            
            headerPr.PRdtType = SoapUtil.typeofBoolean;
            headerPr.PRdtTypeCode = InternalPrimitiveTypeE.Boolean;
            headerList.Add(headerPr);       

            // Value field
            headerPr = GetPr();
            headerPr.PRparseTypeEnum = InternalParseTypeE.Member;
            headerPr.PRmemberTypeEnum = InternalMemberTypeE.Field;
            headerPr.PRmemberValueEnum = pr.PRmemberValueEnum;
            headerPr.PRisHeaderRoot = true;         
            headerPr.PRname = "Value";
            switch (pr.PRmemberValueEnum)
            {
                case InternalMemberValueE.Null:
                    headerList.Add(headerPr);
                    ProcessHeaderMemberEnd(pr);
                    break;
                case InternalMemberValueE.Reference:
                    headerPr.PRidRef = pr.PRidRef;
                    headerList.Add(headerPr);
                    ProcessHeaderMemberEnd(pr);             
                    break;
                case InternalMemberValueE.Nested:
                    headerPr.PRdtType = pr.PRdtType;
                    headerPr.PRdtTypeCode = pr.PRdtTypeCode;
                    headerPr.PRkeyDt = pr.PRkeyDt;
                    headerList.Add(headerPr);
                    // ProcessHeaderMemberEnd will be called from the parse loop
                    break;

                case InternalMemberValueE.InlineValue:
                    headerPr.PRvalue = pr.PRvalue;
                    headerPr.PRvarValue = pr.PRvarValue;
                    headerPr.PRdtType = pr.PRdtType;
                    headerPr.PRdtTypeCode = pr.PRdtTypeCode;
                    headerPr.PRkeyDt = pr.PRkeyDt;
                    headerList.Add(headerPr);
                    ProcessHeaderMemberEnd(pr);             
                    break;
            }
        }
Exemple #13
0
        private void ProcessHeader(ParseRecord pr)
        {
            InternalST.Soap( this,"ProcessHeader ");
            pr.Dump();

            if (headerList == null)
                headerList = new ArrayList(10);
            ParseRecord headerPr = GetPr();
            headerPr.PRparseTypeEnum = InternalParseTypeE.Object;
            headerPr.PRobjectTypeEnum = InternalObjectTypeE.Array;
            headerPr.PRobjectPositionEnum = InternalObjectPositionE.Headers;
            headerPr.PRarrayTypeEnum = InternalArrayTypeE.Single;
            headerPr.PRarrayElementType = typeof(System.Runtime.Remoting.Messaging.Header);
            headerPr.PRisArrayVariant = false;
            headerPr.PRarrayElementTypeCode = InternalPrimitiveTypeE.Invalid;
            headerPr.PRrank = 1;
            headerPr.PRlengthA = new int[1];                
            headerList.Add(headerPr);
        }
Exemple #14
0
        private void ProcessXmlAttribute(String prefix, String key, String value, ParseRecord objectPr)
        {
            InternalST.Soap( this,"ProcessXmlAttribute prefix ",prefix, " key ", key, " value ",value);         
            if (xmlAttributeList == null)
                xmlAttributeList = new ArrayList(10);
            ParseRecord pr = GetPr();
            pr.PRparseTypeEnum = InternalParseTypeE.Member;
            pr.PRmemberTypeEnum = InternalMemberTypeE.Field;
            pr.PRmemberValueEnum = InternalMemberValueE.InlineValue;
            pr.PRname = key;
            pr.PRvalue = value;
            pr.PRnameXmlKey = prefix;
            pr.PRisXmlAttribute = true;

            ProcessType(pr, objectPr);

            xmlAttributeList.Add(pr);
        }
Exemple #15
0
        // Determine the Array  information from the dt attribute
        private void ProcessArray(ParseRecord pr, int firstIndex, bool IsInterop)
        {
            InternalST.Soap( this, "ProcessArray Enter ",firstIndex," ",pr.PRkeyDt);
            String dimString = null;
            String xmlKey = pr.PRtypeXmlKey;
            InternalPrimitiveTypeE primitiveArrayTypeCode = InternalPrimitiveTypeE.Invalid;
            pr.PRobjectTypeEnum = InternalObjectTypeE.Array;
            pr.PRmemberTypeEnum = InternalMemberTypeE.Item; // Need this set in case this it is a nested empty array
            pr.PRprimitiveArrayTypeString = pr.PRkeyDt.Substring(0, firstIndex);
            dimString = pr.PRkeyDt.Substring(firstIndex);
            if (IsInterop)
            {
                String assemblyString = (String)assemKeyToInteropAssemblyTable[pr.PRtypeXmlKey];
                pr.PRarrayElementType = objectReader.Bind(assemblyString, pr.PRprimitiveArrayTypeString); // try to get type from SerializationBinder
                if (pr.PRarrayElementType == null)
                    pr.PRarrayElementType = SoapServices.GetInteropTypeFromXmlType(pr.PRprimitiveArrayTypeString, assemblyString);
                if (pr.PRarrayElementType == null)
                    throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_TypeElement"),pr.PRname+" "+pr.PRkeyDt));
                pr.PRprimitiveArrayTypeString = pr.PRarrayElementType.FullName;
            }
            else
            {
                primitiveArrayTypeCode = Converter.ToCode(pr.PRprimitiveArrayTypeString);
                if (primitiveArrayTypeCode != InternalPrimitiveTypeE.Invalid)
                {
                    pr.PRprimitiveArrayTypeString = Converter.SoapToComType(primitiveArrayTypeCode);
                    xmlKey = urtKey;
                }
                else if (String.Compare(pr.PRprimitiveArrayTypeString, "string", false, CultureInfo.InvariantCulture) == 0)
                {
                    pr.PRprimitiveArrayTypeString = "System.String";
                    xmlKey = urtKey;
                }
                else if (String.Compare(pr.PRprimitiveArrayTypeString, "anyType", false, CultureInfo.InvariantCulture) == 0 || String.Compare(pr.PRprimitiveArrayTypeString, "ur-type", false, CultureInfo.InvariantCulture) == 0)
                {
                    pr.PRprimitiveArrayTypeString = "System.Object";
                    xmlKey = urtKey;
                }
            }

            int beginIndex = firstIndex;
            int endIndex = pr.PRkeyDt.IndexOf(']', beginIndex+1);
            if (endIndex < 1)
                throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_ArrayDimensions"),pr.PRkeyDt));

            int outRank = 0;
            int[] outDimensions = null;
            String outDimSignature = null;
            InternalArrayTypeE outArrayTypeEnum = InternalArrayTypeE.Empty;
            int numBrackets = 0;

            StringBuilder elementSig = new StringBuilder(10);

            while (true)
            {
                numBrackets++;
                outDimensions = ParseArrayDimensions(pr.PRkeyDt.Substring(beginIndex, endIndex-beginIndex+1), out outRank, out outDimSignature, out outArrayTypeEnum);
                if (endIndex+1 == pr.PRkeyDt.Length)
                    break;
                elementSig.Append(outDimSignature); // Don't want last dimension in element sig
                beginIndex = endIndex+1;
                endIndex = pr.PRkeyDt.IndexOf(']', beginIndex);
            }

            pr.PRlengthA = outDimensions;
            pr.PRrank = outRank;


            if (numBrackets == 1)
            {
                pr.PRarrayElementTypeCode = primitiveArrayTypeCode;
                pr.PRarrayTypeEnum = outArrayTypeEnum;
                pr.PRarrayElementTypeString = pr.PRprimitiveArrayTypeString;            
            }
            else
            {
                pr.PRarrayElementTypeCode = InternalPrimitiveTypeE.Invalid;
                pr.PRarrayTypeEnum = InternalArrayTypeE.Rectangular;            
                pr.PRarrayElementTypeString = pr.PRprimitiveArrayTypeString+elementSig.ToString();

            }

            InternalST.Soap( this, "ProcessArray GetType ",pr.PRarrayElementType);
            if (!IsInterop || numBrackets > 1)
            {
                pr.PRarrayElementType = ProcessGetType(pr.PRarrayElementTypeString, xmlKey, out pr.PRassemblyName);
                if (pr.PRarrayElementType == null)
                    throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_ArrayType"),pr.PRarrayElementType));

                if ((pr.PRarrayElementType == SoapUtil.typeofObject))
                {
                    pr.PRisArrayVariant = true;
                    xmlKey = urtKey;
                }
            }

            InternalST.Soap( this, "ProcessArray Exit");
        }
 private void ParseSerializedStreamHeader(ParseRecord pr)
 {
     this.stack.Push(pr);
 }
Exemple #17
0
 private void PutPr(ParseRecord pr)
 {
     prPool.Push(pr);
 }
 private void ParseString(ParseRecord pr, ParseRecord parentPr)
 {
     if (pr.PRvalue == null)
     {
         pr.PRvalue = "";
     }
     if (!pr.PRisRegistered && (pr.PRobjectId > 0L))
     {
         this.RegisterObject(pr.PRvalue, pr, parentPr);
     }
 }
Exemple #19
0
        private static String SerTraceString(String handler, ParseRecord pr, String value, String prefix, String urn, InternalParseStateE currentState, HeaderStateEnum headerState)
        {
            String valueString = "";
            if (value != null)
                valueString = value;

            String prString = "";
            if (pr != null)
                prString = ((Enum)pr.PRparseStateEnum).ToString();

            return handler+" - name "+valueString+", prefix "+prefix+", urn "+urn+", CuurentState "+((Enum)currentState).ToString()+", HeaderState "+((Enum)headerState).ToString()+", PushState "+prString;        
        }
 internal object Deserialize(HeaderHandler handler, ISerParser serParser)
 {
     if (serParser == null)
     {
         throw new ArgumentNullException("serParser", string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("ArgumentNull_WithParamName"), new object[] { serParser }));
     }
     this.deserializationSecurityException = null;
     try
     {
         serializationPermission.Demand();
     }
     catch (Exception exception)
     {
         this.deserializationSecurityException = exception;
     }
     this.handler = handler;
     this.isTopObjectSecondPass = false;
     this.isHeaderHandlerCalled = false;
     if (handler != null)
     {
         this.IsFakeTopObject = true;
     }
     this.m_idGenerator = new ObjectIDGenerator();
     this.m_objectManager = this.GetObjectManager();
     this.serObjectInfoInit = new SerObjectInfoInit();
     this.objectIdTable.Clear();
     this.objectIds = 0L;
     serParser.Run();
     if (handler != null)
     {
         this.m_objectManager.DoFixups();
         if (this.handlerObject == null)
         {
             this.handlerObject = handler(this.newheaders);
         }
         if ((this.soapFaultId > 0L) && (this.handlerObject != null))
         {
             this.topStack = new SerStack("Top ParseRecords");
             ParseRecord record = new ParseRecord {
                 PRparseTypeEnum = InternalParseTypeE.Object,
                 PRobjectPositionEnum = InternalObjectPositionE.Top,
                 PRparseStateEnum = InternalParseStateE.Object,
                 PRname = "Response"
             };
             this.topStack.Push(record);
             record = new ParseRecord {
                 PRparseTypeEnum = InternalParseTypeE.Member,
                 PRobjectPositionEnum = InternalObjectPositionE.Child,
                 PRmemberTypeEnum = InternalMemberTypeE.Field,
                 PRmemberValueEnum = InternalMemberValueE.Reference,
                 PRparseStateEnum = InternalParseStateE.Member,
                 PRname = "__fault",
                 PRidRef = this.soapFaultId
             };
             this.topStack.Push(record);
             record = new ParseRecord {
                 PRparseTypeEnum = InternalParseTypeE.ObjectEnd,
                 PRobjectPositionEnum = InternalObjectPositionE.Top,
                 PRparseStateEnum = InternalParseStateE.Object,
                 PRname = "Response"
             };
             this.topStack.Push(record);
             this.isTopObjectResolved = false;
         }
     }
     if (!this.isTopObjectResolved)
     {
         this.isTopObjectSecondPass = true;
         this.topStack.Reverse();
         int num = this.topStack.Count();
         ParseRecord pr = null;
         for (int i = 0; i < num; i++)
         {
             pr = (ParseRecord) this.topStack.Pop();
             this.Parse(pr);
         }
     }
     this.m_objectManager.DoFixups();
     if (this.topObject == null)
     {
         throw new SerializationException(SoapUtil.GetResourceString("Serialization_TopObject"));
     }
     if (this.HasSurrogate(this.topObject.GetType()) && (this.topId != 0L))
     {
         this.topObject = this.m_objectManager.GetObject(this.topId);
     }
     if (this.topObject is IObjectReference)
     {
         this.topObject = ((IObjectReference) this.topObject).GetRealObject(this.m_context);
     }
     this.m_objectManager.RaiseDeserializationEvent();
     if ((this.formatterEnums.FEtopObject != null) && (this.topObject is InternalSoapMessage))
     {
         InternalSoapMessage topObject = (InternalSoapMessage) this.topObject;
         ISoapMessage fEtopObject = this.formatterEnums.FEtopObject;
         fEtopObject.MethodName = topObject.methodName;
         fEtopObject.XmlNameSpace = topObject.xmlNameSpace;
         fEtopObject.ParamNames = topObject.paramNames;
         fEtopObject.ParamValues = topObject.paramValues;
         fEtopObject.Headers = this.headers;
         this.topObject = fEtopObject;
         this.isTopObjectResolved = true;
     }
     return this.topObject;
 }
Exemple #21
0
        // Formats the error message and throws a SerializationException
        private void MarshalError(String handler, ParseRecord pr, String value, InternalParseStateE currentState)
        {
            String traceString = SerTraceString(handler, pr, value, currentState, headerState);

            InternalST.Soap( this,"MarshalError,",traceString);

            throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_Syntax"),traceString));                                                    
        }
        internal void Parse(ParseRecord pr)
        {
            switch (pr.PRparseTypeEnum)
            {
                case InternalParseTypeE.SerializedStreamHeader:
                    this.ParseSerializedStreamHeader(pr);
                    return;

                case InternalParseTypeE.Object:
                    this.ParseObject(pr);
                    return;

                case InternalParseTypeE.Member:
                    this.ParseMember(pr);
                    return;

                case InternalParseTypeE.ObjectEnd:
                    this.ParseObjectEnd(pr);
                    return;

                case InternalParseTypeE.MemberEnd:
                    this.ParseMemberEnd(pr);
                    return;

                case InternalParseTypeE.SerializedStreamHeaderEnd:
                    this.ParseSerializedStreamHeaderEnd(pr);
                    return;

                case InternalParseTypeE.Envelope:
                case InternalParseTypeE.EnvelopeEnd:
                case InternalParseTypeE.Body:
                case InternalParseTypeE.BodyEnd:
                    return;
            }
            throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_XMLElement"), new object[] { pr.PRname }));
        }
Exemple #23
0
        private void ProcessAttributes(ParseRecord pr, ParseRecord objectPr)
        {
            InternalST.Soap( this, "ProcessAttributes Entry ",pr.Trace()," headerState ",((Enum)headerState).ToString());
            String keyPosition = null;
            String keyOffset = null;
            String keyMustUnderstand = null;

            pr.PRisProcessAttributes = true;

            String SoapKeyUrl = "http://schemas.xmlsoap.org/soap/encoding/";
            int SoapKeyUrlLength = SoapKeyUrl.Length;
            String UrtKeyUrl = "http://schemas.microsoft.com/clr/id";
            int UrtKeyUrlLength = UrtKeyUrl.Length;
            String SoapEnvKeyUrl = "http://schemas.xmlsoap.org/soap/envelope/";
            int SoapEnvKeyUrlLength = SoapEnvKeyUrl.Length;
            String XSIKey2001 = "http://www.w3.org/2001/XMLSchema-instance";
            int XSIKey2001Length = XSIKey2001.Length;
            String XSIKey2000 = "http://www.w3.org/2000/10/XMLSchema-instance";
            int XSIKey2000Length = XSIKey2000.Length;
            String XSIKey1999 = "http://www.w3.org/1999/XMLSchema-instance";
            int XSIKey1999Length = XSIKey1999.Length;

            String XSDKey1999 = "http://www.w3.org/1999/XMLSchema";
            int XSDKey1999Length = XSDKey1999.Length;
            String XSDKey2000 = "http://www.w3.org/2000/10/XMLSchema";
            int XSDKey2000Length = XSDKey2000.Length;
            String XSDKey2001 = "http://www.w3.org/2001/XMLSchema";
            int XSDKey2001Length = XSDKey2001.Length;
            String clrNS = "http://schemas.microsoft.com/soap/encoding/clr/1.0";
            int clrNSLength = clrNS.Length;

            for (int i = 0; i<attributeValues.Count(); i++)
            {
                AttributeValueEntry attributeValueEntry = (AttributeValueEntry)attributeValues.GetItem(i);
                String prefix = attributeValueEntry.prefix;
                String key = attributeValueEntry.key;
                if ((key == null) || (key.Length == 0))
                    key = pr.PRnameXmlKey; //case where there is a default key
                String value = attributeValueEntry.value;
                bool prefixMatchesXmlns = false;
                String urn = attributeValueEntry.urn;
                InternalST.Soap( this, "ProcessAttributes attribute prefix ",prefix," key ",key," value ",value," urn ", urn);

                int keyLength = key.Length;
                int valueLength = value.Length;
                // table need for QName xsd types
                if (key == null || keyLength == 0)
                    keyToNamespaceTable[prefix] = value;
                else
                    keyToNamespaceTable[prefix+":"+key] = value;

                if (keyLength == 2 && String.Compare(key, "id", true, CultureInfo.InvariantCulture) == 0)
                    pr.PRobjectId = objectReader.GetId(value);
                else if (keyLength == 8 && String.Compare(key, "position", true, CultureInfo.InvariantCulture) == 0)
                    keyPosition = value;
                else if (keyLength == 6 && String.Compare(key, "offset", true, CultureInfo.InvariantCulture) == 0)
                    keyOffset = value;
                else if (keyLength == 14 && String.Compare(key, "MustUnderstand", true, CultureInfo.InvariantCulture) == 0)
                    keyMustUnderstand = value;
                else if (keyLength == 4 && String.Compare(key, "null", true, CultureInfo.InvariantCulture) == 0)
                {
                    pr.PRmemberValueEnum = InternalMemberValueE.Null;
                    pr.PRvalue = null;
                }
                else if (keyLength == 4 && String.Compare(key, "root", true, CultureInfo.InvariantCulture) == 0)
                {
                    if (value.Equals("1"))
                        pr.PRisHeaderRoot = true;
                }
                else if (keyLength == 4 && String.Compare(key, "href", true, CultureInfo.InvariantCulture) == 0)
                    pr.PRidRef = objectReader.GetId(value);
                else if (keyLength == 4 && String.Compare(key, "type", true, CultureInfo.InvariantCulture) == 0)
                {
                    String currentPRtypeXmlKey = pr.PRtypeXmlKey;
                    String currentPRkeyDt = pr.PRkeyDt;
                    Type currentPRdtType = pr.PRdtType;

                    String typeValue = value;
                    int index = value.IndexOf(":");
                    if (index > 0)
                    {
                        pr.PRtypeXmlKey = value.Substring(0, index);
                        typeValue = value.Substring(++index);
                    }
                    else
                    {
                        pr.PRtypeXmlKey = prefix;                       
                    }

                    if (String.Compare(typeValue, "anyType", true, CultureInfo.InvariantCulture) == 0 || String.Compare(typeValue, "ur-type", true, CultureInfo.InvariantCulture) == 0)
                    {
                        pr.PRkeyDt = "System.Object";
                        pr.PRdtType = SoapUtil.typeofObject;
                        pr.PRtypeXmlKey = urtKey;
                    }

                    if (pr.PRtypeXmlKey == soapKey && typeValue == "Array") //Don't need to process xsi:type="SOAP-ENC:Array"
                    {
                        // Array values already found,use these value rather then the xsi:type values
                        pr.PRtypeXmlKey = currentPRtypeXmlKey;
                        pr.PRkeyDt = currentPRkeyDt;
                        pr.PRdtType = currentPRdtType;
                        InternalST.Soap( this,"ProcessAttributes, xsi:type='SOAP-ENC:Array' pr.PRtypeXmlKey ", pr.PRtypeXmlKey," pr.PRkeyDt "+pr.PRkeyDt);
                    }
                    else
                    {
                        pr.PRkeyDt = typeValue;
                        InternalST.Soap( this,"ProcessAttributes, not  xsi:type='SOAP-ENC:Array' pr.PRtypeXmlKey ", pr.PRtypeXmlKey," pr.PRkeyDt "+pr.PRkeyDt);
                    }
                }
                else if (keyLength == 9 && String.Compare(key, "arraytype", true, CultureInfo.InvariantCulture) == 0)
                {
                    String typeValue = value;
                    int index = value.IndexOf(":");
                    if (index > 0)
                    {
                        pr.PRtypeXmlKey = value.Substring(0, index);
                        pr.PRkeyDt = typeValue = value.Substring(++index);
                    }

                    if (typeValue.StartsWith("ur_type["))
                    {
                        pr.PRkeyDt = "System.Object"+typeValue.Substring(6);
                        pr.PRtypeXmlKey = urtKey;
                    }
                }
                else if (SoapServices.IsClrTypeNamespace(value))
                {
                    if (!assemKeyToAssemblyTable.ContainsKey(key))
                    {
                        String typeNamespace = null;
                        String assemblyName = null;
                        SoapServices.DecodeXmlNamespaceForClrTypeNamespace(value, out typeNamespace, out assemblyName);
                        if (assemblyName == null)
                        {
                            assemKeyToAssemblyTable[key] = new SoapAssemblyInfo(SoapUtil.urtAssemblyString, SoapUtil.urtAssembly);
                            assemKeyToNameSpaceTable[key] = typeNamespace;
                        }
                        else
                        {
                            assemKeyToAssemblyTable[key] = new SoapAssemblyInfo(assemblyName);
                            if (typeNamespace != null)
                                assemKeyToNameSpaceTable[key] = typeNamespace;
                        }

                    }
                }
                else if ((prefixMatchesXmlns = prefix.Equals("xmlns")) && (valueLength == SoapKeyUrlLength && String.Compare(value, SoapKeyUrl, true, CultureInfo.InvariantCulture) == 0))
                {
                    soapKey = key;
                }
                else if (prefixMatchesXmlns && (valueLength == UrtKeyUrlLength && String.Compare(value, UrtKeyUrl, true, CultureInfo.InvariantCulture) == 0))
                {
                    urtKey = key;
                    assemKeyToAssemblyTable[urtKey] = new SoapAssemblyInfo(SoapUtil.urtAssemblyString, SoapUtil.urtAssembly);
                }
                else if (prefixMatchesXmlns && (valueLength == SoapEnvKeyUrlLength && String.Compare(value, SoapEnvKeyUrl, true) == 0))
                {
                    soapEnvKey = key;
                }
                else if (key == "encodingStyle")
                {
                    /*
                    String[] split = value.Split(' ');
                    foreach (String s in split)
                    {
                        if (s == "http://schemas.microsoft.com/soap/encoding/clr/1.0")
                        {
                            objectReader.SetVersion(1,0);
                            break;
                        }
                    }
                    */
                }
                else if (prefixMatchesXmlns && 
                         ((valueLength == XSIKey2001Length && String.Compare(value, XSIKey2001,true, CultureInfo.InvariantCulture) == 0) ||
                          (valueLength == XSIKey1999Length && String.Compare(value, XSIKey1999,true, CultureInfo.InvariantCulture) == 0) ||
                          (valueLength == XSIKey2000Length && String.Compare(value, XSIKey2000,true, CultureInfo.InvariantCulture) == 0)))
                {
                    xsiKey = key;
                }
                else if (prefixMatchesXmlns && 
                         ((valueLength == XSDKey2001Length && String.Compare(value, XSDKey2001 , true, CultureInfo.InvariantCulture) == 0)) ||
                         (valueLength == XSDKey1999Length && String.Compare(value, XSDKey1999, true, CultureInfo.InvariantCulture) == 0) ||
                         (valueLength == XSDKey2000Length && String.Compare(value, XSDKey2000, true, CultureInfo.InvariantCulture) == 0))
                {
                    xsdKey = key;
                }
                else if (prefixMatchesXmlns && (valueLength == clrNSLength && String.Compare(value, clrNS, true, CultureInfo.InvariantCulture) == 0))
                {
                    objectReader.SetVersion(1,0);
                }
                else
                {
                    //String lowerCaseValue = value.ToLower(CultureInfo.InvariantCulture);
                    if (prefixMatchesXmlns)
                    {
                        // Assume it is an interop namespace
                        assemKeyToInteropAssemblyTable[key] = value;                        
                        InternalST.Soap( this,"ProcessAttributes, InteropType key "+key+" value ",value);
                    }
                    else if (String.Compare(prefix, soapKey, true, CultureInfo.InvariantCulture) == 0)
                    {
                        InternalST.Soap( this,"ProcessAttributes, Not processed key ",prefix,":",key," = ",value);                  
                    }
                    else
                    {
                        // See if it is a XmlAttribute
                        InternalST.Soap( this,"ProcessAttributes, XmlAttribute prefix ",prefix," key ",key," value ",value," urn ",urn, " hashtable ",assemKeyToInteropAssemblyTable[prefix]);

                        if ((assemKeyToInteropAssemblyTable.ContainsKey(prefix)) && ((String)assemKeyToInteropAssemblyTable[prefix]).Equals(urn))
                        {
                            ProcessXmlAttribute(prefix, key, value, objectPr);
                        }
                        else
                        {
                            InternalST.Soap( this,"ProcessAttributes, Not processed prefix ",prefix," key ",key," value ",value," urn ",urn);
                        }
                    }
                }
            }

            attributeValues.Clear();

            // reset the header state
            // If no headers then headerState is None
            //
            // if parent is a header section then these are top level objects
            // within the header section. If the object has a root set
            // then it is a header record, if not then it is a toplevel object
            // in the header section which is not a header record.
            //
            // if the parent is not a header section and is a header root
            // then this is a nested object within a header record. All
            // subsequent object will be nested until another header
            // root is encountered
            //
            // The first header record is considered a root record
            if (headerState != HeaderStateEnum.None)
            {
                if (objectPr.PRparseTypeEnum == InternalParseTypeE.Headers)
                {
                    if (pr.PRisHeaderRoot || (headerState == HeaderStateEnum.FirstHeaderRecord))
                    {
                        headerState = HeaderStateEnum.HeaderRecord;
                    }
                    else
                    {
                        headerState = HeaderStateEnum.TopLevelObject;
                        currentState = InternalParseStateE.Object;
                        pr.PRobjectTypeEnum = InternalObjectTypeE.Object;
                        pr.PRparseTypeEnum = InternalParseTypeE.Object;
                        pr.PRparseStateEnum = InternalParseStateE.Object;
                        pr.PRmemberTypeEnum = InternalMemberTypeE.Empty;
                        pr.PRmemberValueEnum = InternalMemberValueE.Empty;
                    }
                }
                else if (objectPr.PRisHeaderRoot)
                    headerState = HeaderStateEnum.NestedObject;
            }

            InternalST.Soap( this,"ProcessAttributes, headerState ",((Enum)headerState).ToString());


            if (!isTopFound && (objectPr != null ) && (objectPr.PRparseTypeEnum == InternalParseTypeE.Body))
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
                isTopFound = true;
            }
            else if (pr.PRobjectPositionEnum != InternalObjectPositionE.Top)
                pr.PRobjectPositionEnum = InternalObjectPositionE.Child;


            // Don't process type for envelop, topSoapElement unless it has a key of soapEnvKey (SOAP-ENV). Fault
            // is the only top record which currently falls into this category.
            if (!((pr.PRparseTypeEnum == InternalParseTypeE.Envelope)||
                  (pr.PRparseTypeEnum == InternalParseTypeE.Body) ||
                  (pr.PRparseTypeEnum == InternalParseTypeE.Headers) ||
                  (pr.PRobjectPositionEnum == InternalObjectPositionE.Top &&
                   objectReader.IsFakeTopObject &&
                   !pr.PRnameXmlKey.Equals(soapEnvKey))))
            {
                InternalST.Soap( this, "ProcessAttributes  before Process Type ",((Enum)pr.PRparseTypeEnum).ToString());
                ProcessType(pr, objectPr);
            }

            if (keyPosition != null)
            {
                int outRank;
                String outDimSignature;
                InternalArrayTypeE outArrayTypeEnum;
                pr.PRpositionA = ParseArrayDimensions(keyPosition, out outRank, out outDimSignature, out outArrayTypeEnum);
            }

            if (keyOffset != null)
            {
                int outRank;
                String outDimSignature;
                InternalArrayTypeE outArrayTypeEnum;
                pr.PRlowerBoundA = ParseArrayDimensions(keyOffset, out outRank, out outDimSignature, out outArrayTypeEnum);
            }

            if (keyMustUnderstand != null)
                if (keyMustUnderstand.Equals("1"))
                    pr.PRisMustUnderstand = true;
                else if (keyMustUnderstand.Equals("0"))
                    pr.PRisMustUnderstand = false;
                else
                    throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_MustUnderstand"),keyMustUnderstand));

            if (pr.PRparseTypeEnum == InternalParseTypeE.Member)
            {
                //  Process Member			

                InternalST.Soap( this, "ProcessAttributes  Member ");
                stack.Dump();

                if (objectPr.PRparseTypeEnum == InternalParseTypeE.Headers)
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Header;
                else if (objectPr.PRobjectTypeEnum == InternalObjectTypeE.Array)
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Item;
                else
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Field;
            }
        }
 private void ParseArrayMember(ParseRecord pr)
 {
     ParseRecord record = (ParseRecord) this.stack.Peek();
     if (record.PRarrayTypeEnum == InternalArrayTypeE.Rectangular)
     {
         if (pr.PRpositionA != null)
         {
             Array.Copy(pr.PRpositionA, record.PRindexMap, record.PRindexMap.Length);
             if (record.PRlowerBoundA == null)
             {
                 Array.Copy(pr.PRpositionA, record.PRrectangularMap, record.PRrectangularMap.Length);
             }
             else
             {
                 for (int i = 0; i < record.PRrectangularMap.Length; i++)
                 {
                     record.PRrectangularMap[i] = pr.PRpositionA[i] - record.PRlowerBoundA[i];
                 }
             }
         }
         else
         {
             if (record.PRmemberIndex > 0)
             {
                 this.NextRectangleMap(record);
             }
             for (int j = 0; j < record.PRrank; j++)
             {
                 int num3 = 0;
                 if (record.PRlowerBoundA != null)
                 {
                     num3 = record.PRlowerBoundA[j];
                 }
                 record.PRindexMap[j] = record.PRrectangularMap[j] + num3;
             }
         }
     }
     else if (!record.PRisLowerBound)
     {
         if (pr.PRpositionA == null)
         {
             record.PRindexMap[0] = record.PRmemberIndex;
         }
         else
         {
             record.PRindexMap[0] = record.PRmemberIndex = pr.PRpositionA[0];
         }
     }
     else if (pr.PRpositionA == null)
     {
         record.PRindexMap[0] = record.PRmemberIndex + record.PRlowerBoundA[0];
     }
     else
     {
         record.PRindexMap[0] = pr.PRpositionA[0];
         record.PRmemberIndex = pr.PRpositionA[0] - record.PRlowerBoundA[0];
     }
     if (pr.PRmemberValueEnum == InternalMemberValueE.Reference)
     {
         object obj2 = this.m_objectManager.GetObject(pr.PRidRef);
         if (obj2 == null)
         {
             int[] destinationArray = new int[record.PRrank];
             Array.Copy(record.PRindexMap, 0, destinationArray, 0, record.PRrank);
             this.m_objectManager.RecordArrayElementFixup(record.PRobjectId, destinationArray, pr.PRidRef);
         }
         else if (record.PRobjectA != null)
         {
             record.PRobjectA[record.PRindexMap[0]] = obj2;
         }
         else
         {
             ((Array) record.PRnewObj).SetValue(obj2, record.PRindexMap);
         }
     }
     else if (pr.PRmemberValueEnum == InternalMemberValueE.Nested)
     {
         if (pr.PRdtType == null)
         {
             pr.PRdtType = record.PRarrayElementType;
         }
         this.ParseObject(pr);
         this.stack.Push(pr);
         if (record.PRarrayElementType.IsValueType && (pr.PRarrayElementTypeCode == InternalPrimitiveTypeE.Invalid))
         {
             pr.PRisValueTypeFixup = true;
             this.valueFixupStack.Push(new ValueFixup((Array) record.PRnewObj, record.PRindexMap));
         }
         else if (record.PRobjectA != null)
         {
             record.PRobjectA[record.PRindexMap[0]] = pr.PRnewObj;
         }
         else
         {
             ((Array) record.PRnewObj).SetValue(pr.PRnewObj, record.PRindexMap);
         }
     }
     else if (pr.PRmemberValueEnum == InternalMemberValueE.InlineValue)
     {
         if (record.PRarrayElementType == Converter.typeofString)
         {
             this.ParseString(pr, record);
             if (record.PRobjectA != null)
             {
                 record.PRobjectA[record.PRindexMap[0]] = pr.PRvalue;
             }
             else
             {
                 ((Array) record.PRnewObj).SetValue(pr.PRvalue, record.PRindexMap);
             }
         }
         else if (record.PRisEnum)
         {
             object obj3 = Enum.Parse(record.PRarrayElementType, pr.PRvalue);
             if (record.PRobjectA != null)
             {
                 record.PRobjectA[record.PRindexMap[0]] = (Enum) obj3;
             }
             else
             {
                 ((Array) record.PRnewObj).SetValue((Enum) obj3, record.PRindexMap);
             }
         }
         else if (record.PRisArrayVariant)
         {
             if ((pr.PRdtType == null) && (pr.PRkeyDt == null))
             {
                 throw new SerializationException(SoapUtil.GetResourceString("Serialization_ArrayTypeObject"));
             }
             object pRvalue = null;
             if (pr.PRdtType == Converter.typeofString)
             {
                 this.ParseString(pr, record);
                 pRvalue = pr.PRvalue;
             }
             else if (pr.PRdtType.IsEnum)
             {
                 pRvalue = Enum.Parse(pr.PRdtType, pr.PRvalue);
             }
             else if (pr.PRdtTypeCode == InternalPrimitiveTypeE.Invalid)
             {
                 this.CheckSerializable(pr.PRdtType);
                 if (this.IsRemoting && (this.formatterEnums.FEsecurityLevel != TypeFilterLevel.Full))
                 {
                     pRvalue = FormatterServices.GetSafeUninitializedObject(pr.PRdtType);
                 }
                 else
                 {
                     pRvalue = FormatterServices.GetUninitializedObject(pr.PRdtType);
                 }
             }
             else if (pr.PRvarValue != null)
             {
                 pRvalue = pr.PRvarValue;
             }
             else
             {
                 pRvalue = Converter.FromString(pr.PRvalue, pr.PRdtTypeCode);
             }
             if (record.PRobjectA != null)
             {
                 record.PRobjectA[record.PRindexMap[0]] = pRvalue;
             }
             else
             {
                 ((Array) record.PRnewObj).SetValue(pRvalue, record.PRindexMap);
             }
         }
         else if (record.PRprimitiveArray != null)
         {
             record.PRprimitiveArray.SetValue(pr.PRvalue, record.PRindexMap[0]);
         }
         else
         {
             object pRvarValue = null;
             if (pr.PRvarValue != null)
             {
                 pRvarValue = pr.PRvarValue;
             }
             else
             {
                 pRvarValue = Converter.FromString(pr.PRvalue, record.PRarrayElementTypeCode);
             }
             if (record.PRarrayElementTypeCode == InternalPrimitiveTypeE.QName)
             {
                 SoapQName name = (SoapQName) pRvarValue;
                 if (name.Key.Length == 0)
                 {
                     name.Namespace = (string) this.soapHandler.keyToNamespaceTable["xmlns"];
                 }
                 else
                 {
                     name.Namespace = (string) this.soapHandler.keyToNamespaceTable["xmlns:" + name.Key];
                 }
             }
             if (record.PRobjectA != null)
             {
                 record.PRobjectA[record.PRindexMap[0]] = pRvarValue;
             }
             else
             {
                 ((Array) record.PRnewObj).SetValue(pRvarValue, record.PRindexMap);
             }
         }
     }
     else if (pr.PRmemberValueEnum != InternalMemberValueE.Null)
     {
         this.ParseError(pr, record);
     }
     record.PRmemberIndex++;
 }
Exemple #25
0
		internal ParseRecord Copy()
		{

			ParseRecord newPr = new ParseRecord();
			// Enums
			newPr.PRparseTypeEnum = PRparseTypeEnum;
			newPr.PRobjectTypeEnum = PRobjectTypeEnum;
			newPr.PRarrayTypeEnum = PRarrayTypeEnum;
			newPr.PRmemberTypeEnum = PRmemberTypeEnum;
			newPr.PRmemberValueEnum = PRmemberValueEnum;
			newPr.PRobjectPositionEnum = PRobjectPositionEnum;

			// Object
			newPr.PRname = PRname;
			newPr.PRisParsed = PRisParsed;			
            newPr.PRisProcessAttributes = PRisProcessAttributes;
			newPr.PRnameXmlKey = PRnameXmlKey;
			newPr.PRxmlNameSpace = PRxmlNameSpace;			

			// Value
			newPr.PRvalue = PRvalue;


			// dt attribute
			newPr.PRkeyDt = PRkeyDt;
			newPr.PRdtType = PRdtType;
            newPr.PRassemblyName = PRassemblyName;
			newPr.PRdtTypeCode = PRdtTypeCode;
			newPr.PRisEnum = PRisEnum;			

			// Object ID
			newPr.PRobjectId = PRobjectId;

			// Reference ID
			newPr.PRidRef = PRidRef;

			// Array

			// Array Element Type
			newPr.PRarrayElementTypeString = PRarrayElementTypeString;
			newPr.PRarrayElementType = PRarrayElementType;
			newPr.PRisArrayVariant = PRisArrayVariant;
			newPr.PRarrayElementTypeCode = PRarrayElementTypeCode;


			// Array Primitive Element type
			newPr.PRprimitiveArrayTypeString = PRprimitiveArrayTypeString;

			// Parsed array information
			newPr.PRrank = PRrank;
			newPr.PRlengthA = PRlengthA;
			newPr.PRpositionA = PRpositionA;
			newPr.PRlowerBoundA = PRlowerBoundA;
			newPr.PRupperBoundA = PRupperBoundA;		

			// Array map for placing array elements in array
			newPr.PRindexMap = PRindexMap;
			newPr.PRmemberIndex = PRmemberIndex;
			newPr.PRlinearlength = PRlinearlength;
			newPr.PRrectangularMap = PRrectangularMap;
			newPr.PRisLowerBound = PRisLowerBound;

			// SerializedStreamHeader information
			newPr.PRtopId = PRtopId;
			newPr.PRheaderId = PRheaderId;
			newPr.PRisHeaderRoot = PRisHeaderRoot;
			newPr.PRisAttributesProcessed = PRisAttributesProcessed;

			// Parsed HeaderMember Information
			newPr.PRisMustUnderstand = PRisMustUnderstand;

			// Parse State
			newPr.PRparseStateEnum = PRparseStateEnum;
			newPr.PRisWaitingForNestedObject = PRisWaitingForNestedObject;


			// ValueType Fixup needed
			newPr.PRisValueTypeFixup = PRisValueTypeFixup;

			newPr.PRnewObj = PRnewObj;
			newPr.PRobjectA = PRobjectA;
			newPr.PRprimitiveArray = PRprimitiveArray;
			newPr.PRobjectInfo = PRobjectInfo;
			newPr.PRisRegistered = PRisRegistered;
			newPr.PRisXmlAttribute = PRisXmlAttribute;

			return newPr;
		}		
 private void ParseError(ParseRecord processing, ParseRecord onStack)
 {
     throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_ParseError"), new object[] { onStack.PRname + " " + onStack.PRparseTypeEnum.ToString() + " " + processing.PRname + " " + processing.PRparseTypeEnum.ToString() }));
 }
Exemple #27
0
		internal virtual void Fixup(ParseRecord record, ParseRecord parent)
		{
            Object obj = record.PRnewObj;
			InternalST.Soap(this, "Fixup ",obj," ",((Enum)valueFixupEnum).ToString());

			switch(valueFixupEnum)
			{
				case ValueFixupEnum.Array:
					arrayObj.SetValue(obj, indexMap);
					break;
				case ValueFixupEnum.Header:
					Type type = typeof(Header);
					if (valueInfo == null)
					{
						MemberInfo[] valueInfos = type.GetMember("Value");
						if (valueInfos.Length != 1)
							throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_HeaderReflection"),valueInfos.Length));																				
						valueInfo = valueInfos[0];
					}
					InternalST.SerializationSetValue((FieldInfo)valueInfo, header, obj);
					break;
				case ValueFixupEnum.Member:

					InternalST.Soap(this, "Fixup Member new object value ",obj," memberObject ",memberObject);

                    if (objectInfo.isSi) {
                        InternalST.Soap(this, "Recording a fixup on member: ", memberName, 
                                     " in object id", parent.PRobjectId, " Required Object ", record.PRobjectId);
                        objectInfo.objectManager.RecordDelayedFixup(parent.PRobjectId, memberName, record.PRobjectId);
                    } else {
                        MemberInfo memberInfo = objectInfo.GetMemberInfo(memberName);
                        InternalST.Soap(this, "Recording a fixup on member:", memberInfo, " in object id ", 
                                     parent.PRobjectId," Required Object", record.PRobjectId);
                        objectInfo.objectManager.RecordFixup(parent.PRobjectId, memberInfo, record.PRobjectId);
                    }
					break;
			}
		}
 private void CheckSecurity(ParseRecord pr)
 {
     Type pRdtType = pr.PRdtType;
     if ((pRdtType != null) && this.IsRemoting)
     {
         if (typeof(MarshalByRefObject).IsAssignableFrom(pRdtType))
         {
             throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_MBRAsMBV"), new object[] { pRdtType.FullName }));
         }
         FormatterServices.CheckTypeSecurity(pRdtType, this.formatterEnums.FEsecurityLevel);
     }
     if (this.deserializationSecurityException != null)
     {
         if (pRdtType != null)
         {
             if (pRdtType.IsPrimitive || (pRdtType == Converter.typeofString))
             {
                 return;
             }
             if (typeof(Enum).IsAssignableFrom(pRdtType))
             {
                 return;
             }
             if (pRdtType.IsArray)
             {
                 Type elementType = pRdtType.GetElementType();
                 if (elementType.IsPrimitive || (elementType == Converter.typeofString))
                 {
                     return;
                 }
             }
         }
         throw this.deserializationSecurityException;
     }
 }
 private void ParseObject(ParseRecord pr)
 {
     if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
     {
         this.topId = pr.PRobjectId;
     }
     if (pr.PRparseTypeEnum == InternalParseTypeE.Object)
     {
         this.stack.Push(pr);
     }
     if (pr.PRobjectTypeEnum == InternalObjectTypeE.Array)
     {
         this.ParseArray(pr);
     }
     else
     {
         if ((pr.PRdtType == null) && !this.IsFakeTopObject)
         {
             throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_TopObjectInstantiate"), new object[] { pr.PRname }));
         }
         if (((pr.PRobjectPositionEnum == InternalObjectPositionE.Top) && this.IsFakeTopObject) && (pr.PRdtType != Converter.typeofSoapFault))
         {
             if (this.handler == null)
             {
                 if (this.formatterEnums.FEtopObject != null)
                 {
                     if (!this.isTopObjectSecondPass)
                     {
                         this.isTopObjectResolved = false;
                         this.topStack = new SerStack("Top ParseRecords");
                         this.topStack.Push(pr.Copy());
                         return;
                     }
                     pr.PRnewObj = new InternalSoapMessage();
                     pr.PRdtType = typeof(InternalSoapMessage);
                     this.CheckSecurity(pr);
                     if (this.formatterEnums.FEtopObject != null)
                     {
                         ISoapMessage fEtopObject = this.formatterEnums.FEtopObject;
                         pr.PRobjectInfo = this.CreateReadObjectInfo(pr.PRdtType, fEtopObject.ParamNames, fEtopObject.ParamTypes, pr.PRassemblyName);
                     }
                 }
             }
             else
             {
                 if (!this.isHeaderHandlerCalled)
                 {
                     this.newheaders = null;
                     this.isHeaderHandlerCalled = true;
                     if (this.headers == null)
                     {
                         this.newheaders = new Header[1];
                     }
                     else
                     {
                         this.newheaders = new Header[this.headers.Length + 1];
                         Array.Copy(this.headers, 0, this.newheaders, 1, this.headers.Length);
                     }
                     Header header = new Header("__methodName", pr.PRname, false, pr.PRnameXmlKey);
                     this.newheaders[0] = header;
                     this.handlerObject = this.handler(this.newheaders);
                 }
                 if (!this.isHeaderHandlerCalled)
                 {
                     this.isTopObjectResolved = false;
                     this.topStack = new SerStack("Top ParseRecords");
                     this.topStack.Push(pr.Copy());
                     return;
                 }
                 pr.PRnewObj = this.handlerObject;
                 pr.PRdtType = this.handlerObject.GetType();
                 this.CheckSecurity(pr);
                 if (pr.PRnewObj is IFieldInfo)
                 {
                     IFieldInfo pRnewObj = (IFieldInfo) pr.PRnewObj;
                     if ((pRnewObj.FieldTypes != null) && (pRnewObj.FieldTypes.Length > 0))
                     {
                         pr.PRobjectInfo = this.CreateReadObjectInfo(pr.PRdtType, pRnewObj.FieldNames, pRnewObj.FieldTypes, pr.PRassemblyName);
                     }
                 }
             }
         }
         else
         {
             if (pr.PRdtType == Converter.typeofString)
             {
                 if (pr.PRvalue != null)
                 {
                     pr.PRnewObj = pr.PRvalue;
                     if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
                     {
                         this.isTopObjectResolved = true;
                         this.topObject = pr.PRnewObj;
                         return;
                     }
                     this.stack.Pop();
                     this.RegisterObject(pr.PRnewObj, pr, (ParseRecord) this.stack.Peek());
                 }
                 return;
             }
             if (pr.PRdtType == null)
             {
                 ParseRecord record = (ParseRecord) this.stack.Peek();
                 if (record.PRdtType == Converter.typeofSoapFault)
                 {
                     throw new ServerException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_SoapFault"), new object[] { this.faultString }));
                 }
                 throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_TypeElement"), new object[] { pr.PRname }));
             }
             this.CheckSerializable(pr.PRdtType);
             if (this.IsRemoting && (this.formatterEnums.FEsecurityLevel != TypeFilterLevel.Full))
             {
                 pr.PRnewObj = FormatterServices.GetSafeUninitializedObject(pr.PRdtType);
             }
             else
             {
                 pr.PRnewObj = FormatterServices.GetUninitializedObject(pr.PRdtType);
             }
             this.CheckSecurity(pr);
             this.m_objectManager.RaiseOnDeserializingEvent(pr.PRnewObj);
         }
         if (pr.PRnewObj == null)
         {
             throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_TopObjectInstantiate"), new object[] { pr.PRdtType }));
         }
         if (pr.PRobjectId < 1L)
         {
             pr.PRobjectId = this.GetId("GenId-" + this.objectIds);
         }
         if (this.IsFakeTopObject && (pr.PRobjectPositionEnum == InternalObjectPositionE.Top))
         {
             this.isTopObjectResolved = true;
             this.topObject = pr.PRnewObj;
         }
         if (pr.PRobjectInfo == null)
         {
             pr.PRobjectInfo = this.CreateReadObjectInfo(pr.PRdtType, pr.PRassemblyName);
         }
         pr.PRobjectInfo.obj = pr.PRnewObj;
         if (this.IsFakeTopObject && (pr.PRobjectPositionEnum == InternalObjectPositionE.Top))
         {
             pr.PRobjectInfo.AddValue("__methodName", pr.PRname);
             pr.PRobjectInfo.AddValue("__keyToNamespaceTable", this.soapHandler.keyToNamespaceTable);
             pr.PRobjectInfo.AddValue("__paramNameList", pr.PRobjectInfo.SetFakeObject());
             if (this.formatterEnums.FEtopObject != null)
             {
                 pr.PRobjectInfo.AddValue("__xmlNameSpace", pr.PRxmlNameSpace);
             }
         }
     }
 }
 private void ParseObjectEnd(ParseRecord pr)
 {
     ParseRecord record = (ParseRecord) this.stack.Peek();
     if (record == null)
     {
         record = pr;
     }
     if (record.PRobjectPositionEnum == InternalObjectPositionE.Top)
     {
         if (record.PRdtType == Converter.typeofString)
         {
             if (record.PRvalue == null)
             {
                 record.PRvalue = string.Empty;
             }
             record.PRnewObj = record.PRvalue;
             this.CheckSecurity(record);
             this.isTopObjectResolved = true;
             this.topObject = record.PRnewObj;
             return;
         }
         if ((((record.PRdtType != null) && (record.PRvalue != null)) && !this.IsWhiteSpace(record.PRvalue)) && (record.PRdtType.IsPrimitive || (record.PRdtType == Converter.typeofTimeSpan)))
         {
             record.PRnewObj = Converter.FromString(record.PRvalue, Converter.ToCode(record.PRdtType));
             this.CheckSecurity(record);
             this.isTopObjectResolved = true;
             this.topObject = record.PRnewObj;
             return;
         }
         if (!this.isTopObjectResolved && (record.PRdtType != Converter.typeofSoapFault))
         {
             this.topStack.Push(pr.Copy());
             if (record.PRparseRecordId == pr.PRparseRecordId)
             {
                 this.stack.Pop();
             }
             return;
         }
     }
     this.stack.Pop();
     ParseRecord objectPr = (ParseRecord) this.stack.Peek();
     if (record.PRobjectTypeEnum == InternalObjectTypeE.Array)
     {
         if (record.PRobjectPositionEnum == InternalObjectPositionE.Top)
         {
             this.isTopObjectResolved = true;
             this.topObject = record.PRnewObj;
         }
         this.RegisterObject(record.PRnewObj, record, objectPr);
     }
     else
     {
         if (record.PRobjectInfo != null)
         {
             record.PRobjectInfo.PopulateObjectMembers();
         }
         if (record.PRnewObj == null)
         {
             if (record.PRdtType != Converter.typeofString)
             {
                 throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_ObjectMissing"), new object[] { pr.PRname }));
             }
             if (record.PRvalue == null)
             {
                 record.PRvalue = string.Empty;
             }
             record.PRnewObj = record.PRvalue;
             this.CheckSecurity(record);
         }
         if (!record.PRisRegistered && (record.PRobjectId > 0L))
         {
             this.RegisterObject(record.PRnewObj, record, objectPr);
         }
         if (record.PRisValueTypeFixup)
         {
             ((ValueFixup) this.valueFixupStack.Pop()).Fixup(record, objectPr);
         }
         if (record.PRobjectPositionEnum == InternalObjectPositionE.Top)
         {
             this.isTopObjectResolved = true;
             this.topObject = record.PRnewObj;
         }
         if (record.PRnewObj is SoapFault)
         {
             this.soapFaultId = record.PRobjectId;
         }
         if (record.PRobjectInfo != null)
         {
             if (record.PRobjectInfo.bfake && !record.PRobjectInfo.bSoapFault)
             {
                 record.PRobjectInfo.AddValue("__fault", null);
             }
             record.PRobjectInfo.ObjectEnd();
         }
     }
 }
        internal ParseRecord Copy()
        {
            ParseRecord newPr = new ParseRecord();

            // Enums
            newPr.PRparseTypeEnum      = PRparseTypeEnum;
            newPr.PRobjectTypeEnum     = PRobjectTypeEnum;
            newPr.PRarrayTypeEnum      = PRarrayTypeEnum;
            newPr.PRmemberTypeEnum     = PRmemberTypeEnum;
            newPr.PRmemberValueEnum    = PRmemberValueEnum;
            newPr.PRobjectPositionEnum = PRobjectPositionEnum;

            // Object
            newPr.PRname                = PRname;
            newPr.PRisParsed            = PRisParsed;
            newPr.PRisProcessAttributes = PRisProcessAttributes;
            newPr.PRnameXmlKey          = PRnameXmlKey;
            newPr.PRxmlNameSpace        = PRxmlNameSpace;

            // Value
            newPr.PRvalue = PRvalue;


            // dt attribute
            newPr.PRkeyDt        = PRkeyDt;
            newPr.PRdtType       = PRdtType;
            newPr.PRassemblyName = PRassemblyName;
            newPr.PRdtTypeCode   = PRdtTypeCode;
            newPr.PRisEnum       = PRisEnum;

            // Object ID
            newPr.PRobjectId = PRobjectId;

            // Reference ID
            newPr.PRidRef = PRidRef;

            // Array

            // Array Element Type
            newPr.PRarrayElementTypeString = PRarrayElementTypeString;
            newPr.PRarrayElementType       = PRarrayElementType;
            newPr.PRisArrayVariant         = PRisArrayVariant;
            newPr.PRarrayElementTypeCode   = PRarrayElementTypeCode;


            // Array Primitive Element type
            newPr.PRprimitiveArrayTypeString = PRprimitiveArrayTypeString;

            // Parsed array information
            newPr.PRrank        = PRrank;
            newPr.PRlengthA     = PRlengthA;
            newPr.PRpositionA   = PRpositionA;
            newPr.PRlowerBoundA = PRlowerBoundA;
            newPr.PRupperBoundA = PRupperBoundA;

            // Array map for placing array elements in array
            newPr.PRindexMap       = PRindexMap;
            newPr.PRmemberIndex    = PRmemberIndex;
            newPr.PRlinearlength   = PRlinearlength;
            newPr.PRrectangularMap = PRrectangularMap;
            newPr.PRisLowerBound   = PRisLowerBound;

            // SerializedStreamHeader information
            newPr.PRtopId                 = PRtopId;
            newPr.PRheaderId              = PRheaderId;
            newPr.PRisHeaderRoot          = PRisHeaderRoot;
            newPr.PRisAttributesProcessed = PRisAttributesProcessed;

            // Parsed HeaderMember Information
            newPr.PRisMustUnderstand = PRisMustUnderstand;

            // Parse State
            newPr.PRparseStateEnum           = PRparseStateEnum;
            newPr.PRisWaitingForNestedObject = PRisWaitingForNestedObject;


            // ValueType Fixup needed
            newPr.PRisValueTypeFixup = PRisValueTypeFixup;

            newPr.PRnewObj         = PRnewObj;
            newPr.PRobjectA        = PRobjectA;
            newPr.PRprimitiveArray = PRprimitiveArray;
            newPr.PRobjectInfo     = PRobjectInfo;
            newPr.PRisRegistered   = PRisRegistered;
            newPr.PRisXmlAttribute = PRisXmlAttribute;

            return(newPr);
        }