public void SetFormValues(IEnumerable <KeyValuePair <string, string> > values) { var appKeyItem = values.FirstOrDefault(item => item.Key == "AppKey"); if (string.IsNullOrWhiteSpace(appKeyItem.Value)) { throw new Himall.Core.PluginConfigException("AppKey不能为空"); } var appSecretItem = values.FirstOrDefault(item => item.Key == "AppSecret"); if (string.IsNullOrWhiteSpace(appSecretItem.Value)) { throw new Himall.Core.PluginConfigException("AppSecret不能为空"); } MessageSMSConfig oldConfig = SMSCore.GetConfig(); oldConfig.AppKey = appKeyItem.Value; oldConfig.AppSecret = appSecretItem.Value; SMSCore.SaveConfig(oldConfig); }
public void SetFormValues(IEnumerable <KeyValuePair <string, string> > values) { KeyValuePair <string, string> keyValuePair = values.FirstOrDefault((KeyValuePair <string, string> item) => item.Key == "AppKey"); if (string.IsNullOrWhiteSpace(keyValuePair.Value)) { throw new PluginConfigException("AppKey不能为空"); } KeyValuePair <string, string> keyValuePair1 = values.FirstOrDefault((KeyValuePair <string, string> item) => item.Key == "AppSecret"); if (string.IsNullOrWhiteSpace(keyValuePair1.Value)) { throw new PluginConfigException("AppSecret不能为空"); } MessageSMSConfig config = SMSCore.GetConfig(); config.AppKey = keyValuePair.Value; config.AppSecret = keyValuePair1.Value; SMSCore.SaveConfig(config); }