public virtual object Create(object parent, object configContext, XmlNode section) { if (section.Attributes != null && section.Attributes.Count != 0) { HandlersUtil.ThrowException("Unrecognized attribute", section); } ResolutionConfigurationCollection col = new ResolutionConfigurationCollection(parent as ResolutionConfigurationCollection); XmlNodeList imageFormats = section.ChildNodes; foreach (XmlNode child in imageFormats) { XmlNodeType ntype = child.NodeType; if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment) { continue; } if (ntype != XmlNodeType.Element) { HandlersUtil.ThrowException("Only elements allowed", child); } string imageFormatName = HandlersUtil.ExtractAttributeValue("name", child, false, false); string xResPath = HandlersUtil.ExtractNodeValue(child["xresolution"]); string yResPath = HandlersUtil.ExtractNodeValue(child["yresolution"]); string unitsType = HandlersUtil.ExtractNodeValue(child["unitstype"], false, true); string xResDefault = HandlersUtil.ExtractAttributeValue("default", child["xresolution"]); string yResDefault = HandlersUtil.ExtractAttributeValue("default", child["yresolution"]); string unitsTypeDefault = HandlersUtil.ExtractAttributeValue("default", child["unitstype"], true); Hashtable unitScale = new Hashtable(3); XmlNodeList unitScaleNodes = child.SelectNodes("unitscale"); foreach (XmlNode unitScaleNode in unitScaleNodes) { unitScale.Add( HandlersUtil.ExtractAttributeValue("value", unitScaleNode), HandlersUtil.ExtractNodeValue(unitScaleNode)); } ResolutionConfiguration resConf = new ResolutionConfiguration( imageFormatName, xResPath, yResPath, unitsType, xResDefault, yResDefault, unitsTypeDefault, unitScale); col.Add(resConf); } col.Sort(); return(col); }
public virtual object Create (object parent, object configContext, XmlNode section) { if (section.Attributes != null && section.Attributes.Count != 0) HandlersUtil.ThrowException ("Unrecognized attribute", section); ResolutionConfigurationCollection col = new ResolutionConfigurationCollection(parent as ResolutionConfigurationCollection); XmlNodeList imageFormats = section.ChildNodes; foreach (XmlNode child in imageFormats) { XmlNodeType ntype = child.NodeType; if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment) continue; if (ntype != XmlNodeType.Element) HandlersUtil.ThrowException ("Only elements allowed", child); string imageFormatName = HandlersUtil.ExtractAttributeValue ("name", child, false, false); string xResPath = HandlersUtil.ExtractNodeValue(child["xresolution"]); string yResPath = HandlersUtil.ExtractNodeValue(child["yresolution"]); string unitsType = HandlersUtil.ExtractNodeValue(child["unitstype"], false, true); string xResDefault = HandlersUtil.ExtractAttributeValue ("default", child["xresolution"]); string yResDefault = HandlersUtil.ExtractAttributeValue ("default", child["yresolution"]); string unitsTypeDefault = HandlersUtil.ExtractAttributeValue ("default", child["unitstype"], true); Hashtable unitScale = new Hashtable(3); XmlNodeList unitScaleNodes = child.SelectNodes("unitscale"); foreach (XmlNode unitScaleNode in unitScaleNodes) { unitScale.Add( HandlersUtil.ExtractAttributeValue ("value", unitScaleNode), HandlersUtil.ExtractNodeValue(unitScaleNode) ); } ResolutionConfiguration resConf = new ResolutionConfiguration( imageFormatName, xResPath, yResPath, unitsType, xResDefault, yResDefault, unitsTypeDefault, unitScale); col.Add(resConf); } col.Sort(); return col; }
internal void Add(ResolutionConfiguration value) { _resolutionConfigurations.Add(value); }