Ejemplo n.º 1
0
 public override void ReadXml(System.Xml.XmlReader reader)
 {
     reader.MoveToContent();
     if("ok".Equals(reader["result"]))
         Response = ServerResponseTypes.Success;
     reader.Read();
 }
Ejemplo n.º 2
0
    public void ReadXml(System.Xml.XmlReader reader)
    {
      reader.ReadStartElement("ConnectionData");
      reader.MoveToContent();

      while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
      {
        switch (reader.LocalName)
        {
          case "Authentication":
            Authentication newAuth;
            if (Enum.TryParse<Authentication>(reader.ReadElementString(reader.LocalName), out newAuth))
              this.Authentication = newAuth;
            break;
          case "Color":
            this.Color = FromHex(reader.ReadElementString(reader.LocalName));
            break;
          case "ConnectionName":
            this.ConnectionName = reader.ReadElementString(reader.LocalName);
            break;
          case "Database":
            this.Database = reader.ReadElementString(reader.LocalName);
            break;
          case "Password":
            var encrypted = reader.ReadElementString(reader.LocalName);
            string password;
            var success = TryDecryptWindows(encrypted, out password)
              || TryDecryptStatic(encrypted, out password);
            this.Password = password;
            break;
          case "Url":
            this.Url = reader.ReadElementString(reader.LocalName);
            break;
          case "UserName":
            this.UserName = reader.ReadElementString(reader.LocalName);
            break;
          case "Type":
            ConnectionType newType;
            if (Enum.TryParse<ConnectionType>(reader.ReadElementString(reader.LocalName), out newType))
              this.Type = newType;
            break;
          case "Confirm":
            Boolean newConfirm;
            if (Boolean.TryParse(reader.ReadElementString(reader.LocalName), out newConfirm))
              this.Confirm = newConfirm;
            break;
          default:
            reader.ReadOuterXml();
            reader.MoveToContent();
            break;
        }
      }

      if (this.Color == System.Drawing.Color.Empty)
      {
        var idx = (int)(((long)this.ConnectionName.GetHashCode() - int.MinValue) % _tabColors.Length);
        this.Color = _tabColors[idx];
      }
      reader.ReadEndElement();
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Load object from XML-file
        /// </summary>
        /// <param name="reader">Load object from XML-stream</param>
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();
            _width = Int32.Parse(reader.GetAttribute("width"));
            _height = Int32.Parse(reader.GetAttribute("height"));
            Boolean isEmptyElement = reader.IsEmptyElement;

            if (isEmptyElement)
                return;

            reader.ReadStartElement("WallTiles");
            reader.ReadStartElement("walls");
            while ((reader.NodeType != System.Xml.XmlNodeType.EndElement) && (reader.NodeType != System.Xml.XmlNodeType.None))
            {
                while (reader.NodeType == System.Xml.XmlNodeType.Whitespace) reader.Read();
                TileObject temp = new TileObject(_content, _width, _height);
                Backend.WallType _type = Backend.WallType.Normal;
                if (reader.GetAttribute("Type") != null)
                    _type = (Backend.WallType)Enum.Parse(typeof(Backend.WallType), reader.GetAttribute("Type").ToString());
                WallDir _id = (WallDir)Enum.Parse(typeof(WallDir), reader.GetAttribute("Direction").ToString());
                _textures[(int)_type * 100 + (int)_id].Clear();
                _textures[(int)_type * 100 + (int)_id].ReadXml(reader);
            }
            reader.ReadEndElement();

            while ((reader.NodeType != System.Xml.XmlNodeType.EndElement) && (reader.NodeType != System.Xml.XmlNodeType.None))
                reader.Read();
            reader.ReadEndElement();
        }
Ejemplo n.º 4
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();
            Url = reader.GetAttribute("Url");
            ServiceName = reader.GetAttribute("ServiceName");

            Boolean isEmptyElement = reader.IsEmptyElement; // (1)
            
            reader.ReadStartElement();
            
            if (!isEmptyElement) // (1)
            {
                HostedServiceProperties = reader.ReadContentAs(typeof(AzureHostedServiceProperties), null) as AzureHostedServiceProperties;

                reader.ReadEndElement();
            }

            isEmptyElement = reader.IsEmptyElement; // (1)

            reader.ReadStartElement();

            if (!isEmptyElement) // (1)
            {
                Deployments = reader.ReadContentAs(typeof(List<AzureDeployment>), null) as List<AzureDeployment>;

                reader.ReadEndElement();
            }
        }
		protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey)
		{
			reader.MoveToContent();

			string name = reader.GetAttribute(NamePropertyName);
			string type = reader.GetAttribute(TypePropertyName);

			if (String.IsNullOrEmpty(name))
				throw new ConfigurationErrorsException("The name attribute is required.", reader);

			if (String.IsNullOrEmpty(type))
				throw new ConfigurationErrorsException("The type attribute is required.", reader);

			Type foundType;

			try
			{
				foundType = BuildManager.GetType(type, true, true);
			}
			catch (Exception exc)
			{
				throw new ConfigurationErrorsException("The type was not able to be found.", exc, reader);
			}

			base[NamePropertyName] = name;
			base[TypePropertyName] = foundType;
		}
