示例#1
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            string text  = (string)value;
            string text2 = propertyBag.GetValue(InternalSchema.SubjectPrefixInternal) as string;
            string text3 = propertyBag.GetValue(InternalSchema.NormalizedSubjectInternal) as string;

            if (text2 != null && text3 != null && text == text2 + text3)
            {
                return;
            }
            string propertyValue;
            string text4;

            SubjectProperty.ComputeSubjectPrefix(text, out propertyValue, out text4);
            propertyBag.SetValueWithFixup(InternalSchema.SubjectPrefixInternal, propertyValue);
            propertyBag.SetValueWithFixup(InternalSchema.NormalizedSubjectInternal, text4);
            propertyBag.SetValueWithFixup(InternalSchema.MapiSubject, text);
            if (text4 != text3)
            {
                MessageItem messageItem = propertyBag.Context.StoreObject as MessageItem;
                if (messageItem != null)
                {
                    string itemClass = propertyBag.GetValue(InternalSchema.ItemClass) as string;
                    if (!ObjectClass.IsPost(itemClass))
                    {
                        messageItem.ConversationTopic = text4;
                        if (!string.IsNullOrEmpty(text3))
                        {
                            messageItem.ConversationIndex = ConversationIndex.CreateNew().ToByteArray();
                            if (messageItem.MessageResponseType == MessageResponseType.None)
                            {
                                SubjectProperty.ClearReplyForwardProperties(messageItem);
                                return;
                            }
                        }
                        else if (messageItem.GetValueOrDefault <byte[]>(InternalSchema.ConversationIndex) == null)
                        {
                            messageItem.ConversationIndex = ConversationIndex.CreateNew().ToByteArray();
                        }
                    }
                }
            }
        }