示例#1
0
        internal static void ModifySubjectProperty(PropertyBag.BasicPropertyStore item, NativeStorePropertyDefinition property, string value)
        {
            string text  = item.GetValue(InternalSchema.SubjectPrefixInternal) as string;
            string text2 = item.GetValue(InternalSchema.NormalizedSubjectInternal) as string;
            string text3 = item.GetValue(InternalSchema.MapiSubject) as string;

            if (property == InternalSchema.NormalizedSubjectInternal)
            {
                text2 = value;
                if (text3 != null)
                {
                    string text4 = SubjectProperty.ExtractPrefixUsingNormalizedSubject(text3, text2);
                    if (text4 != null)
                    {
                        text = text4;
                    }
                }
                if (text == null)
                {
                    text = string.Empty;
                }
            }
            else if (property == InternalSchema.SubjectPrefixInternal)
            {
                text = value;
                if (text3 != null && text3.StartsWith(text, StringComparison.Ordinal))
                {
                    text2 = text3.Substring(text.Length);
                }
                if (text2 == null)
                {
                    text2 = string.Empty;
                }
            }
            else
            {
                if (property != InternalSchema.MapiSubject)
                {
                    throw new ArgumentException("Not a supported subject property", "property");
                }
                if (!string.IsNullOrEmpty(text) && value.StartsWith(text, StringComparison.Ordinal))
                {
                    text2 = value.Substring(text.Length);
                }
                else if (!string.IsNullOrEmpty(text2))
                {
                    string text5 = SubjectProperty.ExtractPrefixUsingNormalizedSubject(value, text2);
                    if (text5 != null)
                    {
                        text = text5;
                    }
                    else
                    {
                        SubjectProperty.ComputeSubjectPrefix(value, out text, out text2);
                    }
                }
                else
                {
                    SubjectProperty.ComputeSubjectPrefix(value, out text, out text2);
                }
            }
            text3 = text + text2;
            item.SetValueWithFixup(InternalSchema.SubjectPrefixInternal, text);
            item.SetValueWithFixup(InternalSchema.NormalizedSubjectInternal, text2);
            item.SetValueWithFixup(InternalSchema.MapiSubject, text3);
            string itemClass = item.GetValue(InternalSchema.ItemClass) as string;

            if (!ObjectClass.IsPost(itemClass))
            {
                item.SetValueWithFixup(InternalSchema.ConversationTopic, text2);
            }
        }