Ejemplo n.º 6
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();

            node1 = reader["node1"];
            node2 = reader["node2"];
        }
 public void ReadXml(System.Xml.XmlReader reader)
 {
     reader.MoveToContent();
     _DataAreaId = reader.ReadElementString();
     _FileName = reader.ReadElementString();
     _RecId = Int64.Parse(reader.ReadElementString());
 }
Ejemplo n.º 8
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();

            name = reader["name"];
            value = Convert.ToInt32(reader["value"]);
        }
 public void ReadXml(System.Xml.XmlReader reader)
 {
     reader.MoveToContent(); 
     this.Code = reader.ReadElementContentAsInt();
     this.Message = reader.ReadElementContentAsString();
     this.DataAreaId = reader.ReadElementContentAsString();
 }
Ejemplo n.º 10
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();

            string edges = reader["edges"];
            if (edges != null && edges != "")
                response.Add("edges", edges);

            string id = reader["id"];
            if (id != null && id != "")
                response.Add("id", id);

            string steps = reader["steps"];
            if (steps != null && steps != "")
                response.Add("steps", steps);

            string vertices = reader["vertices"];
            if (vertices != null && vertices != "")
                response.Add("vertices", vertices);

            string role = reader["role"];
            if (role != null && role != "")
                response.Add("role", role);

            reader.Read();
        }
Ejemplo n.º 11
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            XmlSerializer keySerializer = Utils.GetXmlSerializer(typeof(string), null);
            XmlSerializer valueSerializer = Utils.GetXmlSerializer(typeof(string), null);
            string KeyValue;
            string value;


            bool wasEmpty = reader.IsEmptyElement;
            reader.Read();

            if (wasEmpty)
                return;
            while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
            {
                reader.ReadStartElement("item");
                reader.ReadStartElement("key");
                KeyValue = (string)keySerializer.Deserialize(reader);
                reader.ReadEndElement();
                reader.ReadStartElement("value");
                value = (string)valueSerializer.Deserialize(reader);
                reader.ReadEndElement();
                this.Add(KeyValue, value);
                reader.ReadEndElement();
                reader.MoveToContent();

            }
            reader.ReadEndElement();
        }
Ejemplo n.º 12
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();

            step = Convert.ToInt32(reader["step"]);
            messageName = reader.LocalName;
        }
        public void ReadXml(System.Xml.XmlReader reader)
        {
            // Start to use the reader.
            reader.Read();
            // Read the first element ie root of this object
            reader.ReadStartElement("dictionary");

            // Read all elements
            while (reader.NodeType != XmlNodeType.EndElement) {
                // parsing the item
                reader.ReadStartElement("item");

                // PArsing the key and value
                string key = reader.ReadElementString("key");
                string value = reader.ReadElementString("value");

                // en reading the item.
                reader.ReadEndElement();
                reader.MoveToContent();

                // add the item
                this.Add(key, value);
            }

            // Extremely important to read the node to its end.
            // next call of the reader methods will crash if not called.
            reader.ReadEndElement();
        }
Ejemplo n.º 14
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();

            name = reader["name"];
            team = reader["team"];
        }
Ejemplo n.º 15
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();

            node1 = reader["node1"];
            node2 = reader["node2"];
            weight = Convert.ToInt32(reader["weight"]);
        }
 public void ReadXml(System.Xml.XmlReader reader)
 {
     reader.MoveToContent();
     _city = reader.ReadElementString();
     _country = reader.ReadElementString();
     _county = reader.ReadElementString();
     _postCode = reader.ReadElementString();
     _street = reader.ReadElementString();
 }
Ejemplo n.º 17
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement();
                reader.MoveToContent();

                this.ReadXmlBase(reader);

                reader.ReadEndElement();
                reader.MoveToContent();
            }
            else
            {
                reader.ReadStartElement();
                reader.MoveToContent();
            }
        }
