public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Id")) { _id = reader.Value; } if (reader.MoveToAttribute("PreviousContainerId")) { ((ILayoutPreviousContainer)this).PreviousContainerId = reader.Value; } base.ReadXml(reader); }
public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Id")) { _id = reader.Value; } if (reader.MoveToAttribute("ShowHeader")) { _showHeader = bool.Parse(reader.Value); } base.ReadXml(reader); }
/// <summary> /// Lê os dados serializados. /// </summary> /// <param name="reader"></param> void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("uid")) { Uid = Guid.Parse(reader.ReadContentAsString()); } if (reader.MoveToAttribute("name")) { Name = reader.ReadContentAsString(); } if (reader.MoveToAttribute("validationTypeUid")) { ValidationTypeUid = Guid.Parse(reader.ReadContentAsString()); } reader.MoveToElement(); if (!reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (reader.LocalName == "Parameters") { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (reader.LocalName == "ValidationParameter") { var parameter = new ValidationParameter(); ((System.Xml.Serialization.IXmlSerializable)parameter).ReadXml(reader); Parameters.Add(parameter); } else { reader.Skip(); } } reader.ReadEndElement(); } else if (reader.LocalName == "Description") { Description = reader.ReadElementContentAsString(); } } reader.ReadEndElement(); } else { reader.Skip(); } }
/// <summary> /// Lê um xml e deserializa o objeto /// </summary> /// <param name="reader">objeto leitor</param> public void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Name")) { this.Name = reader.ReadContentAsString(); } }
public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Id")) { _id = reader.Value; } if (reader.MoveToAttribute("Name")) { _name = reader.Value; } _autoFixSelectedContent = false; base.ReadXml(reader); _autoFixSelectedContent = true; AutoFixSelectedContent(); }
/// <summary>Initializes a new instance of OpmlOutline</summary> public OpmlOutline(System.Xml.XmlReader xmlTextReader) : this() { if (!xmlTextReader.HasAttributes) { return; } // get attributes System.Reflection.PropertyInfo propertyInfo = null; for (int i = 0; i < xmlTextReader.AttributeCount; i++) { xmlTextReader.MoveToAttribute(i); // try to find some common used alias names for attributes string attributeName = xmlTextReader.Name; if (attributeName.IndexOf("url") != -1) { attributeName = "xmlUrl"; } if (attributeName.IndexOf("title") != -1) { attributeName = "text"; } // find related property by name propertyInfo = GetType().GetProperty(attributeName, System.Reflection.BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); if (propertyInfo != null) { propertyInfo.SetValue(this, System.ComponentModel.TypeDescriptor.GetConverter(propertyInfo.PropertyType).ConvertFromString(xmlTextReader.ReadInnerXml().Trim()), null); } } }
/// <summary> /// Recupera os dados do xml. /// </summary> /// <param name="reader"></param> /// <returns></returns> private static System.Security.SecurityElement FromXml(System.Xml.XmlReader reader) { var element = new System.Security.SecurityElement(reader.Name); for (var i = 0; i < reader.AttributeCount; i++) { reader.MoveToAttribute(i); element.AddAttribute(reader.Name, reader.Value); } reader.MoveToContent(); if (!reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { var child = FromXml(reader); element.AddChild(child); } reader.ReadEndElement(); } else { reader.Skip(); } return(element); }
/// <summary> /// Lê o xml. /// </summary> /// <param name="reader"></param> public void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Success")) { bool success; if (bool.TryParse(reader.ReadContentAsString(), out success)) { Success = success; } } reader.MoveToElement(); if (!reader.IsEmptyElement) { reader.ReadStartElement(); var text = reader.ReadElementString("Message"); if (!text.Equals(string.Empty)) { Message = text.GetFormatter(); } reader.ReadEndElement(); } else { reader.Skip(); } }
public object Deserialize(System.Xml.XmlReader xmlReader) { if (!xmlReader.IsStartElement("Trigger")) { throw new System.Exception("Element Trigger expected"); } //xmlReader.MoveToAttribute("AssemblyQualifiedName"); xmlReader.MoveToAttribute("Type"); Type type = SerializerHelper.TriggerTypes[xmlReader.Value]; //Type.GetType(xmlReader.Value); if (type == null) { throw new System.Exception("Tipo não identificado."); } ITrigger trigger = (ITrigger)Activator.CreateInstance(type); xmlReader.ReadStartElement(); SerializerHelper.ReadWhiteSpace(xmlReader); while (xmlReader.IsStartElement()) { SerializerHelper.FillProperty(xmlReader, trigger); SerializerHelper.ReadWhiteSpace(xmlReader); } xmlReader.ReadEndElement(); SerializerHelper.ReadWhiteSpace(xmlReader); return(trigger); }
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Uid")) { Uid = reader.ReadContentAsInt(); } reader.Skip(); }
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Name")) { Name = reader.ReadContentAsString(); } if (reader.MoveToAttribute("Direction")) { Direction = (Colosoft.Query.ParameterDirection)reader.ReadContentAsInt(); } if (reader.MoveToAttribute("Size")) { Size = reader.ReadContentAsInt(); } Type type = null; if (reader.MoveToAttribute("Type")) { var typeString = reader.ReadContentAsString(); if (!string.IsNullOrEmpty(typeString)) { type = Type.GetType(typeString, true); } } reader.MoveToElement(); if (!reader.IsEmptyElement) { if (type == typeof(byte[])) { var content = (string)reader.ReadElementContentAs(typeof(string), null); Value = Convert.FromBase64String(content); } else if (type != null) { Value = reader.ReadElementContentAs(type, null); } else { Value = null; } } else { reader.Skip(); } }
public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Orientation")) { Orientation = ( Orientation )Enum.Parse(typeof(Orientation), reader.Value, true); } base.ReadXml(reader); }
/// <summary> /// Lê os dados serializados. /// </summary> /// <param name="reader"></param> void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if(reader.MoveToAttribute("name")) Name = reader.ReadContentAsString(); if(reader.MoveToAttribute("isInstance")) IsInstance = reader.ReadContentAsBoolean(); if(reader.MoveToAttribute("type")) { var type = reader.ReadContentAsString(); Type = !string.IsNullOrEmpty(type) ? new Reflection.TypeName(reader.ReadContentAsString()) : null; } if(reader.MoveToAttribute("inputRulesGroup")) { var inputRulesGroupUid = reader.ReadContentAsString(); InputRulesGroupUid = !string.IsNullOrEmpty(inputRulesGroupUid) ? (Guid?)Guid.Parse(inputRulesGroupUid) : null; } reader.MoveToElement(); if(!reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if(reader.LocalName == "DefaultLabels" && !reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if(reader.LocalName == "PropertyDefaultLabel") { var label = new PropertyDefaultLabel(); ((System.Xml.Serialization.IXmlSerializable)label).ReadXml(reader); DefaultLabels.Add(label); } else reader.Skip(); } reader.ReadEndElement(); } else reader.Skip(); } reader.ReadEndElement(); } else reader.Skip(); }
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("PropertyName")) { PropertyName = reader.ReadContentAsString(); } reader.Skip(); }
public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("IsVisible")) { IsVisible = bool.Parse(reader.Value); } if (reader.MoveToAttribute("CanHide")) { CanHide = bool.Parse(reader.Value); } if (reader.MoveToAttribute("CanAutoHide")) { CanAutoHide = bool.Parse(reader.Value); } if (reader.MoveToAttribute("AutoHideWidth")) { AutoHideWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("AutoHideHeight")) { AutoHideHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("AutoHideMinWidth")) { AutoHideMinWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("AutoHideMinHeight")) { AutoHideMinHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); } base.ReadXml(reader); }
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("AssemblyQualifiedName")) { new Parser().Parse(reader.ReadContentAsString(), this); } reader.MoveToElement(); reader.Skip(); }
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("ColumnName")) { this.ColumnName = reader.ReadContentAsString(); } reader.MoveToElement(); reader.Skip(); }
protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey) { //Read Attributes for (int i = 0; i < reader.AttributeCount; i++) { reader.MoveToAttribute(i); //string readerValue = Config.Variable.Do.EvaluateVariables(reader.Value); string readerValue = reader.Value; try { this[reader.Name] = readerValue; } catch (Exception) { try { try { string t = this.Port.GetType().GetProperty(reader.Name).PropertyType.ToString(); } catch (Exception ex) { Console.WriteLine(ex.Message); } switch (this.Port.GetType().GetProperty(reader.Name).PropertyType.ToString()) { case "System.IO.Ports.Parity": this.Port.GetType().GetProperty(reader.Name).SetValue(this.Port, (System.IO.Ports.Parity)Enum.Parse(typeof(System.IO.Ports.Parity), readerValue, true), null); break; case "System.IO.Ports.StopBits": this.Port.GetType().GetProperty(reader.Name).SetValue(this.Port, (System.IO.Ports.StopBits)Enum.Parse(typeof(System.IO.Ports.StopBits), readerValue, true), null); break; case "System.Text.Encoding": this.Port.GetType().GetProperty(reader.Name).SetValue(this.Port, Encoding.GetEncoding(readerValue), null); break; case "System.Boolean": this.Port.GetType().GetProperty(reader.Name).SetValue(this.Port, Boolean.Parse(readerValue), null); break; case "System.Int16": this.Port.GetType().GetProperty(reader.Name).SetValue(this.Port, Int16.Parse(readerValue), null); break; case "System.Int32": this.Port.GetType().GetProperty(reader.Name).SetValue(this.Port, Int32.Parse(readerValue), null); break; case "System.Int64": this.Port.GetType().GetProperty(reader.Name).SetValue(this.Port, Int64.Parse(readerValue), null); break; default: this.Port.GetType().GetProperty(reader.Name).SetValue(this.Port, readerValue, null); break; } } catch (Exception e) { throw new ConfigurationErrorsException("XMLPart:SerialCommand, Attribute:" + reader.Name + ", Error:Unable to read in Value", e); } } } initilized = true; }
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Source")) { _source = reader.ReadContentAsString(); } reader.MoveToElement(); reader.Skip(); }
public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Description")) { Description = reader.Value; } base.ReadXml(reader); }
/// <summary> /// Lê os dados serializados. /// </summary> /// <param name="reader"></param> void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if(reader.MoveToAttribute("uid")) Uid = Guid.Parse(reader.ReadContentAsString()); if(reader.MoveToAttribute("name")) Name = reader.ReadContentAsString(); reader.MoveToElement(); if(!reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { switch(reader.LocalName) { case "Description": Description = reader.ReadElementContentAsString(); break; case "InputRules": { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if(reader.LocalName == "InputRulesInputRulesGroup") { var inputRule = new InputRulesInputRulesGroup(); ((System.Xml.Serialization.IXmlSerializable)inputRule).ReadXml(reader); InputRules.Add(inputRule); } else reader.Skip(); } reader.ReadEndElement(); } break; default: reader.Skip(); break; } } reader.ReadEndElement(); } else reader.Skip(); }
/// <summary> /// Generates a collection from its XML representation. /// </summary> /// <param name="reader">System.Xml.XmlReader</param> public void ReadXml(System.Xml.XmlReader reader) { this.Clear(); if (reader.ReadToDescendant("SerializableStringDictionary")) { if (reader.ReadToDescendant("DictionaryEntry")) { do { reader.MoveToAttribute("Key"); string key = reader.ReadContentAsString(); reader.MoveToAttribute("Value"); string value = reader.ReadContentAsString(); this.Add(key, value); } while (reader.ReadToNextSibling("DictionaryEntry")); } } }
public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Id")) { _id = reader.Value; } base.ReadXml(reader); }
/// <summary> /// Recupera os dados serializados no XML. /// </summary> /// <param name="reader"></param> void IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { string locale = null; if (reader.MoveToAttribute("Name")) { Name = reader.ReadContentAsString(); } if (reader.MoveToAttribute("Locale")) { locale = reader.ReadContentAsString(); } if (!string.IsNullOrEmpty(locale)) { _locale = System.Globalization.CultureInfo.GetCultureInfo(locale); } reader.MoveToElement(); if (!reader.IsEmptyElement) { reader.ReadStartElement(); reader.ReadStartElement("Fields", Namespaces.Query); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (reader.LocalName == "Field") { var field = new Field(); ((System.Xml.Serialization.IXmlSerializable)field).ReadXml(reader); _fields.Add(field); } else { reader.Skip(); } } reader.ReadEndElement(); reader.ReadEndElement(); } else { reader.Skip(); } }
/// <summary> /// Lê um xml e deserializa o objeto /// </summary> /// <param name="reader">objeto leitor</param> void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Uid")) { Uid = reader.ReadContentAsInt(); } if (reader.MoveToAttribute("Name")) { Name = reader.ReadContentAsString(); } if (reader.MoveToAttribute("Description")) { Description = reader.ReadContentAsString(); } if (reader.MoveToAttribute("Type") && reader.HasValue) { TypeDefinition = Type.GetType(reader.ReadContentAsString(), true); } reader.MoveToElement(); reader.Skip(); }
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("FullName")) { _fullName = reader.ReadContentAsString(); } if (reader.MoveToAttribute("Alias")) { _alias = reader.ReadContentAsString(); } reader.MoveToElement(); if (!reader.IsEmptyElement) { _subQuery = new QueryInfo(); ((System.Xml.Serialization.IXmlSerializable)_subQuery).ReadXml(reader); } else { reader.Skip(); } }
/// <summary> /// Lê os dados serializados. /// </summary> /// <param name="reader"></param> void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("name")) { Name = reader.ReadContentAsString(); } if (reader.MoveToAttribute("Description")) { Description = reader.ReadContentAsString(); } reader.MoveToElement(); if (!reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (reader.LocalName == "Versions" && !reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (reader.LocalName == "EntityTypeVersion") { var version = new EntityTypeVersion(); ((System.Xml.Serialization.IXmlSerializable)version).ReadXml(reader); Versions.Add(version); } else { reader.Skip(); } } reader.ReadEndElement(); } } reader.ReadEndElement(); } }
public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("DockWidth")) { _dockWidth = ( GridLength )_gridLengthConverter.ConvertFromInvariantString(reader.Value); } if (reader.MoveToAttribute("DockHeight")) { _dockHeight = ( GridLength )_gridLengthConverter.ConvertFromInvariantString(reader.Value); } if (reader.MoveToAttribute("DockMinWidth")) { _dockMinWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("DockMinHeight")) { _dockMinHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("FloatingWidth")) { _floatingWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("FloatingHeight")) { _floatingHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("FloatingLeft")) { _floatingLeft = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("FloatingTop")) { _floatingTop = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("IsMaximized")) { _isMaximized = bool.Parse(reader.Value); } base.ReadXml(reader); }
/// <summary> /// Lê os dados serializados. /// </summary> /// <param name="reader"></param> void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("uid")) { Uid = Guid.Parse(reader.ReadContentAsString()); } if (reader.MoveToAttribute("name")) { Name = reader.ReadContentAsString(); } if (reader.MoveToAttribute("inputValidate")) { var inputValidate = reader.ReadContentAsString(); if (!string.IsNullOrEmpty(inputValidate)) { this.InputValidateUid = Guid.Parse(inputValidate); } } if (reader.MoveToAttribute("parse")) { var parse = reader.ReadContentAsString(); if (!string.IsNullOrEmpty(parse)) { ParseId = int.Parse(parse); } } if (reader.MoveToAttribute("options")) { Options = (InputRulesOptions)Enum.Parse(typeof(InputRulesOptions), reader.ReadContentAsString()); } if (reader.MoveToAttribute("copyValue")) { CopyValue = reader.ReadContentAsBoolean(); } reader.MoveToElement(); if (!reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { switch (reader.LocalName) { case "Label": Label = reader.ReadElementContentAsString(); break; default: reader.Skip(); break; } } reader.ReadEndElement(); } else { reader.Skip(); } }
protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey) { //get Attributes for (int i = 0; i < reader.AttributeCount; i++) { reader.MoveToAttribute(i); try { this[reader.Name] = reader.Value; } catch (Exception e) { throw new ConfigurationErrorsException("XMLPart: ExcludeElement" + ", Attribute: " + reader.Name + ", Error: Unable to read in Value", e); } } //Get Text Content reader.MoveToElement(); this.Folder = reader.ReadElementContentAsString(); }