Exemplo n.º 1
0
        private static void ParseSingleLineProperties(string text, TopicPropertyCollection properties)
        {
            Regex propertyPattern = new Regex(c_propertyPattern, RegexOptions.Multiline);

            foreach (Match match in propertyPattern.Matches(text))
            {
                string name = match.Groups["name"].Value;
                string rawValue = match.Groups["val"].Value.Trim();

                TopicProperty topicProperty = null;
                if (!properties.Contains(name))
                {
                    topicProperty = new TopicProperty(name);
                    properties.Add(topicProperty);
                }
                else
                {
                    topicProperty = properties[name];
                }

                TopicPropertyValue value = new TopicPropertyValue(rawValue);

                topicProperty.Values.Add(value);

            }
        }
Exemplo n.º 2
0
        public void SetWomCache(UnqualifiedTopicRevision revision, string wom)
        {
            if (!HasPermission(new UnqualifiedTopicName(revision.LocalName), TopicPermission.Read))
            {
                return;
            }
            ParsedTopic parsedTopic = ContentProviderChain.GetParsedTopic(revision);

            if (parsedTopic == null)
            {
                return;
            }
            TopicPropertyValue topicPropertyValue = new TopicPropertyValue(wom);
            parsedTopic.Properties["_Wom"].Values.Clear();
            parsedTopic.Properties["_Wom"].Values.Add(topicPropertyValue);
        }
Exemplo n.º 3
0
        private void AddBuiltInProperty(ParsedTopic parsedTopic, string propertyName, string value)
        {
            // The built-in topics show up as the last value if the property already exists.
            // This should be reasonably back-compatible, as the last value wins when people
            // don't remember that properties can have multiple values.
            TopicProperty property = null;
            if (parsedTopic.Properties.Contains(propertyName))
            {
                property = parsedTopic.Properties[propertyName];
            }
            else
            {
                property = new TopicProperty(propertyName);
                parsedTopic.Properties.Add(property);
            }

            TopicPropertyValue topicPropertyValue = new TopicPropertyValue(value);
            property.Values.Add(topicPropertyValue);
        }
Exemplo n.º 4
0
        public void SetProcessTextSize(UnqualifiedTopicRevision revision, int size)
        {
            if (!HasPermission(new UnqualifiedTopicName(revision.LocalName), TopicPermission.Read))
            {
                return;
            }
            ParsedTopic parsedTopic = ContentProviderChain.GetParsedTopic(revision);

            if (parsedTopic == null)
            {
                return;
            }
            TopicPropertyValue topicPropertyValue = new TopicPropertyValue(size.ToString());
            parsedTopic.Properties["_ProcessTextSize"].Values.Clear();
            parsedTopic.Properties["_ProcessTextSize"].Values.Add(topicPropertyValue);
        }