Exemplo n.º 1
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            if (property.Name == "RolesInOnline")
            {
                OnlineSettings temp = (OnlineSettings)setting;
                temp.RolesInOnline = OnlineSettings.RolesInOnline;
                return(true);
            }
            else if (property.Name == "DefaultOpen")
            {
                OnlineSettings temp = (OnlineSettings)setting;

                string name         = null;
                string checkedValue = _Request.Get("OnlineMemberShow", Method.Post, string.Empty);
                if (checkedValue == "ShowAll")
                {
                    name = "DefaultOpen1";
                }
                else if (checkedValue == "ShowMember")
                {
                    name = "DefaultOpen2";
                }
                if (name != null)
                {
                    temp.DefaultOpen = _Request.Get(name, Method.Post, "").ToLower() == "true";
                }
                return(true);
            }
            else
            {
                return(base.SetSettingItemValue(setting, property));
            }
        }
Exemplo n.º 2
0
        public override void UpgradeFromPrior(SettingBase prior)
        {
            UserSettingInfo21 p = (UserSettingInfo21)prior;

            Header.Notes =
                p.Header.Notes + " :: updated to v" + ClassVersion;

            Data.UnCategorizedValue2 = p.Data.UnCategorizedValue2;
            Data.UnCategorizedValue  = p.Data.UnCategorizedValue;
            Data.GeneralValues.TestB = p.Data.GeneralValues.TestB;
            Data.GeneralValues.TestD = p.Data.GeneralValues.TestD;
            Data.GeneralValues.TestI = p.Data.GeneralValues.TestI;
            Data.GeneralValues.TestS = p.Data.GeneralValues.TestS;
            Data.MainWindow.Height   = p.Data.MainWindow.Height;
            Data.MainWindow.Width    = p.Data.MainWindow.Width;

            for (int i = 0; i < Data.GeneralValues.TestIs.Length; i++)
            {
                Data.GeneralValues.TestIs[i] =
                    p.Data.GeneralValues.TestIs[i];
            }

            p.Data.GeneralValues.TestSs.CopyTo(Data.GeneralValues.TestSs, 0);

            foreach (KeyValuePair <string, TestStruct> kvp in p.Data.TestDictionary3)
            {
                if (Data.TestDictionary3.ContainsKey(kvp.Key))
                {
                    Data.TestDictionary3[kvp.Key] =
                        p.Data.TestDictionary3[kvp.Key];
                }
            }
        }
Exemplo n.º 3
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            if (property.Name == "ViewIPFields")
            {
                SiteSettings   temp       = (SiteSettings)setting;
                MessageDisplay msgDisplay = CreateMessageDisplay("ViewIPFields", "new_ViewIPFields");
                temp.ViewIPFields = new ExceptableSetting.ExceptableItem_Int().GetExceptable("ViewIPFields", msgDisplay);

                if (msgDisplay.HasAnyError())
                {
                    ThrowError <Errors.CustomError>(new Errors.CustomError("", ""));
                    return(false);
                }
                return(true);
            }
            else if (property.Name == "ScopeList")
            {
                SiteSettings temp = (SiteSettings)setting;
                temp.ScopeList = SiteSettings.ScopeList;
                return(true);
            }

            else
            {
                return(base.SetSettingItemValue(setting, property));
            }
        }
Exemplo n.º 4
0
 public SettingNode(SettingBase setting)
 {
     Setting     = setting;
     Text        = Setting.ID();
     ToolTipText = Setting.Info();
     //Checked = true;
 }
Exemplo n.º 5
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            if (property.Name == "EnableDefaultEmoticon" || property.Name == "EnableUserEmoticon")
            {
                property.SetValue(setting, _Request.Get <bool>(property.Name, MaxLabs.WebEngine.Method.Post, false), null);
                return(true);
            }
            else if (property.Name == "SaveMessageDays")
            {
                property.SetValue(setting, _Request.Get <int>("SaveDays", 0), null);
                return(true);
            }
            else if (property.Name == "SaveMessageRows")
            {
                property.SetValue(setting, _Request.Get <int>("SaveRows", 0), null);
                return(true);
            }
            else if (property.Name == "DataClearMode")
            {
                if (_Request.Get <bool>("IsCombin", false))
                {
                    property.SetValue(setting, JobDataClearMode.CombinMode, null);
                    return(true);
                }
            }

            return(base.SetSettingItemValue(setting, property));
        }
