// Token: 0x06000604 RID: 1540 RVA: 0x0002E2C8 File Offset: 0x0002C4C8 private bool AreItemsLegallyEqual(ICollection <PropertyDefinition> legalTrackingProperties, Item originalItem, Item currentItem) { using (IEnumerator <PropertyDefinition> enumerator = legalTrackingProperties.GetEnumerator()) { while (enumerator.MoveNext()) { PropertyDefinition legalTrackingProperty = enumerator.Current; object value = originalItem.GetValue(legalTrackingProperty); object value2 = currentItem.GetValue(legalTrackingProperty); if (value != null && value2 != null) { if (!PropertyError.IsPropertyNotFound(value) || !PropertyError.IsPropertyNotFound(value2)) { if (PropertyError.IsPropertyValueTooBig(value) && PropertyError.IsPropertyValueTooBig(value2)) { if (!this.CompareStreams(() => originalItem.GetStream(legalTrackingProperty), () => currentItem.GetStream(legalTrackingProperty))) { this.LogDirtyProperty(currentItem.Id, originalItem.Id, originalItem.ClassName, legalTrackingProperty); return(false); } } else if (!PropertyError.IsPropertyError(value) && !PropertyError.IsPropertyError(value2)) { if (legalTrackingProperty.Type.IsArray) { if (!((Array)value).Compare((Array)value2)) { this.LogDirtyProperty(currentItem.Id, originalItem.Id, originalItem.ClassName, legalTrackingProperty); return(false); } } else if (!value.Equals(value2)) { this.LogDirtyProperty(currentItem.Id, originalItem.Id, originalItem.ClassName, legalTrackingProperty); return(false); } } } } else if (value != null || value2 != null) { this.LogDirtyProperty(currentItem.Id, originalItem.Id, originalItem.ClassName, legalTrackingProperty); return(false); } } } if (originalItem is MessageItem && !this.CompareRecipients(((MessageItem)originalItem).Recipients, ((MessageItem)currentItem).Recipients)) { this.LogDirtyProperty(currentItem.Id, originalItem.Id, originalItem.ClassName, "Recipients"); return(false); } if (!this.CompareAttachments(originalItem.AttachmentCollection, currentItem.AttachmentCollection)) { this.LogDirtyProperty(currentItem.Id, originalItem.Id, originalItem.ClassName, "Attachments"); return(false); } return(true); }
private object TryGetProperty(PropertyDefinition propertyDefinition) { object obj = this.StoreObject.TryGetProperty(propertyDefinition); if (propertyDefinition.Type == typeof(string) && PropertyError.IsPropertyValueTooBig(obj)) { this.AnchorContext.Logger.Log(MigrationEventType.Verbose, "AnchorStoreObject.TryGetProperty: reading {0} as a stream", new object[] { propertyDefinition }); using (Stream stream = this.StoreObject.OpenPropertyStream(propertyDefinition, PropertyOpenMode.ReadOnly)) { if (stream.Length > 131072L) { throw new MigrationDataCorruptionException(string.Format("size of property {0} too large {1}", propertyDefinition, stream.Length)); } int num = (int)stream.Length; byte[] array = new byte[num]; int i = 0; while (i < num) { int num2 = stream.Read(array, i, num - i); i += num2; if (num2 <= 0) { break; } } if (i != num) { throw new MigrationDataCorruptionException(string.Format("size of property {0} inconsistent, expected {1}, found {2}", propertyDefinition, num, i)); } UnicodeEncoding unicodeEncoding = new UnicodeEncoding(false, true, true); try { obj = unicodeEncoding.GetString(array); } catch (ArgumentException innerException) { throw new MigrationDataCorruptionException(string.Format("couldn't decode bytes to utf16 for property {0}", propertyDefinition), innerException); } } } return(obj); }
protected object GetPropertyValue(PropTag tag) { StorePropertyDefinition propertyDefinitionForTag = this.GetPropertyDefinitionForTag(tag); IStorePropertyBag propertyBag = this.PropertyBag; object obj = propertyBag.TryGetProperty(propertyDefinitionForTag); if (obj is PropertyError) { if (!PropertyError.IsPropertyValueTooBig(obj)) { this.TraceError <object, StorePropertyDefinition>("Encountered error {0} while reading value of property {1}", obj, propertyDefinitionForTag); return(null); } obj = RuleUtil.ReadStreamedProperty(propertyBag, propertyDefinitionForTag); } if (obj.GetType().GetTypeInfo().IsEnum) { obj = RuleUtil.ConvertEnumValue(tag, obj); } return(obj); }