• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SettingsDictionary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SettingsDictionary的典型用法代码示例。如果您正苦于以下问题:C# SettingsDictionary类的具体用法?C# SettingsDictionary怎么用?C# SettingsDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SettingsDictionary类属于命名空间,在下文中一共展示了SettingsDictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
 }
开发者ID:arpitgold,项目名称:Exceptionless,代码行数:7,代码来源:SettingsResponse.cs


示例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);
        }
开发者ID:Joshzx,项目名称:WebHooks,代码行数:25,代码来源:StripeWebHookReceiverTests.cs


示例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;
        }
开发者ID:Nangal,项目名称:Exceptionless,代码行数:35,代码来源:20_ErrorPlugin.cs


示例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;
        }
开发者ID:Giahim,项目名称:Brochard,代码行数:13,代码来源:ContentDefinitionWriter.cs


示例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);
            }
        }
开发者ID:Joshzx,项目名称:WebHooks,代码行数:25,代码来源:DropboxWebHookReceiverTests.cs


示例6: AzureWebHookSenderTests

 public AzureWebHookSenderTests()
 {
     _settings = new SettingsDictionary();
     _logger = new Mock<ILogger>().Object;
     _storageMock = StorageManagerMock.Create();
     _sender = new AzureWebHookSender(_storageMock.Object, _settings, _logger);
 }
开发者ID:brianweet,项目名称:WebHooks,代码行数:7,代码来源:AzureWebHookSenderTests.cs


示例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);
            }
        }
开发者ID:Joshzx,项目名称:WebHooks,代码行数:29,代码来源:TrelloWebHookReceiverTests.cs


示例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;
 }
开发者ID:juaqaai,项目名称:CompanyGroup,代码行数:7,代码来源:ContentDefinitionWriter.cs


示例9: ContentTypeDefinition

 public ContentTypeDefinition(string name, string displayName, IEnumerable<ContentTypePartDefinition> parts, SettingsDictionary settings)
 {
     Name = name;
     DisplayName = displayName;
     Parts = parts.ToReadOnlyCollection();
     Settings = settings;
 }
开发者ID:Giahim,项目名称:Brochard,代码行数:7,代码来源:ContentTypeDefinition.cs


示例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();
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:32,代码来源:DlgDbBuildConfig.cs


示例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;
            }
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:68,代码来源:MainForm.cs


示例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;
        }
开发者ID:RasterImage,项目名称:Orchard,代码行数:8,代码来源:SettingsDictionaryExtensions.cs


示例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)
            {
            }
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:58,代码来源:BuildConfiguration.cs


示例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;
 }
开发者ID:aspnet,项目名称:WebHooks,代码行数:14,代码来源:AzureWebHookStore.cs


示例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();
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:9,代码来源:FieldEditorEvents.cs


示例16: UpdateFieldSettings

 public override void UpdateFieldSettings(string fieldType, string fieldName, SettingsDictionary settingsDictionary, IUpdateModel updateModel) {
     if (fieldType != "PhoneField") {
         return;
     }
     var model = new PhoneFieldSettings();
     if (updateModel.TryUpdateModel(model, "PhoneFieldSettings", null, null)) {
         UpdateSettings(model, settingsDictionary, "PhoneFieldSettings");
         settingsDictionary["PhoneFieldSettings.DefaultValue"] = model.DefaultValue;
     }
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:10,代码来源:PhoneFieldEditorEvents.cs


示例17: CustomDeleteAction

 public override void CustomDeleteAction(string fieldType, string fieldName, SettingsDictionary settingsDictionary) {
     if (fieldType != "OptionSetField") {
         return;
     }
     var optionSet = _optionSetService.GetOptionSet(int.Parse(settingsDictionary["ReferenceFieldSettings.OptionSetId"]));
     if (optionSet == null) {
         return;
     }
     _optionSetService.DeleteOptionSet(optionSet);
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:10,代码来源:OptionSetFieldEditorEvents.cs


示例18: UpdateFieldSettings

 public override void UpdateFieldSettings(string fieldType, string fieldName, SettingsDictionary settingsDictionary, IUpdateModel updateModel) {
     if (fieldType != "CoeveryTextField") {
         return;
     }
     var model = new CoeveryTextFieldSettings();
     if (updateModel.TryUpdateModel(model, "CoeveryTextFieldSettings", null, null)) {
         UpdateSettings(model, settingsDictionary, "CoeveryTextFieldSettings");
         settingsDictionary["CoeveryTextFieldSettings.MaxLength"] = model.MaxLength.ToString();
         settingsDictionary["CoeveryTextFieldSettings.PlaceHolderText"] = model.PlaceHolderText;
     }
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:11,代码来源:CoeveryTextFieldEditorEvents.cs


示例19: Map

        /// <summary>
        /// Maps a settings dictionary to an XML element.
        /// </summary>
        /// <param name="settingsDictionary">The settings dictionary.</param>
        /// <returns>The XML element.</returns>
        public XElement Map(SettingsDictionary settingsDictionary) {
            if (settingsDictionary == null) {
                return new XElement("settings");
            }

            return new XElement(
                "settings", 
                settingsDictionary
                    .Where(kv => kv.Value != null)
                    .Select(kv => new XAttribute(XmlConvert.EncodeLocalName(kv.Key), kv.Value)));
        }
开发者ID:RasterImage,项目名称:Orchard,代码行数:16,代码来源:SettingsFormatter.cs


示例20: ContentPartDefinitionBuilder

 public ContentPartDefinitionBuilder(ContentPartDefinition existing) {
     if (existing == null) {
         _fields = new List<ContentPartFieldDefinition>();
         _settings = new SettingsDictionary();
     }
     else {
         _name = existing.Name;
         _fields = existing.Fields.ToList();
         _settings = new SettingsDictionary(existing.Settings.ToDictionary(kv => kv.Key, kv => kv.Value));
     }
 }
开发者ID:sjbisch,项目名称:Orchard,代码行数:11,代码来源:ContentPartDefinitionBuilder.cs



注:本文中的SettingsDictionary类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SettingsStorage类代码示例发布时间:2022-05-24
下一篇:
C# Settings类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap