/// <summary> /// Parses an XML plugin, calling the corresponding method in /// IPluginVisitor for each XML tag it encounters. /// </summary> /// <param name="reader">The XmlReader to read the plugin XML from.</param> /// <param name="visitor">The IPluginVisitor to call for each XML tag.</param> public static void LoadPlugin(XmlReader reader, IPluginVisitor visitor) { if (!reader.ReadToNextSibling("plugin")) throw new ArgumentException("The XML file is missing a <plugin> tag."); var baseSize = 0; if (reader.MoveToAttribute("baseSize")) baseSize = ParseInt(reader.Value); if (!visitor.EnterPlugin(baseSize)) return; ReadElements(reader, true, visitor); visitor.LeavePlugin(); }
/// <summary> /// Parses an XML plugin, calling the corresponding method in /// IPluginVisitor for each XML tag it encounters. /// </summary> /// <param name="reader">The XmlReader to read the plugin XML from.</param> /// <param name="visitor">The IPluginVisitor to call for each XML tag.</param> public static void LoadPlugin(XmlReader reader, IPluginVisitor visitor) { if (!reader.ReadToNextSibling("plugin")) throw new ArgumentException("The XML file is missing a <plugin> tag."); int baseSize = 0; if (reader.MoveToAttribute("baseSize")) baseSize = ParseInt(reader.Value); if (!visitor.EnterPlugin(baseSize)) return; ReadElements(reader, true, visitor); visitor.LeavePlugin(); }
/// <summary> /// Parses an XML plugin, calling the corresponding method in /// IPluginVisitor for each XML tag it encounters. /// </summary> /// <param name="reader">The XmlReader to read the plugin XML from.</param> /// <param name="visitor">The IPluginVisitor to call for each XML tag.</param> public static void LoadPlugin(XmlReader reader, IPluginVisitor visitor) { if (!reader.ReadToNextSibling("plugin")) throw new ArgumentException("The XML file is missing a <plugin> tag."); if (!reader.MoveToAttribute("baseSize")) throw new ArgumentException("The <plugin> tag is missing the baseSize attribute." + PositionInfo(reader)); int baseSize = ParseInt(reader.Value); if (visitor.EnterPlugin(baseSize)) { ReadElements(reader, true, visitor); visitor.LeavePlugin(); } }
/// <summary> /// Parses an XML plugin, calling the corresponding method in /// IPluginVisitor for each XML tag it encounters. /// </summary> /// <param name="reader">The XmlReader to read the plugin XML from.</param> /// <param name="visitor">The IPluginVisitor to call for each XML tag.</param> public static void LoadPlugin(XmlReader reader, IPluginVisitor visitor) { if (!reader.ReadToNextSibling("plugin")) throw new ArgumentException("The XML file is missing a <plugin> tag."); if (!reader.MoveToAttribute("headersize") && !reader.MoveToAttribute("baseSize")) throw new ArgumentException("The plugin is missing tag size information."); int baseSize = ParseInt(reader.Value); if (visitor.EnterPlugin(baseSize)) { UniversalPluginLoader loader = new UniversalPluginLoader(); loader.ReadElements(reader, true, visitor); visitor.LeavePlugin(); } }
/// <summary> /// Parses an XML plugin, calling the corresponding method in /// IPluginVisitor for each XML tag it encounters. /// </summary> /// <param name="reader">The XmlReader to read the plugin XML from.</param> /// <param name="visitor">The IPluginVisitor to call for each XML tag.</param> public static void LoadPlugin(XmlReader reader, IPluginVisitor visitor) { if (!reader.ReadToNextSibling("plugin")) { throw new ArgumentException("The XML file is missing a <plugin> tag."); } int baseSize = 0; if (reader.MoveToAttribute("headersize") || reader.MoveToAttribute("baseSize")) { baseSize = ParseInt(reader.Value); } if (visitor.EnterPlugin(baseSize)) { var loader = new UniversalPluginLoader(); loader.ReadElements(reader, true, visitor); visitor.LeavePlugin(); } }