private static bool TryReadEntry(BinaryReader reader, out ExternalUser user)
 {
     if (reader.ReadUInt32() == ExternalUserCollection.ptagLocalDirectoryEntryId)
     {
         uint num = reader.ReadUInt32();
         MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag();
         int num2 = 0;
         while ((long)num2 < (long)((ulong)num))
         {
             uint   num3 = reader.ReadUInt32();
             object obj  = ExternalUserCollection.ReadPropValue(reader, ((PropTag)num3).ValueType(), reader.ReadUInt32());
             if (obj != null)
             {
                 PropertyTagPropertyDefinition prop = PropertyTagPropertyDefinition.CreateCustom(string.Empty, num3);
                 memoryPropertyBag.PreLoadStoreProperty(prop, obj, (int)num);
             }
             num2++;
         }
         memoryPropertyBag.SetAllPropertiesLoaded();
         IDirectPropertyBag directPropertyBag = memoryPropertyBag;
         if (directPropertyBag.IsLoaded(InternalSchema.MemberSIDLocalDirectory) && directPropertyBag.IsLoaded(InternalSchema.MemberExternalIdLocalDirectory) && directPropertyBag.IsLoaded(InternalSchema.MemberEmailLocalDirectory))
         {
             if (!directPropertyBag.IsLoaded(InternalSchema.MemberName))
             {
                 memoryPropertyBag[InternalSchema.MemberName] = directPropertyBag.GetValue(InternalSchema.MemberEmailLocalDirectory);
             }
             user = new ExternalUser(memoryPropertyBag);
             return(true);
         }
     }
     user = null;
     return(false);
 }
Exemplo n.º 2
0
        private static BlobRecipient ReadRecipient(ExTimeZone timeZone, BinaryReader reader)
        {
            BlobRecipient blobRecipient = null;
            uint          num           = reader.ReadUInt32();

            reader.ReadUInt32();
            if (num > 0U)
            {
                blobRecipient = new BlobRecipient(timeZone);
                for (uint num2 = 0U; num2 < num; num2 += 1U)
                {
                    PropTag propTag;
                    object  value;
                    if (!BlobRecipientParser.ReadPropValue(reader, out propTag, out value))
                    {
                        ExTraceGlobals.StorageTracer.TraceError(0L, "BlobRecipientParser::ReadRecipient. Failed reading property.");
                        return(null);
                    }
                    if (propTag.ValueType() != PropType.Error && !propTag.IsNamedProperty())
                    {
                        try
                        {
                            PropertyTagPropertyDefinition propertyDefinition = PropertyTagPropertyDefinition.CreateCustom(propTag.ToString(), (uint)propTag);
                            blobRecipient[propertyDefinition] = value;
                        }
                        catch (InvalidPropertyTypeException ex)
                        {
                            ExTraceGlobals.StorageTracer.TraceError <PropTag, string>(0L, "BlobRecipientParser::ReadRecipient. Failed creating custom property definition for ptag={0}; exception message={1}", propTag, ex.Message);
                            return(null);
                        }
                    }
                }
            }
            return(blobRecipient);
        }
 public static PropertyTagPropertyDefinition CreateCustom(string displayName, uint propertyTag, params PropertyDefinitionConstraint[] constraints)
 {
     return(PropertyTagPropertyDefinition.CreateCustom(displayName, propertyTag, PropertyFlags.None, constraints));
 }
 public static PropertyTagPropertyDefinition CreateCustom(string displayName, uint propertyTag)
 {
     return(PropertyTagPropertyDefinition.CreateCustom(displayName, propertyTag, PropertyDefinitionConstraint.None));
 }