Exemplo n.º 6
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            if (property.Name == "IntiveSerialPoint")
            {
                int           value = _Request.Get <int>("IntiveSerialPoint", Method.Post, 0);
                UserPointType type  = _Request.Get <UserPointType>("PointFieldIndex", Method.Post, UserPointType.Point1);
                UserPoint     point = AllSettings.Current.PointSettings.GetUserPoint(type);

                if (point.MaxValue < value)
                {
                    ThrowError(new CustomError("IntiveSerialPoint", "超出" + point.Name + "允许的最大值"));
                    return(false);
                }

                if (value <= 0)
                {
                    ThrowError(new CustomError("IntiveSerialPoint", "所需的积分值不能小于等于0"));
                    return(false);
                }
            }
            if (property.Name == "ShowRegisterInviteInput")
            {
                bool value = _Request.Get <bool>("ShowRegisterInviteInput", Method.Post, true);
                InvitationSettings temp = (InvitationSettings)setting;
                temp.ShowRegisterInviteInput = value;
                return(true);
            }

            return(base.SetSettingItemValue(setting, property));
        }
        public static OptionsRowWrapperBase BuildOptionRow(SimpleDescriptor name, SettingBase setting)
        {
            if (setting is null)
            {
                return(null);
            }

            if (setting is SimpleSetting simple)
            {
                return(new OptionsRowButtonWrapper(name, simple.Set, simple.Get, simple.enabledText, simple.disabledText, simple.EnabledHint,
                                                   simple.DisabledHint, simple.WarnPlayersAboutChanging, simple.SettingEnabled));
            }
            else if (setting is SimpleNullableSetting sn)
            {
                return(new OptionsRowButtonWrapper(name, sn.Set, sn.Get, sn.enabledText, sn.disabledText, sn.unsetText, sn.EnabledHint,
                                                   sn.DisabledHint, sn.UnsetHint, sn.WarnPlayersAboutChanging, sn.SettingEnabled));
            }
            else if (setting is AdvancedSetting advanced)
            {
                return(new OptionsRowSliderWrapper(name, advanced.availableOptions, advanced.SelectedSettingText, advanced.SelectedSettingHint, advanced.Get, advanced.Set,
                                                   advanced.WarnPlayersAboutChanging, advanced.SettingEnabled));
            }
            else if (setting is AdvancedNullableSetting an)
            {
                return(new OptionsRowSliderWrapper(name, an.availableOptions, an.SelectedSettingText, an.SelectedSettingHint, an.Get, an.Set,
                                                   an.WarnPlayersAboutChanging, an.SettingEnabled));
            }
            else
            {
                throw new NotSupportedException("This derived type is not (currently) supported. You should never see this.");
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Saves the settings.
        /// </summary>
        /// <param name="currentSettings">The current settings.</param>
        public static void SaveSettings(SettingBase currentSettings)
        {
            var serializer = new XmlSerializer(typeof(List <SettingBase>));
            var textreader = new StreamWriter(Path.Combine(Application.StartupPath, "Settings.xml"));

            serializer.Serialize(textreader, currentSettings);
            textreader.Close();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Loads the settings.
        /// </summary>
        /// <param name="currentSettings">
        /// The current settings.
        /// </param>
        /// <returns>
        /// The load settings.
        /// </returns>
        public static SettingBase LoadSettings(SettingBase currentSettings)
        {
            var serializer = new XmlSerializer(typeof(List <SettingBase>));
            var textreader = new StreamReader(Path.Combine(Application.StartupPath, "Settings.xml"));

            var settings = (SettingBase)serializer.Deserialize(textreader);

            textreader.Close();

            return(settings);
        }
Exemplo n.º 10
0
 public override void SaveSettings(SettingBase settings)
 {
     if (settings.Serializable)
     {
         SaveSerializableSettings(settings);
     }
     else
     {
         SaveUnSerializableSettings(settings);
     }
 }
Exemplo n.º 11
0
        public static bool DeepEquals(SettingBase setting1, SettingBase setting2)
        {
            if (setting1 is SettingSection)
            {
                return(Section_DeepEquals(setting1 as SettingSection, setting2 as SettingSection));
            }
            else if (setting1 is AddItem)
            {
                return(AddItem_DeepEquals(setting1 as AddItem, setting2 as AddItem));
            }
            else if (setting1 is CredentialsItem)
            {
                return(CredentialsItem_DeepEquals(setting1 as CredentialsItem, setting2 as CredentialsItem));
            }
            else if (setting1 is UnknownItem)
            {
                return(UnkownItem_DeepEquals(setting1 as UnknownItem, setting2 as UnknownItem));
            }
            else if (setting1 is ClearItem clear1)
            {
                return(clear1.Equals(setting2 as ClearItem));
            }
            else if (setting1 is SettingText text1)
            {
                return(text1.Equals(setting2 as SettingText));
            }
            else if (setting1 is RepositoryItem)
            {
                return(RepositoryItem_DeepEquals(setting1 as RepositoryItem, setting2 as RepositoryItem));
            }
            else if (setting1 is AuthorItem)
            {
                return(AuthorItem_DeepEquals(setting1 as AuthorItem, setting2 as AuthorItem));
            }
            else if (setting1 is OwnersItem)
            {
                return(OwnersItem_DeepEquals(setting1 as OwnersItem, setting2 as OwnersItem));
            }
            else if (setting1 is CertificateItem)
            {
                return(CertificateItem_DeepEquals(setting1 as CertificateItem, setting2 as CertificateItem));
            }
            else if (setting1 is StoreClientCertItem)
            {
                return(StoreClientCertItem_DeepEquals(setting1 as StoreClientCertItem, setting2 as StoreClientCertItem));
            }
            else if (setting1 is FileClientCertItem)
            {
                return(FileClientCertItem_DeepEquals(setting1 as FileClientCertItem, setting2 as FileClientCertItem));
            }

            return(false);
        }
Exemplo n.º 12
0
        //On End Edit funcion for New setting values
        public void SubmitValue()
        {
            bool success = false;

            switch (currentState)
            {
            case UIState.EnterValue:
            {
                string newValue = valueField.text;

                //Abort if the name is bad
                if (string.IsNullOrEmpty(newValue))
                {
                    Debug.Log("Tried to submit an empty value");
                    CancelAction();
                    return;
                }

                //Use newValue
                if (currentlyEditingValue.TryValue(ref newValue))
                {
                    success = true;
                }
                else
                {
                    //Update codefield text
                    valueField.text = newValue;

                    //Highlight codefield
                    EventSystem.current.SetSelectedGameObject(valueField.gameObject, null);
                    valueField.OnPointerClick(new PointerEventData(EventSystem.current));
                }
            }
            break;

            case UIState.SelectValue:
                currentlyEditingValue.SetValueFromDropdown(valueDropdown.value);
                success = true;
                break;

            case UIState.SettingsMenu:
            default:
                Debug.LogError($"Unexpected UIState: {currentState}");
                return;
            }

            if (success)
            {
                currentlyEditingValueTitle = "";
                currentlyEditingValue      = null;
                ShowUIState(UIState.SettingsMenu);
            }
        }
Exemplo n.º 13
0
        private void CreateAndLinkButton(SettingBase setting)
        {
            Transform parent;

            parent = settingsWidgetArea.transform;

            setting.CreateSettingWidget(parent, this);

            setting.SettingModifyButton.onClick.AddListener(() => { EditValue(setting); });

            setting.ApplyValuesToButton();
        }
Exemplo n.º 14
0
 protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
 {
     if (property.Name == "ScopeList")
     {
         RegisterSettings temp = (RegisterSettings)setting;
         temp.ScopeList = RegisterSettings.ScopeList;
         return(true);
     }
     else
     {
         return(base.SetSettingItemValue(setting, property));
     }
 }
Exemplo n.º 15
0
 protected override bool SetSettingItemValue(SettingBase setting, PropertyInfo property)
 {
     if (property.Name == "FeedSendItems")
     {
         PrivacySettings temp = (PrivacySettings)setting;
         temp.FeedSendItems = GetFeedSendItems();
         return(true);
     }
     else
     {
         return(base.SetSettingItemValue(setting, property));
     }
 }
Exemplo n.º 16
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            bool enablePassport = _Request.Get <bool>("EnablePassport", Method.Post, false);

            if (enablePassport == false)
            {
                return(true);
            }

            if (property.Name == "ClientID" && registerClient)
            {
                if (newClientID > 0)
                {
                    property.SetValue(setting, newClientID, null);
                    return(true);
                }
                else
                {
                    MsgDisplayForSaveSettings.AddError("注册Passport客户端失败:未知原因!");
                    return(false);
                }
            }
            else if (property.Name == "PassportRoot")
            {
                string address = _Request.Get("passportroot", Method.Post);
                if (string.IsNullOrEmpty(address))
                {
                    ThrowError <CustomError>(new CustomError("passportroot", "请填写Passport服务器地址。"));
                    return(false);
                }
            }
            else if (property.Name == "AccessKey")
            {
                if (registerClient)
                {
                    if (string.IsNullOrEmpty(accessKey) || accessKey.Length < 10)
                    {
                        ThrowError <CustomError>(new CustomError("", "通讯密钥长度不能少于10位"));
                        return(false);
                    }
                    else
                    {
                        property.SetValue(setting, accessKey, null);
                        return(true);
                    }
                }
            }

            return(base.SetSettingItemValue(setting, property));
        }
Exemplo n.º 17
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            if (property.Name == "MinPrice")
            {
                int minPrice = _Request.Get <int>("minprice", Method.Post, 0);
                if (minPrice < 1)
                {
                    ThrowError(new CustomError("minprice", "最低上榜价格不能低于1"));
                    return(false);
                }
            }
            else if (property.Name == "MaxPrice")
            {
                int maxrice = _Request.Get <int>("maxprice", Method.Post, 0);
                if (maxrice < 1)
                {
                    ThrowError(new CustomError("maxprice", "最高上榜价格不能低于1"));
                    return(false);
                }
            }
            else if (property.Name == "IpClickCountInDay")
            {
                int val = _Request.Get <int>("IpClickCountInDay", Method.Post, 0);
                if (val < 0)
                {
                    ThrowError(new CustomError("IpClickCountInDay", "不能小于0"));
                    return(false);
                }
            }
            else if (property.Name == "ClickInterval")
            {
                int interval  = _Request.Get <int>("interval", Method.Post, 0);
                int timeunit  = _Request.Get <int>("timeunit", Method.Post, 1);
                int trueValue = interval * timeunit;

                if (trueValue < 0)
                {
                    ThrowError(new CustomError("ClickInterval", "有效时间间隔不能小于0"));

                    return(false);
                }

                property.SetValue(setting, trueValue, null);

                return(true);
            }

            return(base.SetSettingItemValue(setting, property));
        }
Exemplo n.º 18
0
        public override SettingBase Merge(SettingBase guildSetting)
        {
            SameTypeCheck(guildSetting);
            if (!IsSet)
            {
                return(guildSetting);
            }
            if (!guildSetting.IsSet)
            {
                return(this);
            }
            DictionarySetting <T1, T2> setting = Create(Name, Default, Description);

            setting.SetValue = ((DictionarySetting <T1, T2>)guildSetting).Value.SetItems(Value);
            return(setting);
        }
Exemplo n.º 19
0
        private void SaveSerializableSettings(SettingBase settings)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = @"
IF EXISTS(SELECT * FROM [bx_Settings] WHERE [TypeName] = @TypeName)
	UPDATE [bx_Settings] SET [Value] = @Value WHERE [TypeName] = @TypeName;
ELSE
	INSERT [bx_Settings] ([TypeName], [Value]) VALUES (@TypeName, @Value);"    ;

                query.CreateParameter <string>("@Value", settings.ToString(), SqlDbType.NText);
                query.CreateParameter <string>("@TypeName", settings.GetType().FullName, SqlDbType.NVarChar, 200);

                query.ExecuteNonQuery();
            }
        }
