ReadElementContentAsBoolean() public method

public ReadElementContentAsBoolean ( ) : bool
return bool
Exemplo n.º 1
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();
            reader.ReadStartElement();

            this.UniqueID = (uint)reader.ReadElementContentAsInt("UniqueID", "");
            this.Name     = reader.ReadElementString("Name", "");

            this.MaxSize      = reader.ReadElementContentAsFloat("MaxSize", "");
            this.Lod1Distance = reader.ReadElementContentAsFloat("Lod1Distance", "");
            this.Lod2Distance = reader.ReadElementContentAsFloat("Lod2Distance", "");
            this.Shadows      = reader.ReadElementContentAsBoolean("Shadows", "");
            this.SoftShadows  = reader.ReadElementContentAsBoolean("SoftShadows", "");
            this.Bloom        = reader.ReadElementContentAsBoolean("Bloom", "");
            this.UseGraph     = reader.ReadElementContentAsBoolean("UseGraph", "");
            this.UseLods      = reader.ReadElementContentAsBoolean("UseLods", "");

            if (reader.Name == "Wind")
            {
                reader.ReadStartElement();
                Wind = new Vector2(reader.ReadElementContentAsFloat("X", ""),
                                   reader.ReadElementContentAsFloat("Y", ""));
                reader.ReadEndElement();
            }

            reader.ReadEndElement();
        }
Exemplo n.º 2
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            //reader.MoveToContent();
            //reader.ReadStartElement();

            base.ReadXml(reader);
            ////worldMatrix
            worldMatrix = this.MyObject.MyTransform.GetWorldMatrix();

            IsTrigger = reader.ReadElementContentAsBoolean("IsTrigger", "");
            DoNothing = reader.ReadElementContentAsBoolean("DoNothing", "");
            if (reader.Name == "CustomScale")
            {
                reader.ReadStartElement();
                CustomScale = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                          reader.ReadElementContentAsFloat("Y", ""),
                                          reader.ReadElementContentAsFloat("Z", ""));
                reader.ReadEndElement();
            }

            if (reader.Name == "CustomOffset")
            {
                reader.ReadStartElement();
                CustomOffset = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                           reader.ReadElementContentAsFloat("Y", ""),
                                           reader.ReadElementContentAsFloat("Z", ""));
                reader.ReadEndElement();
            }
            //MyObject = ResourceManager.Instance.CurrentScene.GetObject(tmp);

            //this.CreateCollider();
            //reader.ReadEndElement();
        }
Exemplo n.º 3
0
        private XmlConfigurator(XmlReader reader, SerializationContext context, string sectionName)
        {
            this.reader = reader;
            this.context = context;
            this.sectionName = sectionName;

            handlers["IsCompact"] = delegate() { context.IsCompact = reader.ReadElementContentAsBoolean(); };
            handlers["OutputTypeComment"] = delegate() { context.OutputTypeComment = reader.ReadElementContentAsBoolean(); };
            handlers["OutputTypeInformation"] = delegate() { context.OutputTypeInformation = reader.ReadElementContentAsBoolean(); };
            handlers["ReferenceWritingType"] = new MapHandler(HandleReferenceWritingType);
            handlers["TypeBindings"] = new MapHandler(HandleTypeBindings);
            handlers["TypeConverters"] = new MapHandler(HandleTypeConverters);
            handlers["CollectionHandlers"] = new MapHandler(HandleCollectionHandlers);
            handlers["IgnoreProperties"] = new MapHandler(HandleIgnoreProperties);
        }
 public void ReadXml(XmlReader reader)
 {
     while (!reader.EOF)
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case TransliterateTOCElementName:
                     _transliterateTOC = reader.ReadElementContentAsBoolean();
                     continue;
                 case FlatFileFolderStructureElementName:
                     _flatFileFolderStructure = reader.ReadElementContentAsBoolean();
                     continue;
                 case EmbedStylesIntoXHTMLElementName:
                     _embeddStyles = reader.ReadElementContentAsBoolean();
                     continue;
                 case GenerateDropCharactersElementName:
                     _capitalDrop = reader.ReadElementContentAsBoolean();
                     continue;
             }
         }
         reader.Read();
     }
 }
Exemplo n.º 5
0
 public void ReadXml(XmlReader reader)
 {
     while (!reader.EOF)
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case Fb2FixModeElementName:
                     FixOptions fixMode;
                     string elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out fixMode))
                     {
                         throw new InvalidDataException(string.Format("Invalid fix mode: {0}", elementContent));
                     }
                     _fixMode = fixMode;
                     continue;
                 case ConverAlphaChennelElementName:
                     _convertAlphaPng = reader.ReadElementContentAsBoolean();
                     continue;
             }
         }
         reader.Read();
     }
 }
Exemplo n.º 6
0
 public void ReadXml(XmlReader reader)
 {
     while (!reader.EOF)
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case EPUB3SubVersionElementName:
                     EPubV3SubStandard standard;
                     string elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out standard))
                     {
                         throw new InvalidDataException(string.Format("Invalid epub standard version passed : {0}", elementContent));
                     }
                     _v3SubStandard = standard;
                     continue;
                 case GenerateV2CompatibleTOCElementName:
                     _generateV2CompatibleTOC = reader.ReadElementContentAsBoolean();
                     continue;
                 case HTMLFileMaxSizeAllowedElementName:
                     HTMLFileMaxSize = (ulong)reader.ReadElementContentAsLong();
                     continue;
             }
         }
         reader.Read();
     }
    
 }
        void IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();
            //reader.ReadStartElement();
            CastShadows = reader.ReadElementContentAsBoolean("CastShadows", "");

            reader.ReadStartElement("LightColor");
            LightColor = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                     reader.ReadElementContentAsFloat("Y", ""),
                                     reader.ReadElementContentAsFloat("Z", ""));
            reader.ReadEndElement();

            reader.ReadStartElement("LightSpecularColor");
            LightSpecularColor = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                             reader.ReadElementContentAsFloat("Y", ""),
                                             reader.ReadElementContentAsFloat("Z", ""));
            reader.ReadEndElement();

            reader.ReadStartElement("LightDirection");
            LightDirection = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                         reader.ReadElementContentAsFloat("Y", ""),
                                         reader.ReadElementContentAsFloat("Z", ""));
            reader.ReadEndElement();

            base.ReadXml(reader);
        }
Exemplo n.º 8
0
 internal Todo(XmlReader rdr)
 {
     rdr.ReadStartElement("todo");
     this.Id = rdr.ReadElementContentAsInt("id", "");
     this.Title = rdr.ReadElementString("title");
     this.Description = rdr.ReadElementString("description");
     this.DueDate = Convert.ToDateTime(rdr.ReadElementString("due_date"));
     this.Flagged = rdr.ReadElementContentAsBoolean("flagged", "");
     this.Complete = rdr.ReadElementContentAsBoolean("complete", "");
     this.AssignedBy = rdr.ReadElementString("assigned_by");
     this.AssignedTo = rdr.ReadElementString("assigned_to");
     this.Participants = Participant.BuildList(rdr);
     this.Tags = Tag.BuildList(rdr);
     this.Comments = MegaComment.BuildList(rdr);
     this.CreatedAt = DateTime.Parse(rdr.ReadElementString("created_at"));
     this.UpdatedAt = DateTime.Parse(rdr.ReadElementString("updated_at"));
     rdr.ReadEndElement();
 }
Exemplo n.º 9
0
        static void ProcessElement(XmlReader xr)
        {
            if (xr.EOF)
                return;

            string name = xr.GetAttribute("name");
            
            switch (name)
            {
                case "inputpath":
                    inputPath.AddRange(ProcessPathList(xr));
                    break;
                case "libs":
                    libs = ProcessStringList(xr);
                    break;
                case "rununittests":
                    runUnitTests = xr.ReadElementContentAsBoolean();
                    break;
                case "outputgrammar":
                    outputGrammar = xr.ReadElementContentAsBoolean();
                    break;
                case "outputprimitives":
                    outputPrimitives = xr.ReadElementContentAsBoolean();
                    break;
                case "extensions":
                    extensions = ProcessStringList(xr);
                    break;
                case "maxthreads":
                    maxThreads = xr.ReadElementContentAsInt();
                    break;
                case "showtiming":
                    showTiming = xr.ReadElementContentAsBoolean();
                    break;
                case "waitforkeypress":
                    waitForKeypress = xr.ReadElementContentAsBoolean();
                    break;
                case "optimize":
                    optimize = xr.ReadElementContentAsBoolean();
                    break;
                default:
                    throw new Exception("Unrecognized node type '" + name + "'");
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Read a direct payment session request result
        /// </summary>
        /// <param name="streamReader"></param>
        /// <param name="installments"></param>
        internal static void Read(XmlReader reader, Installment installment)
        {
            if (reader.IsEmptyElement)
            {
                XMLParserUtils.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(SerializerHelper.Installment);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (XMLParserUtils.IsEndElement(reader, SerializerHelper.Installment))
                {
                    XMLParserUtils.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case SerializerHelper.CreditCardBrand:
                            installment.cardBrand = reader.ReadElementContentAsString();
                            break;

                        case SerializerHelper.Quantity:
                            installment.quantity = reader.ReadElementContentAsInt();
                            break;

                        case SerializerHelper.Amount:
                            installment.amount = reader.ReadElementContentAsDecimal();
                            break;

                        case SerializerHelper.TotalAmount:
                            installment.totalAmount = reader.ReadElementContentAsDecimal();
                            break;

                        case SerializerHelper.InterestFree:
                            installment.interestFree = reader.ReadElementContentAsBoolean();
                            break;

                        default:
                            XMLParserUtils.SkipElement(reader);
                            break;
                    }
                }
                else
                {
                    XMLParserUtils.SkipNode(reader);
                }
            }
        }
Exemplo n.º 11
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();

            if (reader.Name == "intObjects")
            {
                reader.ReadStartElement();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    string s = reader.Name;
                    int    i = reader.ReadElementContentAsInt(s, "");
                    SetInt(s, i);
                }
                reader.ReadEndElement();
            }

            if (reader.Name == "floatObjects")
            {
                reader.ReadStartElement();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    string s = reader.Name;
                    float  f = reader.ReadElementContentAsFloat(s, "");
                    SetFloat(s, f);
                }
                reader.ReadEndElement();
            }

            if (reader.Name == "boolObjects")
            {
                reader.ReadStartElement();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    string s = reader.Name;
                    bool   b = reader.ReadElementContentAsBoolean(s, "");
                    SetBool(s, b);
                }
                reader.ReadEndElement();
            }

            if (reader.Name == "vectorObjects")
            {
                reader.ReadStartElement();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    string s       = reader.Name;
                    string content = reader.ReadElementContentAsString(s, "");
                }
                reader.ReadEndElement();
            }

            reader.ReadEndElement();
        }
        public override void ReadXml(XmlReader reader)
        {
            complexParameters.Clear();
            primitiveParameters.Clear();

            reader.MoveToContent();

            reader.ReadStartElement();

            primitiveParameters.Add("DesiredValueStepSize", reader.ReadElementContentAsDouble());
            primitiveParameters.Add("AllowedOscillationPercentage", reader.ReadElementContentAsDouble());
            primitiveParameters.Add("GenerateSineWaveTestCases", reader.ReadElementContentAsBoolean());
            primitiveParameters.Add("SineFrequency", reader.ReadElementContentAsDouble());

            reader.ReadEndElement();
        }
