public static DependencyAssemblies Load(XmlElement xmlElement) { DependencyAssemblies dependencyAssemblies = new DependencyAssemblies(); foreach (XmlElement child in xmlElement.ChildNodes) { if (child.Name.Equals("DependancyAssembly")) { dependencyAssemblies.Add(DependencyAssembly.Load(child)); } } return(dependencyAssemblies); }
private void Update() { PluginData newPluginData = this.Load(); if (newPluginData == null) { return; } this._id = newPluginData._id; this._productId = newPluginData._productId; this._name = newPluginData._name; this._description = newPluginData._description; this._version = newPluginData._version; this._creator = newPluginData._creator; this._content = newPluginData._content; this._created = newPluginData._created; this._dependencyAssemblies = newPluginData._dependencyAssemblies; this._hostApplications = newPluginData._hostApplications; this._parent = newPluginData._parent; this._path = newPluginData._path; this._url = newPluginData._url; }
public static PluginData Load(PluginVersion parent, string path) { FileInfo fileinfo = new FileInfo(path); if (!fileinfo.Exists) { return(null); } XmlDocument xmlDocument = new XmlDocument(); try { xmlDocument.Load(path); } catch { string text = System.IO.File.ReadAllText(path, Encoding.Default); System.IO.File.WriteAllText(path, text, Encoding.UTF8); using (StreamReader streamreader = new StreamReader(path, Encoding.UTF8)) xmlDocument.Load(streamreader.BaseStream); } if (!xmlDocument.DocumentElement.Name.Equals("PluginData")) { return(null); } XmlElement documentElement = xmlDocument.DocumentElement; XmlAttribute id = documentElement.Attributes["Id"]; XmlAttribute productId = documentElement.Attributes["ProductId"]; XmlAttribute name = documentElement.Attributes["Name"]; XmlAttribute description = documentElement.Attributes["Description"]; XmlAttribute version = documentElement.Attributes["Version"]; XmlAttribute creator = documentElement.Attributes["Creator"]; PluginData pluginData = new PluginData(); pluginData.Id = System.Convert.ToInt32(id.Value); pluginData.ProductId = System.Convert.ToInt32(productId.Value); pluginData.Name = name.Value; pluginData.Description = description.Value; pluginData.Version = version.Value; pluginData.Creator = creator.Value; pluginData.Parent = parent; pluginData.Path = path; foreach (XmlElement child in documentElement.ChildNodes) { if (child.Name.Equals("Content")) { pluginData.Content = Content.Load(child); } else if (child.Name.Equals("HostApplications")) { pluginData.HostApplications = HostApplications.Load(child); } else if (child.Name.Equals("DependancyAssemblies")) { pluginData.DependencyAssemblies = DependencyAssemblies.Load(child); } } pluginData._created = true; return(pluginData); }