Пример #1
0
 internal static ParticipantEntryId FromEntryId(byte[] bytes)
 {
     return(ParticipantEntryId.TranslateExceptions <ParticipantEntryId>(delegate
     {
         ParticipantEntryId result;
         using (ParticipantEntryId.Reader reader = new ParticipantEntryId.Reader(bytes))
         {
             result = ParticipantEntryId.FromEntryId(null, reader);
         }
         return result;
     }));
 }
Пример #2
0
 private static ParticipantEntryId TryFromEntryId(ParticipantEntryId.Reader reader)
 {
     try
     {
         return(ParticipantEntryId.TranslateExceptions <ParticipantEntryId>(() => ParticipantEntryId.FromEntryId(null, reader)));
     }
     catch (NotSupportedException)
     {
     }
     catch (CorruptDataException)
     {
     }
     reader.BaseStream.Position = 0L;
     return(new UnrecognizedParticipantEntryId(reader.ReadBytes(reader.BytesRemaining)));
 }
Пример #3
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));
        }