Exemplo n.º 13
0
 internal Location(XmlReader rdr)
 {
     rdr.ReadStartElement("location");
     this.Id = rdr.ReadElementContentAsInt("id", "");
     this.Label = rdr.ReadElementString("label");
     this.IsPrimary = rdr.ReadElementContentAsBoolean("primary", "");
     this.Email = rdr.ReadElementString("email");
     this.Website = rdr.ReadElementString("website");
     this.Phone = rdr.ReadElementString("phone");
     this.Cell = rdr.ReadElementString("cell");
     this.Fax = rdr.ReadElementString("fax");
     this.Street1 = rdr.ReadElementString("street_1");
     this.Street2 = rdr.ReadElementString("street_2");
     this.City = rdr.ReadElementString("city");
     this.State = rdr.ReadElementString("state");
     this.PostalCode = rdr.ReadElementString("postal_code");
     this.Country = rdr.ReadElementString("country");
     rdr.ReadEndElement();
 }
        internal static WindowsPhoneStoreServiceAppHwCapabilityNode ParseXml(XmlReader reader)
        {
            var node = new WindowsPhoneStoreServiceAppHwCapabilityNode();

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                reader.ReadStartElement();

                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    switch (reader.Name)
                    {
                        case "requirementType":
                            node.RequirementType = reader.ReadElementContentAsString();
                            break;

                        case "id":
                            node.Id = reader.ReadElementContentAsString();
                            break;

                        case "string":
                            node.Title = reader.ReadElementContentAsString();
                            break;

                        case "required":
                            node.Required = reader.ReadElementContentAsBoolean();
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }

                reader.ReadEndElement();
            }

            return node;
        }
Exemplo n.º 15
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            CastShadows = reader.ReadElementContentAsBoolean("CastShadows", "");
            reader.ReadStartElement("Color");
            LightColor = new Vector3(reader.ReadElementContentAsFloat("R", ""),
                                     reader.ReadElementContentAsFloat("G", ""),
                                     reader.ReadElementContentAsFloat("B", ""));
            reader.ReadEndElement();

            reader.ReadStartElement("SpecularColor");
            LightSpecularColor = new Vector3(reader.ReadElementContentAsFloat("R", ""),
                                             reader.ReadElementContentAsFloat("G", ""),
                                             reader.ReadElementContentAsFloat("B", ""));
            reader.ReadEndElement();

            Attenuation = reader.ReadElementContentAsFloat("Attenuation", "");

            base.ReadXml(reader);

            this.MyCollider       = new SphereCollider(this, true);
            this.MyPhysicalObject = new PhysicalObject(this, 0.0f, 0.0f, false);
        }
Exemplo n.º 16
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();
            reader.ReadStartElement();

            base.ReadXml(reader);
            //MyObject = ResourceManager.Instance.CurrentScene.GetObject(tmp);

            if (reader.Name == "Acceleration")
            {
                reader.ReadStartElement();
                acceleration = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                           reader.ReadElementContentAsFloat("Y", ""),
                                           reader.ReadElementContentAsFloat("Z", ""));
                reader.ReadEndElement();
            }

            Mass           = reader.ReadElementContentAsFloat("Mass", "");
            DragFactor     = reader.ReadElementContentAsFloat("DragFactor", "");
            IsUsingGravity = reader.ReadElementContentAsBoolean("IsUsingGravity", "");

            if (reader.Name == "Velocity")
            {
                reader.ReadStartElement();
                Velocity = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                       reader.ReadElementContentAsFloat("Y", ""),
                                       reader.ReadElementContentAsFloat("Z", ""));
                reader.ReadEndElement();
            }

            RotationConstraints = (RotationConstraintsEnum)Enum.Parse(typeof(RotationConstraintsEnum),
                                                                      reader.ReadElementString("RotationConstraints", ""));
            PositionConstraints = (PositionConstraintsEnum)Enum.Parse(typeof(PositionConstraintsEnum),
                                                                      reader.ReadElementString("PositionConstraints", ""));

            reader.ReadEndElement();
        }
