private static object ReadSysTimeArray(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { byte[] array = parser.ReadPropertyStream(propertyInfo.Tag, propertyInfo.PropertyLength, 0); if (array != null) { int num = propertyInfo.PropertyLength / MsgStorageRulesTable.Int64Size; DateTime[] array2 = new DateTime[num]; int num2 = 0; for (int num3 = 0; num3 != num; num3++) { long fileTime = BitConverter.ToInt64(array, num2); try { array2[num3] = DateTime.FromFileTimeUtc(fileTime); } catch (ArgumentOutOfRangeException) { array2[num3] = DateTime.MinValue; } num2 += MsgStorageRulesTable.Int64Size; } return(array2); } return(null); }
private static byte[] InternalReadLengthList(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo, int size, out int count) { int propertyLength = propertyInfo.PropertyLength; count = propertyLength / size; if (count > 2048) { throw new MsgStorageException(MsgStorageErrorCode.MultivaluedPropertyDimensionTooLarge, MsgStorageStrings.CorruptData); } if (count == 0) { return(Util.EmptyByteArray); } byte[] array = parser.ReadPropertyLengthsStream(propertyInfo.Tag, propertyInfo.PropertyLength); int num = 0; for (int num2 = 0; num2 != count; num2++) { int num3 = BitConverter.ToInt32(array, num); if (num3 > 32768) { throw new MsgStorageException(MsgStorageErrorCode.MultivaluedValueTooLong, MsgStorageStrings.CorruptData); } num += size; } return(array); }
private static object ReadString8(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { byte[] array = parser.ReadPropertyStream(propertyInfo.Tag, propertyInfo.PropertyLength, 1); if (array != null) { return(Util.AnsiBytesToString(array, propertyInfo.PropertyLength, parser.MessageEncoding)); } return(null); }
private static object ReadString(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { byte[] array = parser.ReadPropertyStream(propertyInfo.Tag, propertyInfo.PropertyLength, 2); if (array != null) { return(Util.UnicodeBytesToString(array, propertyInfo.PropertyLength)); } return(null); }
private static object ReadDoubleArray(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { byte[] array = parser.ReadPropertyStream(propertyInfo.Tag, propertyInfo.PropertyLength, 0); if (array != null) { int num = propertyInfo.PropertyLength / MsgStorageRulesTable.DoubleSize; double[] array2 = new double[num]; int num2 = 0; for (int num3 = 0; num3 != num; num3++) { array2[num3] = BitConverter.ToDouble(array, num2); num2 += MsgStorageRulesTable.DoubleSize; } return(array2); } return(null); }
private static object ReadString8Array(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { int stringArrayLengthEntrySize = MsgStorageRulesTable.StringArrayLengthEntrySize; int num; byte[] value = MsgStorageRulesTable.InternalReadLengthList(parser, propertyInfo, stringArrayLengthEntrySize, out num); string[] array = new string[num]; int num2 = 0; for (int num3 = 0; num3 != num; num3++) { int num4 = BitConverter.ToInt32(value, num2); byte[] bytes = parser.ReadPropertyIndexStream(propertyInfo.Tag, num3, num4, 1); array[num3] = Util.AnsiBytesToString(bytes, num4, parser.MessageEncoding); num2 += stringArrayLengthEntrySize; } return(array); }
private static object ReadArrayOfBinary(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { int binaryArrayLengthEntrySize = MsgStorageRulesTable.BinaryArrayLengthEntrySize; int num; byte[] value = MsgStorageRulesTable.InternalReadLengthList(parser, propertyInfo, binaryArrayLengthEntrySize, out num); byte[][] array = new byte[num][]; int num2 = 0; for (int num3 = 0; num3 != num; num3++) { int num4 = BitConverter.ToInt32(value, num2); array[num3] = new byte[num4]; parser.ReadPropertyIndexStream(propertyInfo.Tag, num3, array[num3], num4, 0); num2 += binaryArrayLengthEntrySize; } return(array); }
private static object ReadGuidArray(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { byte[] array = new byte[16]; byte[] array2 = parser.ReadPropertyStream(propertyInfo.Tag, propertyInfo.PropertyLength, 0); if (array2 != null) { int num = propertyInfo.PropertyLength / MsgStorageRulesTable.GuidSize; Guid[] array3 = new Guid[num]; int num2 = 0; for (int num3 = 0; num3 != num; num3++) { Array.Copy(array2, num2, array, 0, 16); array3[num3] = new Guid(array); num2 += MsgStorageRulesTable.GuidSize; } return(array3); } return(null); }
private void OpenSubStorage(string subStorageName, MsgSubStorageType type) { ComStorage comStorage = null; try { comStorage = this.messageStorage.OpenStorage(subStorageName, ComStorage.OpenMode.Read); MsgSubStorageReader msgSubStorageReader = new MsgSubStorageReader(this, comStorage, this.encoding, type); if (this.subStorage != null) { this.subStorage.Dispose(); } this.subStorage = comStorage; this.subStorageParser = msgSubStorageReader; comStorage = null; } finally { if (comStorage != null) { comStorage.Dispose(); } } }
private static object ReadObject(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { throw new NotSupportedException(MsgStorageStrings.UnsupportedPropertyType("[Object]")); }
private static object ReadNull(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { return(null); }
private static object ReadBinary(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { byte[] array = new byte[propertyInfo.PropertyLength]; parser.ReadPropertyStream(propertyInfo.Tag, array, propertyInfo.PropertyLength, 0); return(array); }
private static object ReadGuid(MsgSubStorageReader parser, MsgSubStorageReader.PropertyInfo propertyInfo) { byte[] array = new byte[16]; parser.ReadPropertyStream(propertyInfo.Tag, array, 16, 0); return(new Guid(array)); }