Ejemplo n.º 18
0
        public new void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();

            AcceptsItems = reader.GetAttribute(PlaceholderAttributes.AcceptsItems.ToString());
            PlaceholderBehaviour = reader.GetAttribute(PlaceholderAttributes.PlaceholderBehaviour.ToString());

            base.ReadXml(reader);
        }
        /// <summary>
        /// Generates a serializable continuation token from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the continuation token is deserialized.</param>
        public void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            reader.MoveToContent();

            bool isEmptyElement = reader.IsEmptyElement;
            reader.ReadStartElement(Constants.ContinuationConstants.ContinuationTopElement);

            if (!isEmptyElement)
            {
                while (true)
                {
                    if (reader.NodeType == XmlNodeType.Element && !reader.IsEmptyElement)
                    {
                        switch (reader.Name)
                        {
                            case Constants.ContinuationConstants.VersionElement:
                                string version = reader.ReadElementContentAsString();
                                if (version != Constants.ContinuationConstants.CurrentVersion)
                                {
                                    throw new System.Xml.XmlException(string.Format(SR.UnexpectedElement, version));
                                }

                                break;
                            case Constants.ContinuationConstants.NextPartitionKeyElement:
                                this.NextPartitionKey = reader.ReadElementContentAsString();
                                break;
                            case Constants.ContinuationConstants.NextRowKeyElement:
                                this.NextRowKey = reader.ReadElementContentAsString();
                                break;
                            case Constants.ContinuationConstants.NextTableNameElement:
                                this.NextTableName = reader.ReadElementContentAsString();
                                break;
                            case Constants.ContinuationConstants.TypeElement:
                                string continuationType = reader.ReadElementContentAsString();
                                if ("Table" != continuationType)
                                {
                                    throw new System.Xml.XmlException(SR.UnexpectedContinuationType);
                                }

                                break;
                            default:
                                throw new System.Xml.XmlException(string.Format(SR.UnexpectedElement, reader.Name));
                        }
                    }
                    else
                    {
                        reader.ReadEndElement();
                        return;
                    }
                }
            }
        }
Ejemplo n.º 20
0
 protected override void ReadProperties(System.Xml.XmlReader reader)
 {
   base.ReadProperties(reader);
   reader.MoveToContent();
   var isEmptyElement = reader.IsEmptyElement;
   reader.ReadStartElement("Paths");
   if (!isEmptyElement)
   {
     reader.MoveToContent();
     var paths = new List<string>();
     while (reader.LocalName == "Path")
     {
       paths.Add(reader.ReadElementString("Path"));
       reader.MoveToContent();
     }
     reader.ReadEndElement();
     _paths = paths;
   }
 }
		ICustomXmlSerializer ICustomXmlSerializer.ReadFrom (System.Xml.XmlReader reader)
		{
			storedVars = new List<string> ();
			
			reader.MoveToContent ();
			if (reader.IsEmptyElement) {
				reader.Read ();
				return null;
			}
			reader.ReadStartElement ();
			reader.MoveToContent ();
			while (reader.NodeType != XmlNodeType.EndElement) {
				if (reader.NodeType == XmlNodeType.Element) {
					storedVars.Add (reader.ReadElementString ());
				} else
					reader.Skip ();
			}
			reader.ReadEndElement ();
			return null;
		}
Ejemplo n.º 22
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader.IsEmptyElement) { return; }

            ColorConverter cconv = new ColorConverter();
            if (reader.NodeType != System.Xml.XmlNodeType.EndElement) {
                this._color = (Color)cconv.ConvertFromString(reader.ReadString());
            }
            reader.MoveToContent();
            reader.ReadEndElement();
        }
Ejemplo n.º 23
0
 public void ReadXml(System.Xml.XmlReader reader)
 {
     reader.MoveToContent();
       var isEmptyElement = reader.IsEmptyElement;
       reader.ReadStartElement();
       if (!isEmptyElement) // (1)
       {
     ReadProperties(reader);
     reader.ReadEndElement();
       }
 }
Ejemplo n.º 24
0
 public void ReadXml(System.Xml.XmlReader reader)
 {
     reader.MoveToContent();
     this.ServerAddress = reader.GetAttribute("ServerAddress");
     this.IsValidAddress = bool.Parse(reader.GetAttribute("IsValidAddress"));
     this.UserName = reader.GetAttribute("UserName");
     string has = reader.GetAttribute("HasEnabledMultiplayer");
     if (has != null)
     {
         this.HasEnabledMultiplayer = bool.Parse(has);
     }
 }
