public static string TryParseStoreEntryIdMailboxDN(byte[] storeEntryId) { Util.ThrowOnNullArgument(storeEntryId, "storeEntryId"); bool flag = false; StoreEntryIdInformation storeEntryIdInformation = StoreEntryId.TryParseStoreEntryId(storeEntryId, out flag); if (!flag) { return(null); } return(storeEntryIdInformation.MailboxLegacyDN); }
internal static StoreEntryIdInformation TryParseStoreEntryId(byte[] storeEntryId, out bool isValid) { isValid = false; if (storeEntryId == null) { return(null); } if (storeEntryId.Length < 30) { return(null); } StoreEntryIdInformation storeEntryIdInformation = null; using (BinaryWriter binaryWriter = new BinaryWriter(new MemoryStream())) { binaryWriter.Write(storeEntryId); using (BinaryReader binaryReader = new BinaryReader(binaryWriter.BaseStream)) { binaryReader.BaseStream.Position = 0L; storeEntryIdInformation = new StoreEntryIdInformation(); byte[] array = binaryReader.ReadBytes(4); for (int i = 0; i < 4; i++) { if (array[i] != 0) { return(null); } } byte[] array2 = binaryReader.ReadBytes(16); if (!ArrayComparer <byte> .Comparer.Equals(array2, StoreEntryId.MuidStoreWrap)) { return(null); } storeEntryIdInformation.WrappedStoreGuid = array2; byte b = binaryReader.ReadByte(); if (b != 0) { return(null); } byte b2 = binaryReader.ReadByte(); if (b2 != 0) { return(null); } byte[] array3 = binaryReader.ReadBytes(14); string @string = CTSGlobals.AsciiEncoding.GetString(array3, 0, array3.Length); if ([email protected]("EMSMDB.DLL")) { return(null); } storeEntryIdInformation.ProviderFileName = @string; storeEntryIdInformation.ProviderFileNameBytes = array3; byte[] array4 = binaryReader.ReadBytes(4); for (int j = 0; j < 4; j++) { if (array4[j] != 0) { return(null); } } byte[] array5 = binaryReader.ReadBytes(16); if (ArrayComparer <byte> .Comparer.Equals(array5, StoreEntryId.PrivateStore)) { storeEntryIdInformation.IsPublic = false; } else { if (!ArrayComparer <byte> .Comparer.Equals(array5, StoreEntryId.PublicStore)) { return(null); } storeEntryIdInformation.IsPublic = true; } storeEntryIdInformation.StoreGuid = array5; uint flagsInt = binaryReader.ReadUInt32(); storeEntryIdInformation.FlagsInt = flagsInt; if ((storeEntryIdInformation.IsPublic && (storeEntryIdInformation.FlagsInt & 6U) == 0U) || (!storeEntryIdInformation.IsPublic && (storeEntryIdInformation.FlagsInt & 12U) == 0U)) { return(null); } storeEntryIdInformation.ServerName = StoreEntryId.ParseStringToTerminator(binaryReader); if (string.IsNullOrEmpty(storeEntryIdInformation.ServerName)) { return(null); } storeEntryIdInformation.MailboxLegacyDN = StoreEntryId.ParseStringToTerminator(binaryReader); if (string.IsNullOrEmpty(storeEntryIdInformation.MailboxLegacyDN)) { return(null); } } } isValid = true; return(storeEntryIdInformation); }