/// <summary> /// 取得插件设置 /// </summary> /// <returns></returns> public static List <PluginConfig> GetPluginConfig() { List <PluginConfig> ps = new List <PluginConfig>(); string path = System.Web.HttpRuntime.AppDomainAppPath + "/config/"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } DirectoryInfo mydir = new DirectoryInfo(path); FileInfo[] files = mydir.GetFiles(); foreach (FileInfo f in files) { try { string xmlpath = path + f.Name; PluginConfig model = new PluginConfig(); model = (PluginConfig)SerializationHelper.Load(model.GetType(), xmlpath); if (!("," + ShopCache.GetBaseConfig().PluginUsed + ",").Contains("," + model.Assembly + ",")) { continue; } ps.Add(model); //Response.Write(model.Assembly); } catch { continue; } } return(ps); }
private void TestConfig(PluginConfig config) { config.PropertyChanged += (s, e) => { Log?.Debug($"PluginConfig.PropertyChanged: {e.PropertyName}"); }; if (config is INotifyPropertyChanged castConfig) { castConfig.PropertyChanged += (s, e) => { Log?.Debug($"INotifyPropertyChanged.PropertyChanged: {e.PropertyName}"); } } ; else { Log?.Error($"'{config.GetType().FullName}' is not INotifyPropertyChanged."); } Log?.Critical("Changing property..."); config.MicGain = config.MicGain + 1; }