Exemplo n.º 17
0
        private EffectData ReadEffect(XmlReader reader, Counter<string> badTags)
        {
            string identifier = null;
            string name = null;
            string imageName = null;
            bool incapacitate = false;

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "id")
                {
                    identifier = reader.ReadElementContentAsString();
                }
                else if (reader.NodeType == XmlNodeType.Element && reader.Name == "name")
                {
                    name = reader.ReadElementContentAsString();
                }
                else if (reader.NodeType == XmlNodeType.Element && reader.Name == "image_name")
                {
                    imageName = reader.ReadElementContentAsString();
                }
                else if (reader.NodeType == XmlNodeType.Element && reader.Name == "incapacitate")
                {
                    incapacitate = reader.ReadElementContentAsBoolean();
                }
                else if (reader.NodeType == XmlNodeType.Element)
                {
                    badTags.Increment(reader.Name);
                }
                else if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "effect")
                {
                    break;
                }
            }
            return new EffectData(identifier, name, imageName, incapacitate);
        }
        internal static MarketplaceAppEntryNode ParseXml(XmlReader reader)
        {
            var node = new MarketplaceAppEntryNode();

            reader.ReadStartElement();

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                    case "a:updated":
                        node.Updated = reader.ReadElementContentAsDateTime();
                        break;

                    case "a:title":
                        node.Title = MarketplaceAppContentNode.ParseXml(reader);
                        break;

                    case "a:id":
                        node.Id = reader.ReadElementContentAsUrn();
                        break;

                    case "version":
                        node.Version = reader.ReadElementContentAsString();
                        break;

                    case "payloadId":
                        node.PayloadId = reader.ReadElementContentAsUrn();
                        break;

                    case "skuId":
                        node.SkuId = reader.ReadElementContentAsUrn();
                        break;

                    case "skuLastUpdated":
                        node.SkuLastUpdated = reader.ReadElementContentAsDateTime();
                        break;

                    case "isAvailableInCountry":
                        node.IsAvailableInCountry = reader.ReadElementContentAsBoolean();
                        break;

                    case "isAvailableInStore":
                        node.IsAvailableInStore = reader.ReadElementContentAsBoolean();
                        break;

                    case "isClientTypeCompatible":
                        node.IsClientTypeCompatible = reader.ReadElementContentAsBoolean();
                        break;

                    case "isHardwareCompatible":
                        node.IsHardwareCompatible = reader.ReadElementContentAsBoolean();
                        break;

                    case "isBlacklisted":
                        node.IsBlacklisted = reader.ReadElementContentAsBoolean();
                        break;

                    case "url":
                        node.Url = reader.ReadElementContentAsString();
                        break;

                    case "packageSize":
                        node.PackageSize = reader.ReadElementContentAsInt();
                        break;

                    case "installSize":
                        node.InstallSize = reader.ReadElementContentAsInt();
                        break;

                    case "clientTypes":
                        node.ClientTypes = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
                        break;

                    case "supportedLanguages":
                        node.SupportedLanguages = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
                        break;

                    case "deviceCapabilities":
                        var deviceCapabilitiesString = reader.ReadElementContentAsString();

                        if (!string.IsNullOrEmpty(deviceCapabilitiesString))
                        {
                            deviceCapabilitiesString = string.Format("<root>{0}</root>", HttpUtility.HtmlDecode(deviceCapabilitiesString));

                            using (var stringReader = new StringReader(deviceCapabilitiesString))
                            {
                                using (var reader2 = XmlReader.Create(stringReader))
                                {
                                    reader2.ReadStartElement();

                                    node.DeviceCapabilities = MarketplaceAppCapabilitiesNode.ParseXml(reader2);

                                    reader2.ReadEndElement();
                                }
                            }
                        }
                        break;

                    default:
                        reader.Skip();
                        break;
                }
            }

            reader.ReadEndElement();

            return node;
        }
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();
            reader.ReadStartElement();

            base.ReadXml(reader);

            LODState = (LODStateEnum)Enum.Parse(typeof(LODStateEnum), reader.ReadElementString("LODState", ""));

            if (reader.Name == "LODs")
            {
                reader.ReadStartElement();
                int counter = 0;
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    String s = reader.ReadElementString("ModelPath", "");
                    Paths[counter] = s;
                    counter++;
                }
                reader.ReadEndElement();
            }

            for (int j = 0; j < Paths.Count(); ++j)
            {
                if (Paths[j] != "")
                {
                    LODs[j] = ResourceManager.Instance.LoadModel(Paths[j]);
                }
                else
                {
                    LODs[j] = LODs[0];
                }
            }

            if (reader.Name == "Materials")
            {
                if (!TrashSoupGame.Instance.EditorMode)
                {
                    contentPath = "../../../../TrashSoupContent/Materials/";
                }
                else
                {
                    contentPath = "../../../TrashSoup/TrashSoupContent/Materials/";
                }
                reader.ReadStartElement();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    if (reader.Name == "Name")
                    {
                        String newName = reader.ReadElementString("Name", "");

                        if (newName == "testSBMat2")
                        {
                            SkyboxMaterial sm = new SkyboxMaterial();
                            sm = ResourceManager.Instance.LoadSkyboxMaterial(Path.GetFullPath(contentPath) + newName + ".xml");
                            Mat.Add(sm);
                        }
                        if (newName == "testWaterMat")
                        {
                            WaterMaterial wm = new WaterMaterial();
                            wm = ResourceManager.Instance.LoadWaterMaterial(Path.GetFullPath(contentPath) + newName + ".xml");
                            Mat.Add(wm);
                        }
                        if (newName == "testMirrorMat")
                        {
                            MirrorMaterial mm = new MirrorMaterial();
                            mm = ResourceManager.Instance.LoadMirrorMaterial(Path.GetFullPath(contentPath) + newName + ".xml");
                            Mat.Add(mm);
                        }
                        if (newName != "testSBMat2" && newName != "testWaterMat" && newName != "testMirrorMat")
                        {
                            Material m = new Material();
                            m = ResourceManager.Instance.LoadMaterial(Path.GetFullPath(contentPath) + newName + ".xml");
                            Mat.Add(m);
                        }
                    }
                }

                reader.ReadEndElement();
            }

            this.LodControlled = reader.ReadElementContentAsBoolean("LodControlled", "");
            //ResourceManager.Instance.LoadEffects(TrashSoupGame.Instance);
            reader.ReadEndElement();
        }
        public static void ReadRSTXml(XmlReader reader, RequestSecurityToken rst, WSTrustSerializationContext context, WSTrustConstantsAdapter trustConstants)
        {
            if (reader == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader");
            }

            if (rst == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("rst");
            }

            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }

            if (trustConstants == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("trustConstants");
            }

            bool isEmptyElement = false;

            if (reader.IsStartElement(trustConstants.Elements.TokenType, trustConstants.NamespaceURI))
            {
                rst.TokenType = reader.ReadElementContentAsString();
                if (!UriUtil.CanCreateValidUri(rst.TokenType, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.TokenType, trustConstants.NamespaceURI, rst.TokenType)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.RequestType, trustConstants.NamespaceURI))
            {
                rst.RequestType = WSTrustSerializationHelper.ReadRequestType(reader, trustConstants);
                return;
            }

            if (reader.IsStartElement(WSPolicyConstants.ElementNames.AppliesTo, WSPolicyConstants.NamespaceURI))
            {
                rst.AppliesTo = WSTrustSerializationHelper.ReadAppliesTo(reader, trustConstants);
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Issuer, trustConstants.NamespaceURI))
            {
                rst.Issuer = WSTrustSerializationHelper.ReadOnBehalfOfIssuer(reader, trustConstants);
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.ProofEncryption, trustConstants.NamespaceURI))
            {
                if (!reader.IsEmptyElement)
                {
                    rst.ProofEncryption = new SecurityTokenElement(WSTrustSerializationHelper.ReadInnerXml(reader), context.SecurityTokenHandlers);
                }

                if (rst.ProofEncryption == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3218)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Encryption, trustConstants.NamespaceURI))
            {
                if (!reader.IsEmptyElement)
                {
                    rst.Encryption = new SecurityTokenElement(WSTrustSerializationHelper.ReadInnerXml(reader), context.SecurityTokenHandlers);
                }

                if (rst.Encryption == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3268)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.DelegateTo, trustConstants.NamespaceURI))
            {
                if (!reader.IsEmptyElement)
                {
                    rst.DelegateTo = new SecurityTokenElement(WSTrustSerializationHelper.ReadInnerXml(reader), context.SecurityTokenHandlers);
                }

                if (rst.DelegateTo == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3219)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Claims, trustConstants.NamespaceURI))
            {
                // According to trust specification, Trust13 requires Claims\@Dialect attribute but not TrustFeb2005.
                // Even for Trust13, the Dialect Uri is open.  After research, "http://schemas.xmlsoap.org/ws/2005/05/identity"
                // seems to be the most common and IDFx will use that if none defined.
                // Our implementation is, for reading/writing, we will be looking specifically for 
                // "http://docs.oasis-open.org/wsfed/authorization/200706/authclaims" (as defined in ws-federation)
                // and fallback to "http://schemas.xmlsoap.org/ws/2005/05/identity" for others.
                // This would also tolerate WCF Orcas which send us "http://schemas.xmlsoap.org/ws/2005/05/IdentityClaims" 
                // as dialect.
                rst.Claims.Dialect = reader.GetAttribute(trustConstants.Attributes.Dialect);
                if ((rst.Claims.Dialect != null) && !UriUtil.CanCreateValidUri(rst.Claims.Dialect, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3136, trustConstants.Attributes.Dialect, reader.LocalName, reader.NamespaceURI, rst.Claims.Dialect)));
                }

                string ns = WSTrustSerializationHelper.GetRequestClaimNamespace(rst.Claims.Dialect);

                isEmptyElement = reader.IsEmptyElement;
                reader.ReadStartElement(trustConstants.Elements.Claims, trustConstants.NamespaceURI);
                if (!isEmptyElement)
                {
                    while (reader.IsStartElement(WSIdentityConstants.Elements.ClaimType, ns))
                    {
                        isEmptyElement = reader.IsEmptyElement;
                        string claimType = reader.GetAttribute(WSIdentityConstants.Attributes.Uri);
                        if (string.IsNullOrEmpty(claimType))
                        {
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3009)));
                        }

                        bool isOptional = false;

                        string optionalAttributeVal = reader.GetAttribute(WSIdentityConstants.Attributes.Optional);
                        if (!string.IsNullOrEmpty(optionalAttributeVal))
                        {
                            isOptional = XmlConvert.ToBoolean(optionalAttributeVal);
                        }

                        reader.Read();
                        reader.MoveToContent();

                        string value = null;
                        if (!isEmptyElement)
                        {
                            if (reader.IsStartElement(WSAuthorizationConstants.Elements.Value, ns))
                            {
                                if (!StringComparer.Ordinal.Equals(rst.Claims.Dialect, WSAuthorizationConstants.Dialect))
                                {
                                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3258, rst.Claims.Dialect, WSAuthorizationConstants.Dialect)));
                                }
                                else
                                {
                                    // Value only supported for ws-federation authclaims
                                    value = reader.ReadElementContentAsString(WSAuthorizationConstants.Elements.Value, ns);
                                }
                            }

                            reader.ReadEndElement();
                        }

                        rst.Claims.Add(new RequestClaim(claimType, isOptional, value));
                    }

                    reader.ReadEndElement();
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Entropy, trustConstants.NamespaceURI))
            {
                isEmptyElement = reader.IsEmptyElement;

                reader.ReadStartElement(trustConstants.Elements.Entropy, trustConstants.NamespaceURI);
                if (!isEmptyElement)
                {
                    ProtectedKey protectedKey = ReadProtectedKey(reader, context, trustConstants);

                    if (protectedKey == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3026)));
                    }

                    rst.Entropy = new Entropy(protectedKey);

                    reader.ReadEndElement();
                }

                if (rst.Entropy == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3026)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.BinaryExchange, trustConstants.NamespaceURI))
            {
                rst.BinaryExchange = ReadBinaryExchange(reader, trustConstants);
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Lifetime, trustConstants.NamespaceURI))
            {
                rst.Lifetime = WSTrustSerializationHelper.ReadLifetime(reader, trustConstants);
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.RenewTarget, trustConstants.NamespaceURI))
            {
                isEmptyElement = reader.IsEmptyElement;

                if (!isEmptyElement)
                {
                    rst.RenewTarget = new SecurityTokenElement(WSTrustSerializationHelper.ReadInnerXml(reader), context.SecurityTokenHandlers);
                }

                if (rst.RenewTarget == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3151)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.OnBehalfOf, trustConstants.NamespaceURI))
            {
                if (!reader.IsEmptyElement)
                {
                    // Check that we have the SecurityTokenHandlerCollection that we need for OnBehalfOf. If not, then fail now.
                    if (context.SecurityTokenHandlerCollectionManager.ContainsKey(SecurityTokenHandlerCollectionManager.Usage.OnBehalfOf))
                    {
                        rst.OnBehalfOf = new SecurityTokenElement(WSTrustSerializationHelper.ReadInnerXml(reader), context.SecurityTokenHandlerCollectionManager[SecurityTokenHandlerCollectionManager.Usage.OnBehalfOf]);
                    }
                    else
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3264)));
                    }
                }

                if (rst.OnBehalfOf == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3152)));
                }

                return;
            }

            if (reader.IsStartElement(WSTrust14Constants.ElementNames.ActAs, WSTrust14Constants.NamespaceURI))
            {
                if (!reader.IsEmptyElement)
                {
                    // Check that we have the SecurityTokenHandlerCollection that we need for ActAs. If not, then fail now.
                    if (context.SecurityTokenHandlerCollectionManager.ContainsKey(SecurityTokenHandlerCollectionManager.Usage.ActAs))
                    {
                        rst.ActAs = new SecurityTokenElement(WSTrustSerializationHelper.ReadInnerXml(reader), context.SecurityTokenHandlerCollectionManager[SecurityTokenHandlerCollectionManager.Usage.ActAs]);
                    }
                    else
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3265)));
                    }
                }

                if (rst.ActAs == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3153)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.KeyType, trustConstants.NamespaceURI))
            {
                rst.KeyType = WSTrustSerializationHelper.ReadKeyType(reader, trustConstants);
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.KeySize, trustConstants.NamespaceURI))
            {
                if (!reader.IsEmptyElement)
                {
                    rst.KeySizeInBits = int.Parse(reader.ReadElementContentAsString(), CultureInfo.InvariantCulture);
                }

                if (rst.KeySizeInBits == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3154)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.UseKey, trustConstants.NamespaceURI))
            {
                isEmptyElement = reader.IsEmptyElement;
                reader.ReadStartElement();

                if (!isEmptyElement)
                {
                    if (!context.SecurityTokenHandlers.CanReadToken(reader))
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3165)));
                    }

                    SecurityToken originalUseKeyToken = context.SecurityTokenHandlers.ReadToken(reader);
                    SecurityKeyIdentifier useKeySki = new SecurityKeyIdentifier();

                    if (originalUseKeyToken.CanCreateKeyIdentifierClause<RsaKeyIdentifierClause>())
                    {
                        useKeySki.Add(originalUseKeyToken.CreateKeyIdentifierClause<RsaKeyIdentifierClause>());
                    }
                    else if (originalUseKeyToken.CanCreateKeyIdentifierClause<X509RawDataKeyIdentifierClause>())
                    {
                        useKeySki.Add(originalUseKeyToken.CreateKeyIdentifierClause<X509RawDataKeyIdentifierClause>());
                    }
                    else
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3166)));
                    }

                    // Ensure that the provided UseKey SKI can be resolved by the UseKeyTokenResolver.
                    // This provides proof of possession because the keys in that resolver are ones that the client has used for signature.
                    SecurityToken resolvedUseKeyToken;

                    if (!context.UseKeyTokenResolver.TryResolveToken(useKeySki, out resolvedUseKeyToken))
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidRequestException(SR.GetString(SR.ID3092, useKeySki)));
                    }

                    rst.UseKey = new UseKey(useKeySki, resolvedUseKeyToken);

                    reader.ReadEndElement();
                }

                if (rst.UseKey == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3155)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.SignWith, trustConstants.NamespaceURI))
            {
                rst.SignWith = reader.ReadElementContentAsString();
                if (!UriUtil.CanCreateValidUri(rst.SignWith, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.SignWith, trustConstants.NamespaceURI, rst.SignWith)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.EncryptWith, trustConstants.NamespaceURI))
            {
                rst.EncryptWith = reader.ReadElementContentAsString();
                if (!UriUtil.CanCreateValidUri(rst.EncryptWith, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.EncryptWith, trustConstants.NamespaceURI, rst.EncryptWith)));
                }
                
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.ComputedKeyAlgorithm, trustConstants.NamespaceURI))
            {
                rst.ComputedKeyAlgorithm = ReadComputedKeyAlgorithm(reader, trustConstants);
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.AuthenticationType, trustConstants.NamespaceURI))
            {
                rst.AuthenticationType = reader.ReadElementContentAsString(trustConstants.Elements.AuthenticationType, trustConstants.NamespaceURI);
                if (!UriUtil.CanCreateValidUri(rst.AuthenticationType, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.AuthenticationType, trustConstants.NamespaceURI, rst.AuthenticationType)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.EncryptionAlgorithm, trustConstants.NamespaceURI))
            {
                rst.EncryptionAlgorithm = reader.ReadElementContentAsString(trustConstants.Elements.EncryptionAlgorithm, trustConstants.NamespaceURI);
                if (!UriUtil.CanCreateValidUri(rst.EncryptionAlgorithm, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.EncryptionAlgorithm, trustConstants.NamespaceURI, rst.EncryptionAlgorithm)));
                }
                
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.CanonicalizationAlgorithm, trustConstants.NamespaceURI))
            {
                rst.CanonicalizationAlgorithm = reader.ReadElementContentAsString(trustConstants.Elements.CanonicalizationAlgorithm, trustConstants.NamespaceURI);
                if (!UriUtil.CanCreateValidUri(rst.CanonicalizationAlgorithm, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.CanonicalizationAlgorithm, trustConstants.NamespaceURI, rst.CanonicalizationAlgorithm)));
                }
                
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.SignatureAlgorithm, trustConstants.NamespaceURI))
            {
                rst.SignatureAlgorithm = reader.ReadElementContentAsString(trustConstants.Elements.SignatureAlgorithm, trustConstants.NamespaceURI);
                if (!UriUtil.CanCreateValidUri(rst.SignatureAlgorithm, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.SignatureAlgorithm, trustConstants.NamespaceURI, rst.SignatureAlgorithm)));
                }
                
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Forwardable, trustConstants.NamespaceURI))
            {
                rst.Forwardable = reader.ReadElementContentAsBoolean();
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Delegatable, trustConstants.NamespaceURI))
            {
                rst.Delegatable = reader.ReadElementContentAsBoolean();
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.AllowPostdating, trustConstants.NamespaceURI))
            {
                rst.AllowPostdating = true;
                isEmptyElement = reader.IsEmptyElement;
                reader.Read();
                reader.MoveToContent();
                if (!isEmptyElement)
                {
                    reader.ReadEndElement();
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Renewing, trustConstants.NamespaceURI))
            {
                isEmptyElement = reader.IsEmptyElement;
                string attrValue = reader.GetAttribute(trustConstants.Attributes.Allow);
                bool allowRenewal = true;
                bool renewalAfterExpiration = false;
                if (!string.IsNullOrEmpty(attrValue))
                {
                    allowRenewal = XmlConvert.ToBoolean(attrValue);
                }

                attrValue = reader.GetAttribute(trustConstants.Attributes.OK);
                if (!string.IsNullOrEmpty(attrValue))
                {
                    renewalAfterExpiration = XmlConvert.ToBoolean(attrValue);
                }

                rst.Renewing = new Renewing(allowRenewal, renewalAfterExpiration);

                reader.Read();
                reader.MoveToContent();
                if (!isEmptyElement)
                {
                    reader.ReadEndElement();
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.CancelTarget, trustConstants.NamespaceURI))
            {
                if (!reader.IsEmptyElement)
                {
                    rst.CancelTarget = new SecurityTokenElement(WSTrustSerializationHelper.ReadInnerXml(reader), context.SecurityTokenHandlers);
                }

                if (rst.CancelTarget == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3220)));
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Participants, trustConstants.NamespaceURI))
            {
                EndpointReference primary = null;
                List<EndpointReference> participants = new List<EndpointReference>();

                isEmptyElement = reader.IsEmptyElement;

                reader.Read();
                reader.MoveToContent();

                if (!isEmptyElement)
                {
                    if (reader.IsStartElement(trustConstants.Elements.Primary, trustConstants.NamespaceURI))
                    {
                        reader.ReadStartElement(trustConstants.Elements.Primary, trustConstants.NamespaceURI);
                        primary = EndpointReference.ReadFrom(XmlDictionaryReader.CreateDictionaryReader(reader));
                        reader.ReadEndElement();
                    }

                    while (reader.IsStartElement(trustConstants.Elements.Participant, trustConstants.NamespaceURI))
                    {
                        reader.ReadStartElement(trustConstants.Elements.Participant, trustConstants.NamespaceURI);
                        participants.Add(EndpointReference.ReadFrom(XmlDictionaryReader.CreateDictionaryReader(reader)));
                        reader.ReadEndElement();
                    }

                    if (reader.IsStartElement())
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3223, trustConstants.Elements.Participants, trustConstants.NamespaceURI, reader.LocalName, reader.NamespaceURI)));
                    }

                    rst.Participants = new Participants();
                    rst.Participants.Primary = primary;
                    rst.Participants.Participant.AddRange(participants);

                    reader.ReadEndElement();
                }

                return;
            }

            if (reader.IsStartElement(WSAuthorizationConstants.Elements.AdditionalContext, WSAuthorizationConstants.Namespace))
            {
                rst.AdditionalContext = new AdditionalContext();

                isEmptyElement = reader.IsEmptyElement;
                reader.Read();
                reader.MoveToContent();

                if (!isEmptyElement)
                {
                    while (reader.IsStartElement(WSAuthorizationConstants.Elements.ContextItem, WSAuthorizationConstants.Namespace))
                    {
                        Uri name = null;
                        Uri scope = null;
                        string value = null;
                        string attrValue = reader.GetAttribute(WSAuthorizationConstants.Attributes.Name);
                        if (string.IsNullOrEmpty(attrValue) || !UriUtil.TryCreateValidUri(attrValue, UriKind.Absolute, out name))
                        {
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(
                                SR.GetString(SR.ID3136, WSAuthorizationConstants.Attributes.Name, reader.LocalName, reader.NamespaceURI, attrValue)));
                        }

                        attrValue = reader.GetAttribute(WSAuthorizationConstants.Attributes.Scope);
                        if (!string.IsNullOrEmpty(attrValue) && !UriUtil.TryCreateValidUri(attrValue, UriKind.Absolute, out scope))
                        {
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(
                                SR.GetString(SR.ID3136, WSAuthorizationConstants.Attributes.Scope, reader.LocalName, reader.NamespaceURI, attrValue)));
                        }

                        if (reader.IsEmptyElement)
                        {
                            reader.Read();
                        }
                        else
                        {
                            reader.Read();
                            if (reader.IsStartElement(WSAuthorizationConstants.Elements.Value, WSAuthorizationConstants.Namespace))
                            {
                                value = reader.ReadElementContentAsString(WSAuthorizationConstants.Elements.Value, WSAuthorizationConstants.Namespace);
                            }

                            reader.ReadEndElement();
                        }

                        rst.AdditionalContext.Items.Add(new ContextItem(name, value, scope));
                    }

                    if (reader.IsStartElement())
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3223, WSAuthorizationConstants.Elements.AdditionalContext, WSAuthorizationConstants.Namespace, reader.LocalName, reader.NamespaceURI)));
                    }

                    reader.ReadEndElement();
                }

                return;
            }

            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3007, reader.LocalName, reader.NamespaceURI)));
        }