Exemplo n.º 20
0
        public override SettingBase Merge(SettingBase guildSetting)
        {
            SameTypeCheck(guildSetting);
            if (!IsSet)
            {
                return(guildSetting);
            }
            if (!guildSetting.IsSet)
            {
                return(this);
            }
            ListSetting <T> setting = Create(Name, Default, Description);

            setting.SetValue = ((ListSetting <T>)guildSetting).Value.Union(Value);
            return(setting);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Loads All the  settings.
        /// </summary>
        /// <returns>The Settings Class</returns>
        public static SettingBase LoadSettings()
        {
            SettingBase settings = new SettingBase();

            if (File.Exists(Path.Combine(Application.StartupPath, "Settings.xml")))
            {
                var serializer = new XmlSerializer(typeof(SettingBase));
                var textreader = new StreamReader(Path.Combine(Application.StartupPath, "Settings.xml"));

                settings = (SettingBase)serializer.Deserialize(textreader);
                textreader.Close();
            }

            SaveSettings(settings);

            return(settings);
        }
Exemplo n.º 22
0
        public static string GetSettingString(string key)
        {
            if (!nameSettingsMap.ContainsKey(key))
            {
                Debug.LogError($"Requested a setting that doesn't exist: {key}");
                return("");
            }

            SettingBase setting = nameSettingsMap[key];

            if (setting.SettingType != SettingType.String)
            {
                Debug.LogError($"Used the wrong SettingType for setting.\tExpected: {SettingType.String}\tReceived: {setting.SettingType}");
                return("");
            }

            return(((StrSetting)setting).GetInnerValue());
        }
Exemplo n.º 23
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            if (property.Name == "BannedSpiders")
            {
                ShieldSpiderSettings spiderSettings = (ShieldSpiderSettings)setting;
                string bannedSpiderNamesString      = _Request.Get("BannedSpiders", Method.Post);

                string[] bannedSpiders = StringUtil.Split(bannedSpiderNamesString);

                spiderSettings.BannedSpiders.SetBannedSpiders(bannedSpiders);

                return(true);
            }
            else
            {
                return(base.SetSettingItemValue(setting, property));
            }
        }
