public static List <PluginClass> GetAllPlugin() { if (xmlDoc == null) { InitConfig(); } List <PluginClass> plist = new List <PluginClass>(); XmlNodeList nl = null; nl = xmlDoc.DocumentElement.SelectNodes("WebModulePlugin/Plugin"); foreach (XmlNode n in nl) { PluginClass plugin = new PluginClass(); plugin.plugintype = "WebModulePlugin"; plugin.name = n.Attributes["name"].Value; plugin.title = n.Attributes["title"].Value; plugin.path = n.Attributes["path"].Value; plugin.isdevelopment = n.Attributes["isdevelopment"].Value; plist.Add(plugin); } nl = xmlDoc.DocumentElement.SelectNodes("WinformModulePlugin/Plugin"); foreach (XmlNode n in nl) { PluginClass plugin = new PluginClass(); plugin.plugintype = "WinformModulePlugin"; plugin.name = n.Attributes["name"].Value; plugin.title = n.Attributes["title"].Value; plugin.path = n.Attributes["path"].Value; plugin.isdevelopment = n.Attributes["isdevelopment"].Value; plist.Add(plugin); } nl = xmlDoc.DocumentElement.SelectNodes("WcfModulePlugin/Plugin"); foreach (XmlNode n in nl) { PluginClass plugin = new PluginClass(); plugin.plugintype = "WcfModulePlugin"; plugin.name = n.Attributes["name"].Value; plugin.title = n.Attributes["title"].Value; plugin.path = n.Attributes["path"].Value; plugin.isdevelopment = n.Attributes["isdevelopment"].Value; plist.Add(plugin); } return(plist); }
public static PluginClass GetPlugin(string pluginType, string name) { if (xmlDoc == null) { InitConfig(); } XmlNodeList nl = xmlDoc.DocumentElement.SelectSingleNode(pluginType).SelectNodes("Plugin"); foreach (XmlNode n in nl) { if (n.Attributes["name"].Value == name) { PluginClass plugin = new PluginClass(); plugin.plugintype = pluginType; plugin.name = n.Attributes["name"].Value; plugin.title = n.Attributes["title"].Value; plugin.path = n.Attributes["path"].Value; plugin.isdevelopment = n.Attributes["isdevelopment"].Value; return(plugin); } } return(null); }
private void btnPack_Click(object sender, EventArgs e) { if (gridlocal.CurrentCell == null) { return; } List <PluginClass> plist = gridlocal.DataSource as List <PluginClass>; PluginClass pc = plist[gridlocal.CurrentCell.RowIndex]; saveFileDialog.FileName = pc.name; if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string bagpath = saveFileDialog.FileName; if (File.Exists(bagpath)) { File.Delete(bagpath); } string path = PluginSysManage.localpath + "\\" + pc.path; string prjname = null; string prjpath = null; FileInfo finfo = new FileInfo(path); if (finfo.Exists) { prjpath = finfo.Directory.FullName; prjname = finfo.Directory.Name; } PluginXmlManage.pluginfile = path; pluginxmlClass plugin = PluginXmlManage.getpluginclass(); string temp = prjpath + "_temp"; Directory.CreateDirectory(temp); foreach (issueClass ic in plugin.issue) { if (ic.type == "dir") { if (ic.source != "") { CopyFolder(prjpath + "\\" + ic.source, temp + "\\" + ic.path); } else { if (Directory.Exists(prjpath + "\\" + ic.path)) { CopyFolder(prjpath + "\\" + ic.path, temp + "\\" + ic.path); } else { Directory.CreateDirectory(temp + "\\" + ic.path); } } } else if (ic.type == "file") { if (ic.source != "") { new FileInfo(prjpath + "\\" + ic.source).CopyTo(temp + "\\" + ic.path, true); } else { new FileInfo(prjpath + "\\" + ic.path).CopyTo(temp + "\\" + ic.path, true); } } } FastZipHelper.compress(temp, bagpath); Directory.Delete(temp, true); } }