Exemplo n.º 21
0
        public void Deserialize(XmlReader reader)
        {
            m_name = reader.GetAttribute("name");
            int version = Convert.ToInt32(reader.GetAttribute("version"), CultureInfo.InvariantCulture);

            reader.ReadStartElement(); //ParticleEffect
            
            m_particleID = reader.ReadElementContentAsInt();

            m_length = reader.ReadElementContentAsFloat();

            if (reader.Name == "LowRes")
            {
                bool lowres = reader.ReadElementContentAsBoolean();
            }
            if (reader.Name == "Scale")
            {
                float globalScale = reader.ReadElementContentAsFloat();
            }

            bool isEmpty = reader.IsEmptyElement;
            reader.ReadStartElement(); //Generations

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                if (isEmpty)
                    break;

                if (reader.Name == "ParticleGeneration")
                {
                    MyParticleGeneration generation;
                    MyParticlesManager.GenerationsPool.AllocateOrCreate(out generation);
                    generation.Start(this);
                    generation.Init();

                    generation.Deserialize(reader);

                    AddGeneration(generation);
                }
                else if (reader.Name == "ParticleGPUGeneration")
                {
                    MyParticleGPUGeneration generation;
                    MyParticlesManager.GPUGenerationsPool.AllocateOrCreate(out generation);
                    generation.Start(this);
                    generation.Init();

                    generation.Deserialize(reader);

                    AddGeneration(generation);
                }
                else
                    reader.Read();
                    
            }

            if (!isEmpty)
                reader.ReadEndElement(); //Generations

            if (reader.NodeType != XmlNodeType.EndElement)
            {

                isEmpty = reader.IsEmptyElement;
                if (isEmpty)
                {
                    reader.Read();
                }
                else
                {
                    reader.ReadStartElement(); //Particle lights

                    while (reader.NodeType != XmlNodeType.EndElement)
                    {
                        MyParticleLight particleLight;
                        MyParticlesManager.LightsPool.AllocateOrCreate(out particleLight);
                        particleLight.Start(this);
                        particleLight.Init();

                        particleLight.Deserialize(reader);

                        AddParticleLight(particleLight);
                    }

                    reader.ReadEndElement(); //Particle lights
                }
            }

            if (reader.NodeType != XmlNodeType.EndElement)
            {

                isEmpty = reader.IsEmptyElement;
                if (isEmpty)
                {
                    reader.Read();
                }
                else
                {
                    reader.ReadStartElement(); //Particle sounds

                    while (reader.NodeType != XmlNodeType.EndElement)
                    {
                        MyParticleSound particleSound;
                        MyParticlesManager.SoundsPool.AllocateOrCreate(out particleSound);
                        particleSound.Start(this);
                        particleSound.Init();

                        particleSound.Deserialize(reader);

                        AddParticleSound(particleSound);
                    }

                    reader.ReadEndElement(); //Particle sounds
                }
            }

            reader.ReadEndElement(); //ParticleEffect
        }
Exemplo n.º 22
0
 public override bool ReadElementContentAsBoolean()
 {
     CheckAsync();
     return(_coreReader.ReadElementContentAsBoolean());
 }
Exemplo n.º 23
0
        public void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement();

            while (true)
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                switch (reader.LocalName)
                {
                    case "CampfireName":
                        this.CampfireName = reader.ReadElementContentAsString("CampfireName", "");
                        break;
                    case "CampfireToken":
                        this.CampfireToken = reader.ReadElementContentAsString("CampfireToken", "");
                        break;
                    case "DelayBeforeSmokeSignalInMinutes":
                        this.DelayBeforeSmokeSignalInMinutes = reader.ReadElementContentAsInt("DelayBeforeSmokeSignalInMinutes", "");
                        break;
                    case "SendNewUserEmail":
                        this.SendNewUserEmail = reader.ReadElementContentAsBoolean("SendNewUserEmail", "");
                        break;
                    case "ExtraEmailMessage":
                        this.ExtraEmailMessage = reader.ReadElementContentAsString("ExtraEmailMessage", "");
                        break;
                    
                    default:
                        if (reader.NodeType == XmlNodeType.Comment)
                        {
                            reader.Read();
                        }
                        else
                        {
                            reader.ReadElementContentAsString(reader.LocalName, "");
                        }
                        break;
                }
            }

            if (this.DelayBeforeSmokeSignalInMinutes < 1)
            {
                this.DelayBeforeSmokeSignalInMinutes = 1;
            }
            else if (this.DelayBeforeSmokeSignalInMinutes > 10)
            {
                this.DelayBeforeSmokeSignalInMinutes = 10;
            }

            //if (this.SmtpPort < 1)
            //{
            //    this.SmtpPort = 25;
            //}

            //if (string.IsNullOrEmpty(this.CampfireName.Trim()) || string.IsNullOrEmpty(this.CampfireToken.Trim()))
            //{
            //    throw new ApplicationException("Invalid SmokeSignalConfig.xml, missing CampfireName and/or CampfireToken fields");
            //}

            //if (string.IsNullOrEmpty(this.SmtpHost.Trim()))
            //{
            //    throw new ApplicationException("Invalid SmokeSignalConfig.xml, missing SmtpHost and/or SmtpUserName fields");
            //}

            reader.ReadEndElement();
        }
Exemplo n.º 24
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();
            reader.ReadStartElement();

            Name     = reader.ReadElementString("Name", "");
            MyEffect = ResourceManager.Instance.LoadEffect(reader.ReadElementString("EffectPath", ""));

            uint      normColor  = 0xFFFF0F0F;
            uint      blackColor = 0xFF000000;
            Texture2D defDiff    = null;

            if (!ResourceManager.Instance.Textures.TryGetValue("DefaultDiffuse", out defDiff))
            {
                defDiff = new Texture2D(TrashSoupGame.Instance.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
                defDiff.SetData <uint>(new uint[] { blackColor });
                ResourceManager.Instance.Textures.Add("DefaultDiffuse", defDiff);
            }
            Texture2D defNrm = null;

            if (!ResourceManager.Instance.Textures.TryGetValue("DefaultNormal", out defNrm))
            {
                defNrm = new Texture2D(TrashSoupGame.Instance.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
                defNrm.SetData <uint>(new uint[] { normColor });
                ResourceManager.Instance.Textures.Add("DefaultNormal", defNrm);
            }
            TextureCube defCbc = null;

            if (!ResourceManager.Instance.TexturesCube.TryGetValue("DefaultCube", out defCbc))
            {
                defCbc = new TextureCube(TrashSoupGame.Instance.GraphicsDevice, 1, false, SurfaceFormat.Color);
                defCbc.SetData <uint>(CubeMapFace.NegativeX, new uint[] { blackColor });
                defCbc.SetData <uint>(CubeMapFace.PositiveX, new uint[] { blackColor });
                defCbc.SetData <uint>(CubeMapFace.NegativeY, new uint[] { blackColor });
                defCbc.SetData <uint>(CubeMapFace.PositiveY, new uint[] { blackColor });
                defCbc.SetData <uint>(CubeMapFace.NegativeZ, new uint[] { blackColor });
                defCbc.SetData <uint>(CubeMapFace.PositiveZ, new uint[] { blackColor });
                ResourceManager.Instance.TexturesCube.Add("DefaultCube", defCbc);
            }

            DiffuseMap = ResourceManager.Instance.LoadTexture(reader.ReadElementString("DiffusePath", ""));
            if (reader.Name == "NormalPath")
            {
                NormalMap = ResourceManager.Instance.LoadTexture(reader.ReadElementString("NormalPath", ""));
            }
            if (reader.Name == "CubePath")
            {
                CubeMap = ResourceManager.Instance.LoadTextureCube(reader.ReadElementString("CubePath", ""));
            }

            reader.ReadStartElement("DiffuseColor");
            DiffuseColor = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                       reader.ReadElementContentAsFloat("Y", ""),
                                       reader.ReadElementContentAsFloat("Z", ""));
            reader.ReadEndElement();

            reader.ReadStartElement("SpecularColor");
            SpecularColor = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                        reader.ReadElementContentAsFloat("Y", ""),
                                        reader.ReadElementContentAsFloat("Z", ""));
            reader.ReadEndElement();

            Glossiness = reader.ReadElementContentAsFloat("Glossiness", "");

            reader.ReadStartElement("ReflectivityColor");
            ReflectivityColor = new Vector3(reader.ReadElementContentAsFloat("X", ""),
                                            reader.ReadElementContentAsFloat("Y", ""),
                                            reader.ReadElementContentAsFloat("Z", ""));
            reader.ReadEndElement();

            ReflectivityBias = reader.ReadElementContentAsFloat("ReflectivityBias", "");
            Transparency     = reader.ReadElementContentAsFloat("Transparency", "");
            PerPixelLighting = reader.ReadElementContentAsBoolean("PerPixelLighting", "");
            RecieveShadows   = reader.ReadElementContentAsBoolean("ReceiveShadows", "");
            Unlit            = reader.ReadElementContentAsBoolean("Unlit", "");

            AssignParamsInitialize();

            if (this.GetType() == typeof(Material))
            {
                reader.ReadEndElement();
            }
        }
        private void CreateActivityTrackingLocation(XmlReader reader, ActivityTrackingLocation location)
        {
            if (null == reader)
                throw new ArgumentNullException("reader");

            if (null == location)
                throw new ArgumentNullException("location");

            if (0 != string.Compare(reader.Name, "ActivityTrackingLocation", StringComparison.Ordinal))
                throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidPosition + "ActivityTrackingLocation.");

            if (reader.IsEmptyElement)
                return;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        if (0 == string.Compare(reader.Name, "TypeName", StringComparison.Ordinal))
                        {
                            if (null != location.ActivityType)
                                throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidType);

                            location.ActivityTypeName = reader.ReadString();
                        }
                        else if (0 == string.Compare(reader.Name, "Type", StringComparison.Ordinal))
                        {
                            if (null != location.ActivityTypeName)
                                throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidType);

                            if (!reader.IsEmptyElement)
                            {
                                //
                                // Schema validation will catch empty elements, just make sure
                                // we don't pass GetType a null or empty string and continue.
                                string type = reader.ReadString();
                                if ((null != type) && (type.Trim().Length > 0))
                                    location.ActivityType = Type.GetType(type, true);
                            }
                        }
                        else if (0 == string.Compare(reader.Name, "MatchDerivedTypes", StringComparison.Ordinal))
                            location.MatchDerivedTypes = reader.ReadElementContentAsBoolean();
                        else if (0 == string.Compare(reader.Name, "ExecutionStatusEvents", StringComparison.Ordinal))
                            CreateStatusEvents(reader, location.ExecutionStatusEvents);
                        else if (0 == string.Compare(reader.Name, "Conditions", StringComparison.Ordinal))
                            CreateConditions(reader, location.Conditions);
                        break;
                    case XmlNodeType.EndElement:
                        if (0 == string.Compare(reader.Name, "ActivityTrackingLocation", StringComparison.Ordinal))
                        {
                            //
                            // If we don't have a type or name create the Activity type to track all activities
                            if ((null == location.ActivityType) && (null == location.ActivityTypeName))
                            {
                                location.ActivityType = typeof(Activity);
                                location.MatchDerivedTypes = true;
                            }

                            return;
                        }
                        break;
                }
            }
            //
            // Something bad happened
            throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationCloseElementNotFound + "ActivityTrackingLocation.");
        }
Exemplo n.º 26
0
        public bool ReadXml(XmlReader reader, string password)
        {
            bool changed = false;

              Guid id;
            #if NETFX_4
            if (Guid.TryParse(reader.GetAttribute("id"), out id) == true)
              {
            Id = id;
              }
            #endif
            #if NETFX_3
            try
            {
                id = new Guid(reader.GetAttribute("id"));
                Id = id;
            }
            catch (Exception) { }
            #endif

            string authenticatorType = reader.GetAttribute("type");
              if (string.IsNullOrEmpty(authenticatorType) == false)
              {
            Type type = typeof(Authenticator).Assembly.GetType(authenticatorType, false, true);
            this.AuthenticatorData = Activator.CreateInstance(type) as Authenticator;
              }

            //string encrypted = reader.GetAttribute("encrypted");
            //if (string.IsNullOrEmpty(encrypted) == false)
            //{
            //	// read the encrypted text from the node
            //	string data = reader.ReadElementContentAsString();
            //	// decrypt
            //	Authenticator.PasswordTypes passwordType;
            //	data = Authenticator.DecryptSequence(data, encrypted, password, out passwordType);

            //	using (MemoryStream ms = new MemoryStream(Authenticator.StringToByteArray(data)))
            //	{
            //		reader = XmlReader.Create(ms);
            //		ReadXml(reader, password);
            //	}
            //	this.PasswordType = passwordType;
            //	this.Password = password;

            //	return;
            //}

              reader.MoveToContent();

              if (reader.IsEmptyElement)
              {
            reader.Read();
            return changed;
              }

              reader.Read();
              while (reader.EOF == false)
              {
            if (reader.IsStartElement())
            {
              switch (reader.Name)
              {
            case "name":
              Name = reader.ReadElementContentAsString();
              break;

            case "created":
              long t = reader.ReadElementContentAsLong();
              t += Convert.ToInt64(new TimeSpan(new DateTime(1970, 1, 1).Ticks).TotalMilliseconds);
              t *= TimeSpan.TicksPerMillisecond;
              Created = new DateTime(t).ToLocalTime();
              break;

            case "autorefresh":
              _autoRefresh = reader.ReadElementContentAsBoolean();
              break;

            case "allowcopy":
              _allowCopy= reader.ReadElementContentAsBoolean();
              break;

            case "copyoncode":
              _copyOnCode = reader.ReadElementContentAsBoolean();
              break;

            case "hideserial":
              _hideSerial = reader.ReadElementContentAsBoolean();
              break;

            case "skin":
              _skin = reader.ReadElementContentAsString();
              break;

                        case "hotkey":
                            _hotkey = new WinAuth.HotKey();
                            _hotkey.ReadXml(reader);
                            break;

                        case "authenticatordata":
                            try
                            {
                                // we don't pass the password as they are locked till clicked
                                changed = this.AuthenticatorData.ReadXml(reader) || changed;
                            }
                            catch (EncrpytedSecretDataException )
                            {
                                // no action needed
                            }
                            catch (BadPasswordException)
                            {
                                // no action needed
                            }
              break;

                        // v2
                        case "authenticator":
                            this.AuthenticatorData = Authenticator.ReadXmlv2(reader, password);
                            break;
                        // v2
                        case "autologin":
              var hks = new HoyKeySequence();
              hks.ReadXml(reader, password);
              break;
                        // v2
                        case "servertimediff":
                            this.AuthenticatorData.ServerTimeDiff = reader.ReadElementContentAsLong();
                            break;

            default:
              reader.Skip();
              break;
              }
            }
            else
            {
              reader.Read();
              break;
            }
              }

            return changed;
        }
