Пример #1
0
 private static void ParseEntryIdStream(Stream dlStream, out ParticipantEntryId[] mainEntryIds, out ParticipantEntryId[] oneOffEntryIds, out byte[][] mainIds, out byte[][] extraBytes, out bool alwaysStream)
 {
     using (BinaryReader binaryReader = new BinaryReader(dlStream, Encoding.Unicode))
     {
         binaryReader.ReadUInt16();
         binaryReader.ReadUInt16();
         binaryReader.ReadInt32();
         int num = binaryReader.ReadInt32();
         alwaysStream = ((num & 1) == 1);
         int num2 = binaryReader.ReadInt32();
         if (num2 > StorageLimits.Instance.DistributionListMaxNumberOfEntries)
         {
             throw new CorruptDataException(ServerStrings.ExPDLCorruptOutlookBlob("TooManyEntries"));
         }
         binaryReader.ReadInt32();
         binaryReader.ReadInt32();
         binaryReader.ReadInt32();
         mainIds = new byte[num2][];
         byte[][] array = new byte[num2][];
         extraBytes = new byte[num2][];
         for (int i = 0; i < num2; i++)
         {
             int num3 = binaryReader.ReadInt32();
             mainIds[i]    = ((num3 > 0) ? binaryReader.ReadBytes(num3) : Array <byte> .Empty);
             num3          = binaryReader.ReadInt32();
             array[i]      = ((num3 > 0) ? binaryReader.ReadBytes(num3) : Array <byte> .Empty);
             num3          = binaryReader.ReadInt32();
             extraBytes[i] = ((num3 > 0) ? binaryReader.ReadBytes(num3) : Array <byte> .Empty);
         }
         mainEntryIds   = DistributionList.ParseEntryIds(mainIds);
         oneOffEntryIds = DistributionList.ParseEntryIds(array);
     }
 }
Пример #2
0
        internal static void GetEntryIds(ICorePropertyBag propertyBag, out ParticipantEntryId[] mainEntryIds, out ParticipantEntryId[] oneOffEntryIds, out byte[][] extraBytes, out uint computedCheckSum, out bool alwaysStream)
        {
            mainEntryIds     = new ParticipantEntryId[0];
            oneOffEntryIds   = new ParticipantEntryId[0];
            extraBytes       = new byte[0][];
            computedCheckSum = 0U;
            alwaysStream     = false;
            PropertyError propertyError = propertyBag.TryGetProperty(DistributionListSchema.DLStream) as PropertyError;

            if (propertyError == null || PropertyError.IsPropertyValueTooBig(propertyError))
            {
                long num = -1L;
                try
                {
                    using (Stream stream = propertyBag.OpenPropertyStream(DistributionListSchema.DLStream, PropertyOpenMode.ReadOnly))
                    {
                        if (stream != null && stream.Length > 0L)
                        {
                            num = stream.Length;
                            byte[][] memberIds;
                            DistributionList.ParseEntryIdStream(stream, out mainEntryIds, out oneOffEntryIds, out memberIds, out extraBytes, out alwaysStream);
                            computedCheckSum = DistributionList.ComputeChecksum(memberIds);
                            return;
                        }
                        ExTraceGlobals.StorageTracer.TraceWarning <string>(0L, "DistributionList::GetEntryIds. DLStream property is {0}.", (stream == null) ? "null" : "empty");
                    }
                }
                catch (EndOfStreamException innerException)
                {
                    string          arg     = (propertyError == null) ? "<null>" : propertyError.ToLocalizedString();
                    LocalizedString message = ServerStrings.ExPDLCorruptOutlookBlob(string.Format("EndOfStreamException: propertyError={0}, streamLength={1}", arg, num.ToString()));
                    throw new CorruptDataException(message, innerException);
                }
                catch (OutOfMemoryException innerException2)
                {
                    throw new CorruptDataException(ServerStrings.ExPDLCorruptOutlookBlob("OutOfMemoryException"), innerException2);
                }
            }
            mainEntryIds     = DistributionList.ParseEntryIds(propertyBag.GetValueOrDefault <byte[][]>(DistributionListSchema.Members, DistributionList.EmptyEntryIds));
            oneOffEntryIds   = DistributionList.ParseEntryIds(propertyBag.GetValueOrDefault <byte[][]>(DistributionListSchema.OneOffMembers, DistributionList.EmptyEntryIds));
            extraBytes       = new byte[mainEntryIds.Length][];
            computedCheckSum = DistributionList.ComputeChecksum(propertyBag.GetValueOrDefault <byte[][]>(DistributionListSchema.Members, DistributionList.EmptyEntryIds));
        }