internal static object DecodeFolderFlags(object extendedFolderFlagsInternalPropertyValue)
 {
     if (extendedFolderFlagsInternalPropertyValue is byte[])
     {
         ExtendedFolderFlagsProperty.ParsedFlags parsedFlags = new ExtendedFolderFlagsProperty.ParsedFlags();
         using (ParticipantEntryId.Reader reader = new ParticipantEntryId.Reader((byte[])extendedFolderFlagsInternalPropertyValue))
         {
             while (!reader.IsEnd)
             {
                 byte key = reader.ReadByte();
                 if (!reader.IsEnd)
                 {
                     byte b = reader.ReadByte();
                     if (reader.BytesRemaining >= (int)b)
                     {
                         parsedFlags[(ExtendedFolderFlagsProperty.FlagTag)key] = reader.ReadExactBytes((int)b);
                         continue;
                     }
                 }
                 return(new PropertyError(InternalSchema.ExtendedFolderFlags, PropertyErrorCode.CorruptedData));
             }
         }
         return(parsedFlags);
     }
     return(extendedFolderFlagsInternalPropertyValue);
 }
예제 #2
0
        private static ParticipantEntryId FromEntryId(ParticipantEntryId.WabEntryFlag?wrapperFlags, ParticipantEntryId.Reader reader)
        {
            Guid a = reader.ReadEntryHeader();

            if (a == ParticipantEntryId.OneOffProviderGuid)
            {
                using (ParticipantEntryId.Reader reader2 = reader.TearRest())
                {
                    return(new OneOffParticipantEntryId(reader2));
                }
            }
            if (a == ParticipantEntryId.WabProviderGuid)
            {
                ParticipantEntryId.WabEntryFlag wabEntryFlag = (ParticipantEntryId.WabEntryFlag)reader.ReadByte();
                switch ((byte)(wabEntryFlag & ParticipantEntryId.WabEntryFlag.ObjectTypeMask))
                {
                case 0:
                case 5:
                case 6:
                    break;

                case 1:
                case 2:
                    goto IL_D0;

                case 3:
                case 4:
                    using (ParticipantEntryId.Reader reader3 = reader.TearRest())
                    {
                        return(new StoreParticipantEntryId(wabEntryFlag, reader3));
                    }
                    break;

                default:
                    goto IL_D0;
                }
                if (wrapperFlags != null)
                {
                    throw new CorruptDataException(ServerStrings.ExInvalidParticipantEntryId);
                }
                using (ParticipantEntryId.Reader reader4 = reader.TearRest())
                {
                    return(ParticipantEntryId.FromEntryId(new ParticipantEntryId.WabEntryFlag?(wabEntryFlag), reader4));
                }
IL_D0:
                throw new NotSupportedException(ServerStrings.ExInvalidWABObjectType(wabEntryFlag & ParticipantEntryId.WabEntryFlag.ObjectTypeMask));
            }
            if (a == ParticipantEntryId.ExchangeProviderGuid)
            {
                using (ParticipantEntryId.Reader reader5 = reader.TearRest())
                {
                    return(new ADParticipantEntryId(wrapperFlags, reader5));
                }
            }
            if (a == ParticipantEntryId.OlabProviderGuid)
            {
                using (ParticipantEntryId.Reader reader6 = reader.TearRest())
                {
                    return(new StoreParticipantEntryId(reader6));
                }
            }
            throw new NotSupportedException(ServerStrings.ExUnsupportedABProvider(a.ToString(), string.Empty));
        }