protected PluginItem GetPluginItem(string baseName, string fullName) { PluginItem result = null; XmlDocument xmlDocument = PluginContainer.pluginCache.Get(this.IndexCacheKey) as XmlDocument; XmlNode xmlNode = xmlDocument.SelectSingleNode(string.Concat(new string[] { "//", baseName, "/item[@identity='", fullName, "']" })); if (xmlNode != null) { result = new PluginItem { FullName = xmlNode.Attributes["identity"].Value, DisplayName = xmlNode.Attributes["name"].Value, Logo = xmlNode.Attributes["logo"].Value, ShortDescription = xmlNode.Attributes["shortDescription"].Value, Description = xmlNode.Attributes["description"].Value }; } return(result); }
public virtual string ToJsonString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("{"); stringBuilder.AppendFormat("\"qty\":{0}", this.plugins.Count.ToString(CultureInfo.InvariantCulture)); if (this.plugins.Count > 0) { stringBuilder.Append(",\"items\":["); foreach (string current in this.plugins.Keys) { PluginItem pluginItem = this.plugins[current]; stringBuilder.Append("{"); stringBuilder.AppendFormat("\"FullName\":\"{0}\",\"DisplayName\":\"{1}\",\"Logo\":\"{2}\",\"ShortDescription\":\"{3}\",\"Description\":\"{4}\"", new object[] { pluginItem.FullName, pluginItem.DisplayName, pluginItem.Logo, pluginItem.ShortDescription, pluginItem.Description }); stringBuilder.Append("},"); } stringBuilder.Remove(stringBuilder.Length - 1, 1); stringBuilder.Append("]"); } stringBuilder.Append("}"); return(stringBuilder.ToString()); }
public void Add(PluginItem item) { if (!this.plugins.ContainsKey(item.FullName)) { this.plugins.Add(item.FullName, item); } }
protected PluginItemCollection GetPlugins(string baseName) { PluginItemCollection pluginItemCollection = new PluginItemCollection(); XmlDocument xmlDocument = PluginContainer.pluginCache.Get(this.IndexCacheKey) as XmlDocument; XmlNodeList xmlNodeList = xmlDocument.SelectNodes("//" + baseName + "/item"); if (xmlNodeList != null && xmlNodeList.Count > 0) { foreach (XmlNode xmlNode in xmlNodeList) { PluginItem item = new PluginItem { FullName = xmlNode.Attributes["identity"].Value, DisplayName = xmlNode.Attributes["name"].Value, Logo = xmlNode.Attributes["logo"].Value, ShortDescription = xmlNode.Attributes["shortDescription"].Value, Description = xmlNode.Attributes["description"].Value }; pluginItemCollection.Add(item); } } return(pluginItemCollection); }
public virtual string ToXmlString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<xml>"); stringBuilder.AppendFormat("<qty>{0}</qty>", this.plugins.Count.ToString(CultureInfo.InvariantCulture)); foreach (string current in this.plugins.Keys) { PluginItem pluginItem = this.plugins[current]; stringBuilder.Append("<item>"); stringBuilder.AppendFormat("<FullName>{0}</FullName><DisplayName>{1}</DisplayName><Logo>{2}</Logo><ShortDescription>{3}</ShortDescription><Description>{4}</Description>", new object[] { pluginItem.FullName, pluginItem.DisplayName, pluginItem.Logo, pluginItem.ShortDescription, pluginItem.Description }); stringBuilder.Append("</item>"); } stringBuilder.Append("</xml>"); return(stringBuilder.ToString()); }