public static AddinInfo ReadFromAddinFile(StreamReader r) { XmlDocument doc = new XmlDocument(); doc.Load(r); r.Close(); AddinInfo info = new AddinInfo(); info.id = doc.DocumentElement.GetAttribute("id"); info.namspace = doc.DocumentElement.GetAttribute("namespace"); info.name = doc.DocumentElement.GetAttribute("name"); if (info.id == "") { info.id = info.name; } info.version = doc.DocumentElement.GetAttribute("version"); info.author = doc.DocumentElement.GetAttribute("author"); info.copyright = doc.DocumentElement.GetAttribute("copyright"); info.url = doc.DocumentElement.GetAttribute("url"); info.description = doc.DocumentElement.GetAttribute("description"); info.category = doc.DocumentElement.GetAttribute("category"); info.baseVersion = doc.DocumentElement.GetAttribute("compatVersion"); AddinPropertyCollectionImpl props = new AddinPropertyCollectionImpl(); info.properties = props; ReadHeader(info, props, doc.DocumentElement); ReadDependencies(info.Dependencies, info.OptionalDependencies, doc.DocumentElement); return(info); }
static void ReadHeader(AddinInfo info, AddinPropertyCollectionImpl properties, XmlElement elem) { elem = elem.SelectSingleNode("Header") as XmlElement; if (elem == null) { return; } foreach (XmlNode xprop in elem.ChildNodes) { XmlElement prop = xprop as XmlElement; if (prop != null) { switch (prop.LocalName) { case "Id": info.id = prop.InnerText; break; case "Namespace": info.namspace = prop.InnerText; break; case "Version": info.version = prop.InnerText; break; case "CompatVersion": info.baseVersion = prop.InnerText; break; default: { AddinProperty aprop = new AddinProperty(); aprop.Name = prop.LocalName; if (prop.HasAttribute("locale")) { aprop.Locale = prop.GetAttribute("locale"); } aprop.Value = prop.InnerText; properties.Add(aprop); break; } } } } }
void IBinaryXmlElement.Read(BinaryXmlReader reader) { id = reader.ReadStringValue ("id"); ns = reader.ReadStringValue ("ns"); isroot = reader.ReadBooleanValue ("isroot"); name = reader.ReadStringValue ("name"); version = reader.ReadStringValue ("version"); compatVersion = reader.ReadStringValue ("compatVersion"); hasUserId = reader.ReadBooleanValue ("hasUserId"); author = reader.ReadStringValue ("author"); url = reader.ReadStringValue ("url"); copyright = reader.ReadStringValue ("copyright"); description = reader.ReadStringValue ("description"); category = reader.ReadStringValue ("category"); basePath = reader.ReadStringValue ("basePath"); sourceAddinFile = reader.ReadStringValue ("sourceAddinFile"); defaultEnabled = reader.ReadBooleanValue ("defaultEnabled"); domain = reader.ReadStringValue ("domain"); mainModule = (ModuleDescription) reader.ReadValue ("MainModule"); optionalModules = (ModuleCollection) reader.ReadValue ("OptionalModules", new ModuleCollection (this)); nodeSets = (ExtensionNodeSetCollection) reader.ReadValue ("NodeSets", new ExtensionNodeSetCollection (this)); extensionPoints = (ExtensionPointCollection) reader.ReadValue ("ExtensionPoints", new ExtensionPointCollection (this)); conditionTypes = (ConditionTypeDescriptionCollection) reader.ReadValue ("ConditionTypes", new ConditionTypeDescriptionCollection (this)); fileInfo = (object[]) reader.ReadValue ("FilesInfo", null); localizer = (ExtensionNodeDescription) reader.ReadValue ("Localizer"); flags = (AddinFlags) reader.ReadInt32Value ("flags"); properties = (AddinPropertyCollectionImpl) reader.ReadValue ("Properties", new AddinPropertyCollectionImpl (this)); if (mainModule != null) mainModule.SetParent (this); }
public AddinInfo() { dependencies = new DependencyCollection(); optionalDependencies = new DependencyCollection(); properties = new AddinPropertyCollectionImpl(); }
public AddinInfo () { dependencies = new DependencyCollection (); optionalDependencies = new DependencyCollection (); properties = new AddinPropertyCollectionImpl (); }
static void ReadHeader (AddinInfo info, AddinPropertyCollectionImpl properties, XmlElement elem) { elem = elem.SelectSingleNode ("Header") as XmlElement; if (elem == null) return; foreach (XmlNode xprop in elem.ChildNodes) { XmlElement prop = xprop as XmlElement; if (prop != null) { switch (prop.LocalName) { case "Id": info.id = prop.InnerText; break; case "Namespace": info.namspace = prop.InnerText; break; case "Version": info.version = prop.InnerText; break; case "CompatVersion": info.baseVersion = prop.InnerText; break; default: { AddinProperty aprop = new AddinProperty (); aprop.Name = prop.LocalName; if (prop.HasAttribute ("locale")) aprop.Locale = prop.GetAttribute ("locale"); aprop.Value = prop.InnerText; properties.Add (aprop); break; }} } } }
public static AddinInfo ReadFromAddinFile (StreamReader r) { XmlDocument doc = new XmlDocument (); doc.Load (r); r.Close (); AddinInfo info = new AddinInfo (); info.id = doc.DocumentElement.GetAttribute ("id"); info.namspace = doc.DocumentElement.GetAttribute ("namespace"); info.name = doc.DocumentElement.GetAttribute ("name"); if (info.id == "") info.id = info.name; info.version = doc.DocumentElement.GetAttribute ("version"); info.author = doc.DocumentElement.GetAttribute ("author"); info.copyright = doc.DocumentElement.GetAttribute ("copyright"); info.url = doc.DocumentElement.GetAttribute ("url"); info.description = doc.DocumentElement.GetAttribute ("description"); info.category = doc.DocumentElement.GetAttribute ("category"); info.baseVersion = doc.DocumentElement.GetAttribute ("compatVersion"); AddinPropertyCollectionImpl props = new AddinPropertyCollectionImpl (); info.properties = props; ReadHeader (info, props, doc.DocumentElement); ReadDependencies (info.Dependencies, info.OptionalDependencies, doc.DocumentElement); return info; }