internal void RemovePhrase(ContentFilterPhrase phrase) { MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>) this[ContentFilterConfigSchema.EncodedPhrases]; if (multiValuedProperty == null) { multiValuedProperty = new MultiValuedProperty <string>(); } multiValuedProperty.Remove(phrase.Encode()); this[ContentFilterConfigSchema.EncodedPhrases] = multiValuedProperty; }
public void Save(IConfigurable instance) { ContentFilterPhrase contentFilterPhrase = instance as ContentFilterPhrase; ContentFilterConfig contentFilterConfig = this.session.FindSingletonConfigurationObject <ContentFilterConfig>(); if (contentFilterPhrase != null && contentFilterConfig != null) { contentFilterConfig.AddPhrase(contentFilterPhrase); this.session.Save(contentFilterConfig); } }
internal ReadOnlyCollection <ContentFilterPhrase> GetPhrases() { List <ContentFilterPhrase> list = new List <ContentFilterPhrase>(); MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>) this[ContentFilterConfigSchema.EncodedPhrases]; if (multiValuedProperty != null) { foreach (string encoded in multiValuedProperty) { try { list.Add(ContentFilterPhrase.Decode(encoded)); } catch (FormatException) { } } } return(new ReadOnlyCollection <ContentFilterPhrase>(list)); }