/// <summary> /// 获取缓存的插件 /// </summary> /// <returns></returns> public static List<PlugConfig> GetCachePlugs() { List<PlugConfig> result = new List<PlugConfig>(); SQLiteDataReader sdr = SqliteHelper.ExecuteReader(SqliteHelper.SYSTEM_DB, "SELECT DirName,[index],updatetime,tab_name,enable FROM tabs WHERE enable = 1 order by [index]"); while (sdr.Read()) { PlugConfig cfg = new PlugConfig(); cfg.DllName = SqliteHelper.DBToString(sdr.GetString(0)); cfg.TabIndex = sdr.GetInt32(1); cfg.Updatetime = sdr.IsDBNull(2) ? "" : SqliteHelper.DBToString(sdr.GetString(2)); cfg.Name = SqliteHelper.DBToString(sdr.GetString(3)); cfg.Enable = "1".Equals(SqliteHelper.DBToString(sdr.GetString(4))); result.Add(cfg); } sdr.Close(); return result; }
private static PlugConfig ParseXML(string xmlpath) { PlugConfig config = null; XmlDocument Document = new XmlDocument(); try { Document.Load(xmlpath); XmlElement element = Document["Plug"]; config = new PlugConfig(); config.Name = element["Name"].InnerText.Trim(); //config.Database = element["Database"].InnerText.Trim(); config.HtmlRoot = element["HtmlRoot"].InnerText.Trim(); config.Index = element["Index"].InnerText.Trim(); config.ServerDatabase = element["ServerDatabase"].InnerText.Trim(); } catch (Exception) { config = null; } return config; }