本文整理汇总了C#中SettingsDictionary类的典型用法代码示例。如果您正苦于以下问题:C# SettingsDictionary类的具体用法?C# SettingsDictionary怎么用?C# SettingsDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SettingsDictionary类属于命名空间,在下文中一共展示了SettingsDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SettingsResponse
public SettingsResponse(bool success, SettingsDictionary settings = null, int settingsVersion = -1, Exception exception = null, string message = null) {
Success = success;
Settings = settings;
SettingsVersion = settingsVersion;
Exception = exception;
Message = message;
}
示例2: StripeWebHookReceiverTests
public StripeWebHookReceiverTests()
{
_settings = new SettingsDictionary();
_settings["MS_WebHookReceiverSecret_Stripe"] = TestSecret;
_config = HttpConfigurationMock.Create(new Dictionary<Type, object> { { typeof(SettingsDictionary), _settings } });
_context = new HttpRequestContext { Configuration = _config };
_stripeResponse = new HttpResponseMessage();
_stripeResponse.Content = new StringContent("{ \"type\": \"action\" }", Encoding.UTF8, "application/json");
_handlerMock = new HttpMessageHandlerMock();
_handlerMock.Handler = (req, counter) =>
{
string expected = string.Format(CultureInfo.InvariantCulture, StripeWebHookReceiver.EventUriTemplate, TestId);
Assert.Equal(req.RequestUri.AbsoluteUri, expected);
return Task.FromResult(_stripeResponse);
};
_httpClient = new HttpClient(_handlerMock);
_receiverMock = new Mock<StripeWebHookReceiver>(_httpClient) { CallBase = true };
_postRequest = new HttpRequestMessage { Method = HttpMethod.Post };
_postRequest.SetRequestContext(_context);
}
示例3: EventProcessingAsync
public override Task EventProcessingAsync(EventContext context) {
if (!context.Event.IsError())
return Task.CompletedTask;
Error error = context.Event.GetError();
if (error == null)
return Task.CompletedTask;
if (String.IsNullOrWhiteSpace(context.Event.Message))
context.Event.Message = error.Message;
string[] commonUserMethods = { "DataContext.SubmitChanges", "Entities.SaveChanges" };
if (context.HasProperty("CommonMethods"))
commonUserMethods = context.GetProperty<string>("CommonMethods").SplitAndTrim(',');
string[] userNamespaces = null;
if (context.HasProperty("UserNamespaces"))
userNamespaces = context.GetProperty<string>("UserNamespaces").SplitAndTrim(',');
var signature = new ErrorSignature(error, userCommonMethods: commonUserMethods, userNamespaces: userNamespaces);
if (signature.SignatureInfo.Count <= 0)
return Task.CompletedTask;
var targetInfo = new SettingsDictionary(signature.SignatureInfo);
var stackingTarget = error.GetStackingTarget();
if (stackingTarget?.Error?.StackTrace != null && stackingTarget.Error.StackTrace.Count > 0 && !targetInfo.ContainsKey("Message"))
targetInfo["Message"] = stackingTarget.Error.Message;
error.Data[Error.KnownDataKeys.TargetInfo] = targetInfo;
foreach (var key in signature.SignatureInfo.Keys)
context.StackSignatureData.Add(key, signature.SignatureInfo[key]);
return Task.CompletedTask;
}
示例4: NewElement
/// <summary>
/// Builds a new XML element with a given name and a settings dictionary.
/// </summary>
/// <param name="name">The name of the element to be mapped to XML.</param>
/// <param name="settings">The settings dictionary to be used as the element's attributes.</param>
/// <returns>The new XML element.</returns>
private XElement NewElement(string name, SettingsDictionary settings)
{
XElement element = _settingsFormatter.Map(settings);
element.Name = XmlConvert.EncodeLocalName(name);
return element;
}
示例5: DropboxWebHookReceiverTests
public DropboxWebHookReceiverTests()
{
_settings = new SettingsDictionary();
_settings["MS_WebHookReceiverSecret_Dropbox"] = TestSecret;
_config = HttpConfigurationMock.Create(new Dictionary<Type, object> { { typeof(SettingsDictionary), _settings } });
_context = new HttpRequestContext { Configuration = _config };
_receiverMock = new Mock<DropboxWebHookReceiver> { CallBase = true };
_getRequest = new HttpRequestMessage();
_getRequest.SetRequestContext(_context);
_postRequest = new HttpRequestMessage() { Method = HttpMethod.Post };
_postRequest.SetRequestContext(_context);
_postRequest.Content = new StringContent(TestContent, Encoding.UTF8, "application/json");
byte[] secret = Encoding.UTF8.GetBytes(TestSecret);
using (var hasher = new HMACSHA256(secret))
{
byte[] data = Encoding.UTF8.GetBytes(TestContent);
byte[] testHash = hasher.ComputeHash(data);
_testSignature = EncodingUtilities.ToHex(testHash);
}
}
示例6: AzureWebHookSenderTests
public AzureWebHookSenderTests()
{
_settings = new SettingsDictionary();
_logger = new Mock<ILogger>().Object;
_storageMock = StorageManagerMock.Create();
_sender = new AzureWebHookSender(_storageMock.Object, _settings, _logger);
}
示例7: TrelloWebHookReceiverTests
public TrelloWebHookReceiverTests()
{
_settings = new SettingsDictionary();
_settings["MS_WebHookReceiverSecret_Trello"] = TestSecret;
_config = HttpConfigurationMock.Create(new Dictionary<Type, object> { { typeof(SettingsDictionary), _settings } });
_context = new HttpRequestContext { Configuration = _config };
_receiverMock = new Mock<TrelloWebHookReceiver> { CallBase = true };
_headRequest = new HttpRequestMessage() { Method = HttpMethod.Head };
_headRequest.SetRequestContext(_context);
_postRequest = new HttpRequestMessage(HttpMethod.Post, TestAddress);
_postRequest.SetRequestContext(_context);
_postRequest.Content = new StringContent(TestContent, Encoding.UTF8, "application/json");
byte[] secret = Encoding.UTF8.GetBytes(TestSecret);
using (var hasher = new HMACSHA1(secret))
{
byte[] data = Encoding.UTF8.GetBytes(TestContent);
byte[] requestUri = Encoding.UTF8.GetBytes(TestAddress);
byte[] combo = new byte[data.Length + requestUri.Length];
Buffer.BlockCopy(data, 0, combo, 0, data.Length);
Buffer.BlockCopy(requestUri, 0, combo, data.Length, requestUri.Length);
byte[] testHash = hasher.ComputeHash(combo);
_signature = EncodingUtilities.ToBase64(testHash, uriSafe: false);
}
}
示例8: NewElement
private XElement NewElement(string name, SettingsDictionary settings) {
var element = new XElement(XmlConvert.EncodeLocalName(name));
foreach(var settingAttribute in _settingsWriter.Map(settings).Attributes()) {
element.Add(settingAttribute);
}
return element;
}
示例9: ContentTypeDefinition
public ContentTypeDefinition(string name, string displayName, IEnumerable<ContentTypePartDefinition> parts, SettingsDictionary settings)
{
Name = name;
DisplayName = displayName;
Parts = parts.ToReadOnlyCollection();
Settings = settings;
}
示例10: InitializeDialog
/// <summary>
/// Call this before ShowDialog to initialise the dialog with entry values to be edited
/// </summary>
/// <param name="BranchLocation">The path to the active branch</param>
/// <param name="Index">The index of the favourite to be edited</param>
/// <param name="LocalSettings">A reference to the local settings object used to persist personal preferences</param>
public void InitializeDialog(string BranchLocation, int Index, SettingsDictionary LocalSettings)
{
BuildConfiguration dbCfg = new BuildConfiguration(BranchLocation, LocalSettings);
string dbms, dbName, port, password, location, version;
bool isBlank;
dbCfg.GetStoredConfiguration(Index, out dbms, out dbName, out port, out password, out isBlank, out location, out version);
cboDBMS.SelectedIndex = BuildConfiguration.GetDBMSIndex(dbms);
txtDBName.Text = dbName;
txtPort.Text = port;
txtPassword.Text = password;
chkBlankPW.Checked = isBlank;
txtLocation.Text = location;
if (String.Compare(dbms, "postgresql", true) == 0)
{
SetPostgreSQLVersionIndex(version);
}
else
{
cboVersion.SelectedIndex = 0;
}
SetEnabledStates();
}
示例11: MainForm
/**************************************************************************************************************************************
*
* Initialisation and GUI state routines
*
* ***********************************************************************************************************************************/
/// <summary>
/// Constructor for the class
/// </summary>
public MainForm()
{
InitializeComponent();
string appVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(Application.ExecutablePath).FileVersion;
_localSettings = new SettingsDictionary(GetDataFilePath(TPaths.Settings), appVersion);
_localSettings.Load();
_externalLinks = new ExternalLinksDictionary(GetDataFilePath(TPaths.ExternalLinks));
_externalLinks.Load();
_externalLinks.PopulateListBox(lstExternalWebLinks);
PopulateCombos();
this.Text = Program.APP_TITLE;
cboCodeGeneration.SelectedIndex = _localSettings.CodeGenerationComboID;
cboCompilation.SelectedIndex = _localSettings.CompilationComboID;
cboMiscellaneous.SelectedIndex = _localSettings.MiscellaneousComboID;
cboDatabase.SelectedIndex = _localSettings.DatabaseComboID;
chkAutoStartServer.Checked = _localSettings.AutoStartServer;
chkAutoStopServer.Checked = _localSettings.AutoStopServer;
chkCheckForUpdatesAtStartup.Checked = _localSettings.AutoCheckForUpdates;
chkMinimizeServer.Checked = _localSettings.MinimiseServerAtStartup;
chkTreatWarningsAsErrors.Checked = _localSettings.TreatWarningsAsErrors;
chkCompileWinform.Checked = _localSettings.CompileWinForm;
chkStartClientAfterGenerateWinform.Checked = _localSettings.StartClientAfterCompileWinForm;
txtBranchLocation.Text = _localSettings.BranchLocation;
txtYAMLPath.Text = _localSettings.YAMLLocation;
txtFlashAfterSeconds.Text = _localSettings.FlashAfterSeconds.ToString();
txtBazaarPath.Text = _localSettings.BazaarPath;
ValidateBazaarPath();
_sequence = ConvertStringToSequenceList(_localSettings.Sequence);
_altSequence = ConvertStringToSequenceList(_localSettings.AltSequence);
ShowSequence(txtSequence, _sequence);
ShowSequence(txtAltSequence, _altSequence);
lblVersion.Text = "Version " + appVersion;
SetBranchDependencies();
GetServerState();
SetEnabledStates();
SetToolTips();
// Check if we were launched using commandline switches
// If so, we execute the instruction, start a timer, which then will close us down.
if (Program.cmdLine.StartServer)
{
linkLabelStartServer_LinkClicked(null, null);
ShutdownTimer.Enabled = true;
}
else if (Program.cmdLine.StopServer)
{
linkLabelStopServer_LinkClicked(null, null);
ShutdownTimer.Enabled = true;
}
}
示例12: GetDiff
public static DiffDictionary<string, string> GetDiff(this SettingsDictionary oldSettings, SettingsDictionary newSettings) {
var dictionary = new DiffDictionary<string, string>();
BuildDiff(dictionary, newSettings, oldSettings);
BuildDiff(dictionary, oldSettings, newSettings);
return dictionary;
}
示例13: BuildConfiguration
public BuildConfiguration(string BranchLocation, SettingsDictionary LocalSettings)
{
_branchLocation = BranchLocation;
_localSettings = LocalSettings;
// We can work out what our favourite configurations are whatever the branch location
_storedDbBuildConfig.Clear();
string s = _localSettings.DbBuildConfigurations;
if (s != String.Empty)
{
string[] sep =
{
"&&"
};
string[] items = s.Split(sep, StringSplitOptions.None);
for (int i = 0; i < items.Length; i++)
{
_storedDbBuildConfig.Add(items[i]);
}
}
// Now we read the content of our working (current) config. For that we need a valid branch location
if (_branchLocation == String.Empty)
{
return;
}
_DBMSType = DefaultString;
_DBName = DefaultString;
_password = DefaultString;
_port = DefaultString;
_target = DefaultString;
_version = DefaultString;
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(BranchLocation + @"\OpenPetra.build.config");
_DBMSType = GetPropertyValue(xmlDoc, "DBMS.Type");
_DBName = GetPropertyValue(xmlDoc, "DBMS.DBName");
_password = GetPropertyValue(xmlDoc, "DBMS.Password");
_port = GetPropertyValue(xmlDoc, "DBMS.DBPort");
_target = GetPropertyValue(xmlDoc, "DBMS.DBHostOrFile");
if (String.Compare(_DBMSType, "postgresql", true) == 0)
{
_version = GetPropertyValue(xmlDoc, "PostgreSQL.Version");
}
// Save the current configuration as a favourite
SaveCurrentConfig();
}
catch (Exception)
{
}
}
示例14: AzureWebHookStore
/// <summary>
/// Initializes a new instance of the <see cref="AzureWebHookStore"/> class with the given <paramref name="manager"/>,
/// <paramref name="settings"/>, <paramref name="protector"/>, and <paramref name="logger"/>.
/// Using this constructor, the data will be encrypted using the provided <paramref name="protector"/>.
/// </summary>
public AzureWebHookStore(IStorageManager manager, SettingsDictionary settings, IDataProtector protector, ILogger logger)
: this(manager, settings, logger)
{
if (protector == null)
{
throw new ArgumentNullException(nameof(protector));
}
_protector = protector;
}
示例15: UpdateSettings
protected void UpdateSettings(FieldSettings model, SettingsDictionary settingsDictionary, string prefix) {
model.HelpText = model.HelpText ?? string.Empty;
settingsDictionary[prefix + ".HelpText"] = model.HelpText;
settingsDictionary[prefix + ".Required"] = model.Required.ToString();
settingsDictionary[prefix + ".ReadOnly"] = model.ReadOnly.ToString();
settingsDictionary[prefix + ".AlwaysInLayout"] = model.AlwaysInLayout.ToString();
settingsDictionary[prefix + ".IsSystemField"] = model.IsSystemField.ToString();
settingsDictionary[prefix + ".IsAudit"] = model.IsAudit.ToString();
}