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(); } } } } }
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); } }