コード例 #1
0
 protected void UpdateSettingInSettingsGroup <T>(ISettingsGroup settingsGroup, string settingName, T settingValue, T defaultValue)
 {
     if (settingsGroup == null)
     {
         return;
     }
     if (settingsGroup.ContainsSetting(settingName))
     {
         settingsGroup.GetSetting <T>(settingName).Value = settingValue;
     }
     else
     {
         if (settingValue == null)
         {
             if ((defaultValue != null))
             {
                 settingsGroup.GetSetting <T>(settingName).Value = default(T);
             }
         }
         else
         if (!settingValue.Equals(defaultValue))
         {
             settingsGroup.GetSetting <T>(settingName).Value = settingValue;
         }
     }
 }
コード例 #2
0
        protected T GetSettingFromSettingsGroup <T>(ISettingsGroup settingsGroup, string settingName, T defaultValue)
        {
            if (settingsGroup.ContainsSetting(settingName))
            {
                return(settingsGroup.GetSetting <T>(settingName).Value);
            }

            return(defaultValue);
        }
コード例 #3
0
 public void PopulateFromSettingsGroup(ISettingsGroup settingsGroup, string listItemSetting)
 {
     SegmentationHint      = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingSegmentionHint, DefaultSegmentationHint);
     TagType               = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingTagType, DefaultTagType);
     StartTagRegexValue    = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingStartTagRegex, _defaultStartTagRegex);
     EndTagRegexValue      = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingEndTagRegex, _defaultEndTagRegex);
     IgnoreCase            = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingIgnoreCase, DefaultIgnoreCase);
     IsContentTranslatable = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingContentTranslatable, DefaultContentTranslatable);
     IsWordStop            = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingWordStop, DefaultWordStop);
     IsSoftBreak           = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingSoftBreak, DefaultSoftBreak);
     CanHide               = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingCanHide, DefaultCanHide);
     TextEquivalent        = GetSettingFromSettingsGroup(settingsGroup, listItemSetting + SettingTextEquivalent, _defaultTextEquivalent);
     if (settingsGroup.ContainsSetting(listItemSetting + SettingFormatting))
     {
         _formatting = new FormattingGroupSettings();
         _formatting.PopulateFromSettingsGroup(settingsGroup, listItemSetting + SettingFormatting);
     }
 }