Ejemplo n.º 25
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();
            reader.Read();

            while (reader.LocalName != "achievements")
            {
                var message = ServerMessageFactory.Instance.ConstructMessage(reader.LocalName);
                message.ReadXml(reader);
                achievementList.Add(message);
                reader.Read();
            }
        }
Ejemplo n.º 26
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToContent();

            Minimum = reader.GetAttribute("Minimum");
            Maximum = reader.GetAttribute("Maximum");

            var isEmptyElement = reader.IsEmptyElement;
            reader.ReadStartElement();
            if (!isEmptyElement) {
                reader.ReadEndElement();
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Elements to parse on an item-by-item basis.
        /// </summary>
        /// <param name="xmlReader"></param>
        public void Parse(System.Xml.XmlReader xmlReader)
        {
            while (xmlReader.Read())
              {
            if (xmlReader.NodeType == XmlNodeType.Element)
            {
              switch (xmlReader.LocalName)
              {
                case "video":
                  xmlReader.MoveToContent();
                  video_html = xmlReader.ReadString();
                  break;

                //we don't use this, but versafeed does it
                case "keywords":
                  xmlReader.MoveToContent();
                  keywords = xmlReader.ReadString();
                  break;
              }
            }
              }
        }
Ejemplo n.º 28
0
 public override void Load(System.Xml.XmlReader reader)
 {
     while (reader.Read())
     {
         if (reader.MoveToContent() == System.Xml.XmlNodeType.Element)
         {
             if (reader.Name == "Channel")
             {
                 channels.Add(reader.ReadString());
             }
         }
     }
 }
Ejemplo n.º 29
0
        public static DataValue ReadDataValue(System.Xml.XmlReader reader)
        {
            DataValue dataValue = null;

            string valueType = RmXmlSerializer.ReadXsiType(reader);
            Check.Assert(!string.IsNullOrEmpty(valueType), "value type must not be null or empty.");

            switch (valueType)
            {
                case "DV_INTERVAL":
                    reader.ReadStartElement();
                    reader.MoveToContent();

                    if(reader.LocalName != "lower" && reader.LocalName != "upper")
                        throw new ApplicationException("interval must have lower or upper element");

                    string intervalType = RmXmlSerializer.ReadXsiType(reader);

                    dataValue = CreateInterval(intervalType);
                    dataValue.ReadXmlBase(reader);

                    DesignByContract.Check.Assert(reader.NodeType == System.Xml.XmlNodeType.EndElement,
                        "Expected endElement after calling ReadXml");
                    reader.ReadEndElement();
                    reader.MoveToContent();

                    break;

                default:
                    dataValue = RmFactory.DataValue(valueType);

                    dataValue.ReadXml(reader);
                    break;
            }

            DesignByContract.Check.Ensure(dataValue != null, "dataValue must not be null.");
            return dataValue;
        }
Ejemplo n.º 30
0
        public override void Load(System.Xml.XmlReader reader)
        {
            string accountGroupNameBuffer = null;
            List<Command> commandBuffer = new List<Command>();

            while (reader.Read())
            {
                var content = reader.MoveToContent();
                if (content == System.Xml.XmlNodeType.Element)
                {
                    if (reader.Name == "AccountGroup")
                    {
                        if (accountGroupNameBuffer != null)
                            throw new Exception("AccountGroup nodes cannot be nested");

                        accountGroupNameBuffer = reader.GetAttribute("name");
                        commandBuffer.Clear();
                    }
                    else if (reader.Name == "Command")
                    {
                        if (accountGroupNameBuffer == null)
                            throw new Exception("Command nodes cannot be nested in non-AccountGroup nodes");

                        string commandName = reader.ReadString();
                        commandBuffer.Add(Command.GetCommand(commandName));
                        if (commandBuffer[commandBuffer.Count - 1] == null)
                            throw new Exception("Command '" + commandName + "' not found");
                    }
                    else if (reader.Name == "Account")
                    {
                        if (accountGroupNameBuffer != null)
                            throw new Exception("Account nodes cannot be nested in AccountGroup nodes");

                        string group = reader.GetAttribute("group");
                        string accountName = reader.ReadString();
                        accounts.Add(accountName, group);
                    }
                }
                else if (content == System.Xml.XmlNodeType.EndElement)
                {
                    if (reader.Name == "AccountGroup")
                    {
                        if (accountGroupNameBuffer != null)
                            accountGroups.Add(accountGroupNameBuffer, commandBuffer.ToArray());

                        accountGroupNameBuffer = null;
                    }
                }
            }
        }