Exemplo n.º 24
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            MessageDisplay msgDisplay = MsgDisplayForSaveSettings;

            if (property.Name == "DisplaySignature")
            {
                BbsSettings temp = (BbsSettings)setting;
                temp.DisplaySignature = new ExceptableSetting.ExceptableItem_bool().GetExceptable("DisplaySignature", msgDisplay);

                if (msgDisplay.HasAnyError())
                {
                    //ThrowError<Errors.CustomError>(new Errors.CustomError("", ""));
                    return false;
                }
                return true;
            }
            else if (property.Name == "MaxAttachmentCountInDay")
            {
                BbsSettings temp = (BbsSettings)setting;
                temp.MaxAttachmentCountInDay = new ExceptableSetting.ExceptableItem_Int().GetExceptable("MaxAttachmentCountInDay", msgDisplay);

                if (msgDisplay.HasAnyError())
                {
                    //ThrowError<Errors.CustomError>(new Errors.CustomError("", ""));
                    return false;
                }
                return true;
            }
            else if (property.Name == "MaxTotalAttachmentsSizeInDay")
            {
                BbsSettings temp = (BbsSettings)setting;
                temp.MaxTotalAttachmentsSizeInDay = new ExceptableSetting.ExceptableItem_FileSize().GetExceptable("MaxTotalAttachmentsSizeInDay", msgDisplay);

                if (msgDisplay.HasAnyError())
                {
                    //ThrowError<Errors.CustomError>(new Errors.CustomError("", ""));
                    return false;
                }
                return true;
            }
            else
                return base.SetSettingItemValue(setting, property);
        }