Exemplo n.º 27
0
Arquivo: Cat.cs Projeto: burstas/rmps
        public bool FromXml(XmlReader reader)
        {
            if (reader == null || reader.Name != "Cat")
            {
                return false;
            }

            if (reader.Name == "Order" || reader.ReadToDescendant("Order"))
            {
                Order = reader.ReadElementContentAsInt();
            }
            if (reader.Name == "Id" || reader.ReadToNextSibling("Id"))
            {
                Id = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Parent" || reader.ReadToNextSibling("Parent"))
            {
                Parent = reader.ReadElementContentAsString();
            }
            if (reader.Name == "IsLeaf" || reader.ReadToNextSibling("IsLeaf"))
            {
                IsLeaf = reader.ReadElementContentAsBoolean();
            }
            if (reader.Name == "Text" || reader.ReadToNextSibling("Text"))
            {
                Text = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Tips" || reader.ReadToNextSibling("Tips"))
            {
                Tips = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Icon" || reader.ReadToNextSibling("Icon"))
            {
                Icon = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Meta" || reader.ReadToNextSibling("Meta"))
            {
                Meta = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Memo" || reader.ReadToNextSibling("Memo"))
            {
                Memo = reader.ReadElementContentAsString();
            }
            return true;
        }
Exemplo n.º 28
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                else if (reader.NodeType == XmlNodeType.Whitespace)
                {
                    continue;
                }
                else if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name.ToLowerInvariant())
                    {
                    case "rolename":
                        RoleName = reader.ReadElementContentAsString();
                        break;

                    case "description":
                        Description = reader.ReadElementContentAsString();
                        break;

                    case "billingfrequency":
                        BillingFrequency = reader.ReadElementContentAsString();
                        if (string.IsNullOrEmpty(BillingFrequency))
                        {
                            BillingFrequency = "N";
                        }
                        break;

                    case "billingperiod":
                        BillingPeriod = reader.ReadElementContentAsInt();
                        break;

                    case "servicefee":
                        ServiceFee = reader.ReadElementContentAsFloat();
                        if (ServiceFee < 0)
                        {
                            ServiceFee = 0;
                        }
                        break;

                    case "trialfrequency":
                        TrialFrequency = reader.ReadElementContentAsString();
                        if (string.IsNullOrEmpty(TrialFrequency))
                        {
                            TrialFrequency = "N";
                        }
                        break;

                    case "trialperiod":
                        TrialPeriod = reader.ReadElementContentAsInt();
                        break;

                    case "trialfee":
                        TrialFee = reader.ReadElementContentAsFloat();
                        if (TrialFee < 0)
                        {
                            TrialFee = 0;
                        }
                        break;

                    case "ispublic":
                        IsPublic = reader.ReadElementContentAsBoolean();
                        break;

                    case "autoassignment":
                        AutoAssignment = reader.ReadElementContentAsBoolean();
                        break;

                    case "rsvpcode":
                        RSVPCode = reader.ReadElementContentAsString();
                        break;

                    case "iconfile":
                        IconFile = reader.ReadElementContentAsString();
                        break;

                    case "roletype":
                        switch (reader.ReadElementContentAsString())
                        {
                        case "adminrole":
                            _RoleType = Roles.RoleType.Administrator;
                            break;

                        case "registeredrole":
                            _RoleType = Roles.RoleType.RegisteredUser;
                            break;

                        case "subscriberrole":
                            _RoleType = Roles.RoleType.Subscriber;
                            break;

                        default:
                            _RoleType = Roles.RoleType.None;
                            break;
                        }
                        _RoleTypeSet = true;
                        break;
                    }
                }
            }
        }
Exemplo n.º 29
0
		/// <summary>
		/// Read any extra tags from the Xml
		/// </summary>
		/// <param name="reader">XmlReader</param>
		/// <param name="name">name of tag</param>
		/// <returns>true if read and processed the tag</returns>
		public override bool ReadExtraXml(XmlReader reader, string name)
		{
			switch (name)
			{
				case "restorecodeverified":
					RestoreCodeVerified = reader.ReadElementContentAsBoolean();
					return true;
				default:
					return false;
			}
		}
Exemplo n.º 30
0
        public ShowItem(TheTVDB db, XmlReader reader, TVSettings settings)
        {
            this.SetDefaults(db);

            reader.Read();
            if (reader.Name != "ShowItem")
                return; // bail out

            reader.Read();
            while (!reader.EOF)
            {
                if ((reader.Name == "ShowItem") && !reader.IsStartElement())
                    break; // all done

                if (reader.Name == "ShowName")
                {
                    this.CustomShowName = reader.ReadElementContentAsString();
                    this.UseCustomShowName = true;
                }
                if (reader.Name == "UseCustomShowName")
                    this.UseCustomShowName = reader.ReadElementContentAsBoolean();
                if (reader.Name == "CustomShowName")
                    this.CustomShowName = reader.ReadElementContentAsString();
                else if (reader.Name == "TVDBID")
                    this.TVDBCode = reader.ReadElementContentAsInt();
                else if (reader.Name == "CountSpecials")
                    this.CountSpecials = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "ShowNextAirdate")
                    this.ShowNextAirdate = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "AutoAddNewSeasons")
                    this.AutoAddNewSeasons = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "FolderBase")
                    this.AutoAdd_FolderBase = reader.ReadElementContentAsString();
                else if (reader.Name == "FolderPerSeason")
                    this.AutoAdd_FolderPerSeason = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "SeasonFolderName")
                    this.AutoAdd_SeasonFolderName = reader.ReadElementContentAsString();
                else if (reader.Name == "DoRename")
                    this.DoRename = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "DoMissingCheck")
                    this.DoMissingCheck = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "DVDOrder")
                    this.DVDOrder = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "CustomSearchURL")
                    this.CustomSearchURL = reader.ReadElementContentAsString();
                else if (reader.Name == "ForceCheckAll") // removed 2.2.0b2
                    this.ForceCheckNoAirdate = this.ForceCheckFuture = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "ForceCheckFuture")
                    this.ForceCheckFuture = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "ForceCheckNoAirdate")
                    this.ForceCheckNoAirdate = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "PadSeasonToTwoDigits")
                    this.PadSeasonToTwoDigits = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "UseSequentialMatch")
                    this.UseSequentialMatch = reader.ReadElementContentAsBoolean();
                else if (reader.Name == "IgnoreSeasons")
                {
                    if (!reader.IsEmptyElement)
                    {
                        reader.Read();
                        while (reader.Name != "IgnoreSeasons")
                        {
                            if (reader.Name == "Ignore")
                                this.IgnoreSeasons.Add(reader.ReadElementContentAsInt());
                            else
                                reader.ReadOuterXml();
                        }
                    }
                    reader.Read();
                }
                else if (reader.Name == "AliasNames")
                {
                    if (!reader.IsEmptyElement)
                    {
                        reader.Read();
                        while (reader.Name != "AliasNames")
                        {
                            if (reader.Name == "Alias")
                                this.AliasNames.Add(reader.ReadElementContentAsString());
                            else
                                reader.ReadOuterXml();
                        }
                    }
                    reader.Read();
                }
                else if (reader.Name == "Rules")
                {
                    if (!reader.IsEmptyElement)
                    {
                        int snum = int.Parse(reader.GetAttribute("SeasonNumber"));
                        this.SeasonRules[snum] = new List<ShowRule>();
                        reader.Read();
                        while (reader.Name != "Rules")
                        {
                            if (reader.Name == "Rule")
                            {
                                this.SeasonRules[snum].Add(new ShowRule(reader.ReadSubtree()));
                                reader.Read();
                            }
                        }
                    }
                    reader.Read();
                }
                else if (reader.Name == "SeasonFolders")
                {
                    if (!reader.IsEmptyElement)
                    {
                        int snum = int.Parse(reader.GetAttribute("SeasonNumber"));
                        this.ManualFolderLocations[snum] = new List<String>();
                        reader.Read();
                        while (reader.Name != "SeasonFolders")
                        {
                            if ((reader.Name == "Folder") && reader.IsStartElement())
                            {
                                string ff = reader.GetAttribute("Location");
                                if (this.AutoFolderNameForSeason(snum, settings) != ff)
                                    this.ManualFolderLocations[snum].Add(ff);
                            }
                            reader.Read();
                        }
                    }
                    reader.Read();
                }

                else
                    reader.ReadOuterXml();
            } // while
        }
Exemplo n.º 31
0
 public override void ReadXml(XmlReader reader)
 {
     Value = reader.ReadElementContentAsBoolean();
 }
        public override void ReadXml(XmlReader reader)
        {
            complexParameters.Clear();
            primitiveParameters.Clear();

            reader.MoveToContent();

            reader.ReadStartElement();

            primitiveParameters.Add("Regions", reader.ReadElementContentAsDouble());
            primitiveParameters.Add("PointsPerRegion", reader.ReadElementContentAsDouble());

            reader.MoveToFirstAttribute();

            int cnt = Int32.Parse(reader.GetAttribute("Count"));
            reader.ReadToFollowing("Requirement");
            IList<string> requirements = new List<string>();

            for (int i = 0; i < cnt; i++)
            {
                requirements.Add(reader.ReadElementContentAsString());
            }

            complexParameters.Add("Requirements", requirements);

            reader.ReadEndElement();

            primitiveParameters.Add("UseAdaptiveRandomSearch", reader.ReadElementContentAsBoolean());
            primitiveParameters.Add("OptimizationAlgorithm", reader.ReadElementContentAsString());
            reader.ReadEndElement();
        }
Exemplo n.º 33
0
 protected override Object DoRead(XmlReader reader)
 {
     return reader.ReadElementContentAsBoolean();
 }
 public void ReadXml(XmlReader reader)
 {
     while (!reader.EOF)
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case TransliterateFileElementName:
                     _transliterateFileName = reader.ReadElementContentAsBoolean();
                     continue;
                 case AddFB2InfoElementName:
                     _addFB2Info = reader.ReadElementContentAsBoolean();
                     continue;
                 case AddSequenceNameToTitleElementName:
                     _addSeqToTitle = reader.ReadElementContentAsBoolean();
                     continue;
                 case FormatWithSequenceNameElementName:
                     _sequenceFormat = reader.ReadElementContentAsString();
                     continue;
                 case FormatWithOutSequenceNameElementName:
                     _noSequenceFormat = reader.ReadElementContentAsString();
                     continue;
                 case FormatWithOutSeriesNameElementName:
                     _noSeriesFormat = reader.ReadElementContentAsString();
                     continue;
                 case AuthorNameFormatElementName:
                     _authorFormat = reader.ReadElementContentAsString();
                     continue;
                 case FileAsFormatElementName:
                     _fileAsFormat = reader.ReadElementContentAsString();
                     continue;
                 case SkipAboutPageGenerationElementName:
                     _skipAboutPage = reader.ReadElementContentAsBoolean();
                     continue;
                 case IgnoreTitleOptionElementName:
                     IgnoreInfoSourceOptions ignoreTitle;
                     string elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out ignoreTitle))
                     {
                         throw new InvalidDataException(string.Format("Invalid ignore Title value read: {0}",elementContent));
                     }
                     _ignoreTitle = ignoreTitle;
                     continue;
                 case IgnoreAuthorsOptionElementName:
                     IgnoreInfoSourceOptions ignoreAuthors;
                     elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out ignoreAuthors))
                     {
                         throw new InvalidDataException(string.Format("Invalit ignore Authors value read: {0}", elementContent));
                     }
                     _ignoreAuthors = ignoreAuthors;
                     continue;
                 case IgnoreTranstatorsOptionElementName:
                     IgnoreInfoSourceOptions ignoreTranslators;
                     elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out ignoreTranslators))
                     {
                         throw new InvalidDataException(string.Format("Invalit ignore Translators value read: {0}", elementContent));
                     }
                     _ignoreTranslators = ignoreTranslators;
                     continue;
                 case IgnoreGenresOptionElementName:
                     IgnoreInfoSourceOptions ignoreGenres;
                     elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out ignoreGenres))
                     {
                         throw new InvalidDataException(string.Format("Invalit ignore Genres value read: {0}", elementContent));
                     }
                     _ignoreGenres = ignoreGenres;
                     continue;
                 case DecorateFontNamesElementName:
                     _decorateFontNames = reader.ReadElementContentAsBoolean();
                     continue;
                 case EPubFontSettings.FontsElementName:
                     _fonts.ReadXml(reader.ReadSubtree());
                     break;
                 case TransliterationSettingsImp.TransliterationSettingsElementName:
                     _transliterationSettings.ReadXml(reader.ReadSubtree());
                     break;
             }
         }
         reader.Read();
     }
 }
