private PropertyTag ReadPropertyTag(out Guid propertySet, out uint?numericId, out string propertyName) { byte[] value = this.ReadBytes(4); PropertyTag result = default(PropertyTag); result.Value = BitConverter.ToUInt32(value, 0); if (result.IsNamedProperty) { byte[] b = this.ReadBytes(16); byte[] array = this.ReadBytes(1); propertySet = new Guid(b); uint num; if (array[0] == 0) { byte[] value2 = this.ReadBytes(4); numericId = new uint?(BitConverter.ToUInt32(value2, 0)); num = (uint)this.extractContext.PstSession.ReadIdFromNamedProp(null, numericId.Value, propertySet, true); propertyName = null; } else { string @string; using (MemoryStream memoryStream = new MemoryStream()) { byte[] array2; do { array2 = this.ReadBytes(2); memoryStream.Write(array2, 0, 2); }while (array2[0] != 0 || array2[1] != 0); memoryStream.Seek(0L, SeekOrigin.Begin); byte[] array3 = new byte[memoryStream.Length - 2L]; memoryStream.Read(array3, 0, array3.Length); @string = Encoding.Unicode.GetString(array3); } num = (uint)this.extractContext.PstSession.ReadIdFromNamedProp(@string, 0U, propertySet, true); propertyName = @string; numericId = null; } result.Value = ((uint)result.Type | num << 16); } else { propertySet = Guid.Empty; numericId = null; propertyName = null; } return(result); }
public override void Extract() { byte[] value = base.StreamExtractor.ReadBytes(4); int num = BitConverter.ToInt32(value, 0); List <List <byte> > list = new List <List <byte> >(num); int sizeOfFixedSizeProperty = PropertyTag.GetSizeOfFixedSizeProperty(base.PropertyTag.Type); for (int i = 0; i < num; i++) { byte[] collection = base.StreamExtractor.ReadBytes(sizeOfFixedSizeProperty); List <byte> item = new List <byte>(collection); list.Add(item); } if (base.PropertyValueProcessor != null) { list = (List <List <byte> >)base.PropertyValueProcessor(list); } if (list != null) { IProperty property = base.PropertyBag.AddProperty(base.PropertyTag.NormalizedValueForPst); property.WriteMultiValueData(list); } }
public void Extract() { using (this.dataStream = new MemoryStream(this.data, false)) { this.ReadStreamHeader(); while (this.dataStream.Position < this.dataStream.Length) { Guid a; uint? num; string a2; PropertyTag propTag = this.ReadPropertyTag(out a, out num, out a2); ushort id = propTag.Id; switch (id) { case 16384: this.extractContext.EnterAttachmentContext(); break; case 16385: this.extractContext.EnterMessageContext(null); break; case 16386: this.extractContext.ExitMessageContext(); break; case 16387: this.extractContext.EnterRecipientContext(); break; case 16388: this.extractContext.ExitRecipientContext(); break; default: if (id != 16398) { if (id != 16406) { FastTransferStreamExtractor.PropertyExtractor propertyExtractor = this.GetPropertyExtractor(propTag); if (this.removeMetadata) { Func <object, object> propertyValueProcessor = null; if (propTag.Value == PropertyTag.Importance.Value) { propertyValueProcessor = delegate(object x) { ((byte[])x)[0] = 1; return(x); }; } else if (propTag.Value == PropertyTag.MessageFlags.Value) { propertyValueProcessor = delegate(object x) { byte[] array = (byte[])x; byte[] array2 = array; int num2 = 0; array2[num2] |= 1; byte[] array3 = array; int num3 = 1; array3[num3] |= 4; return(array); }; } else if (propTag.IsNamedProperty && a == FastTransferStreamExtractor.PublicStringsPropertySet && a2 == "Keywords") { propertyValueProcessor = ((object x) => null); } propertyExtractor.PropertyValueProcessor = propertyValueProcessor; } propertyExtractor.Extract(); } else { this.ReadBytes(4); } } else { this.extractContext.ExitAttachmentContext(); } break; } } } }