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); }