Exemplo n.º 35
0
        public void ReadXml(XmlReader reader)
        {
            reader.Read();
            while (!reader.EOF)
            {
                if (reader.IsEmptyElement && !reader.HasAttributes)
                {
                    reader.Read();
                    continue;
                }

                switch (reader.Name)
                {
                    case RedmineKeys.ID: Id = reader.ReadElementContentAsInt(); break;

                    case RedmineKeys.NAME: Name = reader.ReadElementContentAsString(); break;

                    case RedmineKeys.CUSTOMIZED_TYPE: CustomizedType = reader.ReadElementContentAsString(); break;

                    case RedmineKeys.FIELD_FORMAT: FieldFormat = reader.ReadElementContentAsString(); break;

                    case RedmineKeys.REGEXP: Regexp = reader.ReadElementContentAsString(); break;

                    case RedmineKeys.MIN_LENGTH: MinLength = reader.ReadElementContentAsNullableInt(); break;

                    case RedmineKeys.MAX_LENGTH: MaxLength = reader.ReadElementContentAsNullableInt(); break;

                    case RedmineKeys.IS_REQUIRED: IsRequired = reader.ReadElementContentAsBoolean(); break;

                    case RedmineKeys.IS_FILTER: IsFilter = reader.ReadElementContentAsBoolean(); break;

                    case RedmineKeys.SEARCHABLE: Searchable = reader.ReadElementContentAsBoolean(); break;

                    case RedmineKeys.VISIBLE: Visible = reader.ReadElementContentAsBoolean(); break;

                    case RedmineKeys.DEFAULT_VALUE: DefaultValue = reader.ReadElementContentAsString(); break;

                    case RedmineKeys.MULTIPLE: Multiple = reader.ReadElementContentAsBoolean(); break;

                    case RedmineKeys.TRACKERS: Trackers = reader.ReadElementContentAsCollection<TrackerCustomField>(); break;

                    case RedmineKeys.ROLES: Roles = reader.ReadElementContentAsCollection<CustomFieldRole>(); break;

                    case RedmineKeys.POSSIBLE_VALUES: PossibleValues = reader.ReadElementContentAsCollection<CustomFieldPossibleValue>(); break;

                    default: reader.Read(); break;
                }
            }
        }
Exemplo n.º 36
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Reads a RoleInfo from an XmlReader
        /// </summary>
        /// <param name="reader">The XmlReader to use</param>
        /// -----------------------------------------------------------------------------
        public void ReadXml(XmlReader reader)
        {
            //Set status to approved by default
            Status = RoleStatus.Approved;

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                if (reader.NodeType == XmlNodeType.Whitespace)
                {
                    continue;
                }
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name.ToLowerInvariant())
                    {
                        case "rolename":
                            RoleName = reader.ReadElementContentAsString();
                            break;
                        case "description":
                            Description = reader.ReadElementContentAsString();
                            break;
                        case "billingfrequency":
                            BillingFrequency = reader.ReadElementContentAsString();
                            if (string.IsNullOrEmpty(BillingFrequency))
                            {
                                BillingFrequency = "N";
                            }
                            break;
                        case "billingperiod":
                            BillingPeriod = reader.ReadElementContentAsInt();
                            break;
                        case "servicefee":
                            ServiceFee = reader.ReadElementContentAsFloat();
                            if (ServiceFee < 0)
                            {
                                ServiceFee = 0;
                            }
                            break;
                        case "trialfrequency":
                            TrialFrequency = reader.ReadElementContentAsString();
                            if (string.IsNullOrEmpty(TrialFrequency))
                            {
                                TrialFrequency = "N";
                            }
                            break;
                        case "trialperiod":
                            TrialPeriod = reader.ReadElementContentAsInt();
                            break;
                        case "trialfee":
                            TrialFee = reader.ReadElementContentAsFloat();
                            if (TrialFee < 0)
                            {
                                TrialFee = 0;
                            }
                            break;
                        case "ispublic":
                            IsPublic = reader.ReadElementContentAsBoolean();
                            break;
                        case "autoassignment":
                            AutoAssignment = reader.ReadElementContentAsBoolean();
                            break;
                        case "rsvpcode":
                            RSVPCode = reader.ReadElementContentAsString();
                            break;
                        case "iconfile":
                            IconFile = reader.ReadElementContentAsString();
                            break;
                        case "issystemrole":
                            IsSystemRole = reader.ReadElementContentAsBoolean();
                            break;
                        case "roletype":
                            switch (reader.ReadElementContentAsString())
                            {
                                case "adminrole":
                                    _RoleType = RoleType.Administrator;
                                    break;
                                case "registeredrole":
                                    _RoleType = RoleType.RegisteredUser;
                                    break;
                                case "subscriberrole":
                                    _RoleType = RoleType.Subscriber;
                                    break;
                                case "unverifiedrole":
                                    _RoleType = RoleType.UnverifiedUser;
                                    break;
                                default:
                                    _RoleType = RoleType.None;
                                    break;
                            }
                            _RoleTypeSet = true;
                            break;
                        case "securitymode":
                            switch (reader.ReadElementContentAsString())
                            {
                                case "securityrole":
                                    SecurityMode = SecurityMode.SecurityRole;
                                    break;
                                case "socialgroup":
                                    SecurityMode = SecurityMode.SocialGroup;
                                    break;
                                case "both":
                                    SecurityMode = SecurityMode.Both;
                                    break;
                            }
                            break;
                        case "status":
                            switch (reader.ReadElementContentAsString())
                            {
                                case "pending":
                                    Status = RoleStatus.Pending;
                                    break;
                                case "disabled":
                                    Status = RoleStatus.Disabled;
                                    break;
                                default:
                                    Status = RoleStatus.Approved;
                                    break;
                            }
                            break;
                    }
                }
            }
        }
Exemplo n.º 37
0
        public void Deserialize(XmlReader reader)
        {
            m_name = reader.GetAttribute("name");
            int version = Convert.ToInt32(reader.GetAttribute("version"), CultureInfo.InvariantCulture);

            reader.ReadStartElement(); //ParticleEffect
            
            m_particleID = reader.ReadElementContentAsInt();

            m_length = reader.ReadElementContentAsFloat();

            m_preload = reader.ReadElementContentAsFloat();

            if (reader.Name == "LowRes")
                LowRes = reader.ReadElementContentAsBoolean();

            bool isEmpty = reader.IsEmptyElement;
            reader.ReadStartElement(); //Generations

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                MyParticleGeneration generation = MyParticlesManager.GenerationsPool.Allocate();
                generation.Start(this);
                generation.Init();

                generation.Deserialize(reader);

                AddGeneration(generation);
            }

            if (!isEmpty)
                reader.ReadEndElement(); //Generations

            reader.ReadEndElement(); //ParticleEffect
        }
Exemplo n.º 38
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();
            //reader.ReadStartElement();

            UniqueID = (uint)reader.ReadElementContentAsInt("UniqueID", "");
            Name     = reader.ReadElementString("Name", "");
            DrawLast = reader.ReadElementContentAsBoolean("DrawLast", "");

            if (reader.Name == "Tags")
            {
                reader.ReadStartElement();
                Tags = new List <string>();
                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    string s = reader.ReadElementString("Tag", "");
                    if (s != "null")
                    {
                        Tags.Add(s);
                    }
                }
                reader.ReadEndElement();
            }
            Dynamic = reader.ReadElementContentAsBoolean("Dynamic", "");

            if (reader.Name == "MyTransform")
            {
                MyTransform = new Transform(this);
                (MyTransform as IXmlSerializable).ReadXml(reader);
            }

            if (reader.Name == "MyPhysicalObject")
            {
                MyPhysicalObject = new PhysicalObject(this);
                (MyPhysicalObject as IXmlSerializable).ReadXml(reader);
            }

            //if (reader.Name == "MyCollider")
            //{
            //    reader.ReadStartElement();
            //    String s = reader.ReadElementString("Type", "");
            //    switch(s)
            //    {
            //        case "TrashSoup.Engine.BoxCollider":
            //            MyCollider = new BoxCollider(this);
            //            break;
            //        case "TrashSoup.Engine.SphereCollider":
            //            MyCollider = new SphereCollider(this);
            //            break;
            //        default:
            //            MyCollider = new Collider(this);
            //            break;
            //    }
            //    (MyCollider as IXmlSerializable).ReadXml(reader);
            //    reader.ReadEndElement();
            //}

            if (reader.Name == "MyAnimator")
            {
                reader.ReadStartElement();
                Model  baseAnim     = null;
                string baseAnimPath = reader.ReadElementString("BaseAnim", "");
                if (!ResourceManager.Instance.Models.TryGetValue(baseAnimPath, out baseAnim))
                {
                    baseAnim = ResourceManager.Instance.LoadModel(baseAnimPath);
                }
                MyAnimator = new Animator(this, ResourceManager.Instance.Models[baseAnimPath]);
                (MyAnimator as IXmlSerializable).ReadXml(reader);
                //MyAnimator.MyObject = ResourceManager.Instance.CurrentScene.GetObject(MyAnimator.tmp);
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    String s = reader.ReadElementString("AnimatorClip", "");
                    MyAnimator.AddAnimationClip(ResourceManager.Instance.LoadAnimationFromModel(
                                                    ResourceManager.Instance.Models[baseAnimPath],
                                                    ResourceManager.Instance.LoadAnimation(s),
                                                    s
                                                    ));
                    //MyAnimator.animationPlayers.Add(s, new SkinningModelLibrary.AnimationPlayer(MyAnimator.SkinningData, s));
                }
                reader.ReadEndElement();
            }

            if (reader.Name == "Components")
            {
                List <object> parameters = new List <object>();
                parameters.Add(this);
                reader.MoveToContent();
                reader.ReadStartElement();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    Object obj = Activator.CreateInstance(Type.GetType(reader.Name), parameters.ToArray());
                    (obj as IXmlSerializable).ReadXml(reader);
                    Components.Add((ObjectComponent)obj);
                }
            }
            if (reader.NodeType == System.Xml.XmlNodeType.EndElement)
            {
                reader.ReadEndElement();
            }

            if (reader.Name == "MyCollider")
            {
                reader.ReadStartElement();
                String s = reader.ReadElementString("Type", "");
                switch (s)
                {
                //commented because Collider system will be changed
                case "TrashSoup.Engine.BoxCollider":
                    MyCollider = new BoxCollider(this);
                    break;

                case "TrashSoup.Engine.SphereCollider":
                    MyCollider = new SphereCollider(this);
                    break;

                default:
                    //MyCollider = new Collider(this);
                    break;
                }
                (MyCollider as IXmlSerializable).ReadXml(reader);
                reader.ReadEndElement();
            }

            //this.Initialize();

            //reader.ReadEndElement();
        }
        private void CreateActivityTrackingLocation(XmlReader reader, ActivityTrackingLocation location)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (location == null)
            {
                throw new ArgumentNullException("location");
            }
            if (string.Compare(reader.Name, "ActivityTrackingLocation", StringComparison.Ordinal) != 0)
            {
                throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidPosition + "ActivityTrackingLocation.");
            }
            if (!reader.IsEmptyElement)
            {
                while (true)
                {
                    if (!reader.Read())
                    {
                        throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationCloseElementNotFound + "ActivityTrackingLocation.");
                    }
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (string.Compare(reader.Name, "TypeName", StringComparison.Ordinal) == 0)
                            {
                                if (null != location.ActivityType)
                                {
                                    throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidType);
                                }
                                location.ActivityTypeName = reader.ReadString();
                                break;
                            }
                            if (string.Compare(reader.Name, "Type", StringComparison.Ordinal) == 0)
                            {
                                if (location.ActivityTypeName != null)
                                {
                                    throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidType);
                                }
                                if (!reader.IsEmptyElement)
                                {
                                    string typeName = reader.ReadString();
                                    if ((typeName != null) && (typeName.Trim().Length > 0))
                                    {
                                        location.ActivityType = Type.GetType(typeName, true);
                                    }
                                }
                            }
                            else if (string.Compare(reader.Name, "MatchDerivedTypes", StringComparison.Ordinal) == 0)
                            {
                                location.MatchDerivedTypes = reader.ReadElementContentAsBoolean();
                            }
                            else if (string.Compare(reader.Name, "ExecutionStatusEvents", StringComparison.Ordinal) == 0)
                            {
                                this.CreateStatusEvents(reader, location.ExecutionStatusEvents);
                            }
                            else if (string.Compare(reader.Name, "Conditions", StringComparison.Ordinal) == 0)
                            {
                                this.CreateConditions(reader, location.Conditions);
                            }
                            break;

                        case XmlNodeType.EndElement:
                            if (string.Compare(reader.Name, "ActivityTrackingLocation", StringComparison.Ordinal) == 0)
                            {
                                if ((null == location.ActivityType) && (location.ActivityTypeName == null))
                                {
                                    location.ActivityType = typeof(Activity);
                                    location.MatchDerivedTypes = true;
                                }
                                return;
                            }
                            break;
                    }
                }
            }
        }
        private void CreateUserTrackingLocation(XmlReader reader, UserTrackingLocation location)
        {
            if (null == reader)
                throw new ArgumentNullException("reader");

            if (null == location)
                throw new ArgumentNullException("location");

            if (0 != string.Compare(reader.Name, "UserTrackingLocation", StringComparison.Ordinal))
                throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidPosition + "UserTrackingLocation.");

            if (reader.IsEmptyElement)
                return;

            string name = null, type = null;
            bool derived = false, seenAct = false, seenArg = false;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        if (0 == string.Compare(reader.Name, "Activity", StringComparison.Ordinal))
                            seenAct = true;
                        else if (0 == string.Compare(reader.Name, "KeyName", StringComparison.Ordinal))
                            location.KeyName = reader.ReadString();
                        else if (0 == string.Compare(reader.Name, "Argument", StringComparison.Ordinal))
                            seenArg = true;
                        else if (0 == string.Compare(reader.Name, "TypeName", StringComparison.Ordinal))
                            name = reader.ReadString();
                        else if (0 == string.Compare(reader.Name, "Type", StringComparison.Ordinal))
                            type = reader.ReadString();
                        else if (0 == string.Compare(reader.Name, "MatchDerivedTypes", StringComparison.Ordinal))
                            derived = reader.ReadElementContentAsBoolean();
                        else if (0 == string.Compare(reader.Name, "Conditions", StringComparison.Ordinal))
                            CreateConditions(reader, location.Conditions);
                        break;
                    case XmlNodeType.EndElement:
                        if (0 == string.Compare(reader.Name, "UserTrackingLocation", StringComparison.Ordinal))
                        {
                            if (!seenAct)
                            {
                                location.ActivityType = typeof(Activity);
                                location.MatchDerivedActivityTypes = true;
                            }

                            if (!seenArg)
                            {
                                location.ArgumentType = typeof(object);
                                location.MatchDerivedArgumentTypes = true;
                            }

                            if ((null == location.ActivityType) && ((null == location.ActivityTypeName) || (0 == location.ActivityTypeName.Trim().Length)) && (null == location.ArgumentType) && ((null == location.ArgumentTypeName) || (0 == location.ArgumentTypeName.Trim().Length)))
                                throw new TrackingProfileDeserializationException(ExecutionStringManager.MissingActivityType);

                            return;
                        }
                        else if (0 == string.Compare(reader.Name, "Activity", StringComparison.Ordinal))
                        {
                            if (!seenAct)
                            {
                                location.ActivityType = typeof(Activity);
                                location.MatchDerivedActivityTypes = true;
                            }
                            else
                            {
                                if ((null != type) && (type.Trim().Length > 0))
                                    location.ActivityType = Type.GetType(type, true);
                                else
                                    location.ActivityTypeName = name;

                                location.MatchDerivedActivityTypes = derived;
                            }

                            name = null;
                            type = null;
                            derived = false;
                        }
                        else if (0 == string.Compare(reader.Name, "Argument", StringComparison.Ordinal))
                        {
                            if (!seenArg)
                            {
                                location.ArgumentType = typeof(object);
                                location.MatchDerivedArgumentTypes = true;
                            }
                            else
                            {
                                if ((null != type) && (type.Trim().Length > 0))
                                    location.ArgumentType = Type.GetType(type, true);
                                else
                                    location.ArgumentTypeName = name;

                                location.MatchDerivedArgumentTypes = derived;
                            }

                            name = null;
                            type = null;
                            derived = false;
                        }

                        break;
                }
            }
            //
            // Something bad happened
            throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationCloseElementNotFound + "UserTrackingLocation.");
        }
        private void CreateUserTrackingLocation(XmlReader reader, UserTrackingLocation location)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (location == null)
            {
                throw new ArgumentNullException("location");
            }
            if (string.Compare(reader.Name, "UserTrackingLocation", StringComparison.Ordinal) != 0)
            {
                throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidPosition + "UserTrackingLocation.");
            }
            if (!reader.IsEmptyElement)
            {
                string str = null;
                string typeName = null;
                bool flag = false;
                bool flag2 = false;
                bool flag3 = false;
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (string.Compare(reader.Name, "Activity", StringComparison.Ordinal) == 0)
                            {
                                flag2 = true;
                                break;
                            }
                            if (string.Compare(reader.Name, "KeyName", StringComparison.Ordinal) == 0)
                            {
                                location.KeyName = reader.ReadString();
                                break;
                            }
                            if (string.Compare(reader.Name, "Argument", StringComparison.Ordinal) == 0)
                            {
                                flag3 = true;
                                break;
                            }
                            if (string.Compare(reader.Name, "TypeName", StringComparison.Ordinal) == 0)
                            {
                                str = reader.ReadString();
                                break;
                            }
                            if (string.Compare(reader.Name, "Type", StringComparison.Ordinal) == 0)
                            {
                                typeName = reader.ReadString();
                                break;
                            }
                            if (string.Compare(reader.Name, "MatchDerivedTypes", StringComparison.Ordinal) == 0)
                            {
                                flag = reader.ReadElementContentAsBoolean();
                            }
                            else if (string.Compare(reader.Name, "Conditions", StringComparison.Ordinal) == 0)
                            {
                                this.CreateConditions(reader, location.Conditions);
                            }
                            break;

                        case XmlNodeType.EndElement:
                            if (string.Compare(reader.Name, "UserTrackingLocation", StringComparison.Ordinal) != 0)
                            {
                                goto Label_01FD;
                            }
                            if (!flag2)
                            {
                                location.ActivityType = typeof(Activity);
                                location.MatchDerivedActivityTypes = true;
                            }
                            if (!flag3)
                            {
                                location.ArgumentType = typeof(object);
                                location.MatchDerivedArgumentTypes = true;
                            }
                            if (((null == location.ActivityType) && ((location.ActivityTypeName == null) || (location.ActivityTypeName.Trim().Length == 0))) && ((null == location.ArgumentType) && ((location.ArgumentTypeName == null) || (location.ArgumentTypeName.Trim().Length == 0))))
                            {
                                throw new TrackingProfileDeserializationException(ExecutionStringManager.MissingActivityType);
                            }
                            return;
                    }
                    continue;
                Label_01FD:
                    if (string.Compare(reader.Name, "Activity", StringComparison.Ordinal) == 0)
                    {
                        if (!flag2)
                        {
                            location.ActivityType = typeof(Activity);
                            location.MatchDerivedActivityTypes = true;
                        }
                        else
                        {
                            if ((typeName != null) && (typeName.Trim().Length > 0))
                            {
                                location.ActivityType = Type.GetType(typeName, true);
                            }
                            else
                            {
                                location.ActivityTypeName = str;
                            }
                            location.MatchDerivedActivityTypes = flag;
                        }
                        str = null;
                        typeName = null;
                        flag = false;
                    }
                    else if (string.Compare(reader.Name, "Argument", StringComparison.Ordinal) == 0)
                    {
                        if (!flag3)
                        {
                            location.ArgumentType = typeof(object);
                            location.MatchDerivedArgumentTypes = true;
                        }
                        else
                        {
                            if ((typeName != null) && (typeName.Trim().Length > 0))
                            {
                                location.ArgumentType = Type.GetType(typeName, true);
                            }
                            else
                            {
                                location.ArgumentTypeName = str;
                            }
                            location.MatchDerivedArgumentTypes = flag;
                        }
                        str = null;
                        typeName = null;
                        flag = false;
                    }
                }
                throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationCloseElementNotFound + "UserTrackingLocation.");
            }
        }