Exemplo n.º 25
0
        private void EditValue(SettingBase editSetting)
        {
            UIState requestedState = editSetting.EditButtonPressed();

            switch (requestedState)
            {
            case UIState.SettingsMenu:
                //Do nothing special
                break;

            case UIState.EnterValue:
                currentlyEditingValue      = editSetting;
                currentlyEditingValueTitle = editSetting.label;

                valueField.text = editSetting.GetValue();

                //Set Focus
                EventSystem.current.SetSelectedGameObject(valueField.gameObject, null);
                valueField.OnPointerClick(new PointerEventData(EventSystem.current));
                break;

            case UIState.SelectValue:
                currentlyEditingValue = editSetting;

                valueDropdown.ClearOptions();
                valueDropdown.AddOptions(editSetting.GetValueList());
                valueDropdown.value = ((IntSetting)editSetting).GetCurrentValue();
                valueDropdown.RefreshShownValue();
                break;

            default:
                break;
            }

            ShowUIState(requestedState);

            if (requestedState == UIState.EnterValue)
            {
                //Set Focus
                EventSystem.current.SetSelectedGameObject(valueField.gameObject, null);
                valueField.OnPointerClick(new PointerEventData(EventSystem.current));
            }
        }
Exemplo n.º 26
0
        private bool GetSettingActive(string settingName)
        {
            if (maskedMaskerNameMap.ContainsKey(settingName))
            {
                string maskerName = maskedMaskerNameMap[settingName];

                if (!nameSettingsMap.ContainsKey(maskerName))
                {
                    Debug.LogError($"SettingName not found: {maskerName}");
                    return(true);
                }

                SettingBase masker     = nameSettingsMap[maskerName];
                bool        tierActive = maskedEvaluatorMap[settingName](masker);

                return(tierActive && GetSettingActive(maskerName));
            }

            return(true);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 收集表单数据并给指定设置项设置值
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        protected virtual bool SetSettingItemValue(SettingBase setting, PropertyInfo property)
        {
            string value = _Request.Get(property.Name, Method.All, null, false);

            if (value == null)
            {
                ThrowError(new LostFormItemError(property.Name));
                return(false);
            }
            else
            {
                setting.SetPropertyValue(property, value, false);
                if (HasUnCatchedError)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 28
0
        // upgrade from 2.0 to 2.1
        public override void UpgradeFromPrior(SettingBase prior)
        {
            AppSettingInfo20 p = (AppSettingInfo20)prior;

            Header.Notes =
                p.Header.Notes + " :: updated to v" + ClassVersion;

            Data.AppI   = p.Data.AppI;
            Data.AppB   = p.Data.AppB;
            Data.AppD   = p.Data.AppD;
            Data.AppS   = p.Data.AppS;
            Data.AppI20 = p.Data.AppI20;

            for (int i = 0;
                 i < (Data.AppIs.Length < p.Data.AppIs.Length ? Data.AppIs.Length : p.Data.AppIs.Length);
                 i++)
            {
                Data.AppIs[i] = p.Data.AppIs[i];
            }
        }
Exemplo n.º 29
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            bool result = base.SetSettingItemValue(setting, property);

            if (property.Name == "BannedKeywords")
            {
                ContentKeywordSettings keywordSettings = (ContentKeywordSettings)setting;
                keywordSettings.BannedKeywords.SetValue(SecurityUtil.Base64Decode(keywordSettings.BannedKeywords.GetValue()));
            }
            else if (property.Name == "ReplaceKeywords")
            {
                ContentKeywordSettings keywordSettings = (ContentKeywordSettings)setting;
                keywordSettings.ReplaceKeywords.SetValue(SecurityUtil.Base64Decode(keywordSettings.ReplaceKeywords.GetValue()));
            }
            else if (property.Name == "ApprovedKeywords")
            {
                ContentKeywordSettings keywordSettings = (ContentKeywordSettings)setting;
                keywordSettings.ApprovedKeywords.SetValue(SecurityUtil.Base64Decode(keywordSettings.ApprovedKeywords.GetValue()));
            }
            return(result);
        }
Exemplo n.º 30
0
        public void AddSetting(SettingBase setting)
        {
            if (setting == null)
            {
                return;
            }

            SettingViewModelBase settingViewModel = null;

            if (setting is BoolSetting)
            {
                settingViewModel = new BoolSettingViewModel((BoolSetting)setting);
            }
            else if (setting is DoubleSetting)
            {
                settingViewModel = new DoubleSettingViewModel((DoubleSetting)setting);
            }
            else if (setting is EnumerableSetting)
            {
                settingViewModel = new EnumerableSettingViewModel((EnumerableSetting)setting);
            }
            else if (setting is FloatSetting)
            {
                settingViewModel = new FloatSettingViewModel((FloatSetting)setting);
            }
            else if (setting is IntSetting)
            {
                settingViewModel = new IntSettingViewModel((IntSetting)setting);
            }
            else if (setting is StringSetting)
            {
                settingViewModel = new StringSettingViewModel((StringSetting)setting);
            }
            if (settingViewModel == null)
            {
                return;
            }

            settings.Add(settingViewModel);
        }
 internal void SetSetting(SettingBase Setting)
 {
     switch (Setting.Type)
     {
         case SettingType.Integer:
             ServiceClient.SetIntegerSetting(Setting.Name, ((SettingInteger)Setting).Value, _token);
             break;
         case SettingType.String:
             ServiceClient.SetStringSetting(Setting.Name, ((SettingString)Setting).Value, _token);
             break;
         case SettingType.Boolean:
             ServiceClient.SetBooleanSetting(Setting.Name, ((SettingBoolean)Setting).Value ? "true" : "false", _token);
             break;
         default:
             break;
     }
     UpdateSettings(true);
 }