示例#1
0
        PropTag[] IMailbox.GetIDsFromNames(bool createIfNotExists, NamedPropData[] npda)
        {
            MrsTracer.Provider.Function("StorageMailbox.GetIDsFromNames", new object[0]);
            base.CheckDisposed();
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            List <NamedPropertyDefinition.NamedPropertyKey> list = new List <NamedPropertyDefinition.NamedPropertyKey>(npda.Length);

            PropTag[] array = new PropTag[npda.Length];
            foreach (NamedPropData namedPropData in npda)
            {
                switch (namedPropData.Kind)
                {
                case 0:
                    list.Add(new GuidIdPropertyDefinition.GuidIdKey(namedPropData.Guid, namedPropData.Id));
                    break;

                case 1:
                    list.Add(new GuidNamePropertyDefinition.GuidNameKey(namedPropData.Guid, namedPropData.Name));
                    break;

                default:
                    throw new CorruptNamedPropDataException(namedPropData.Kind.ToString());
                }
            }
            ushort[] idsFromNames;
            using (base.RHTracker.Start())
            {
                idsFromNames = NamedPropConverter.GetIdsFromNames(this.StoreSession, createIfNotExists, list);
            }
            for (int j = 0; j < npda.Length; j++)
            {
                array[j] = (PropTag)(idsFromNames[j] << 16);
            }
            return(array);
        }
示例#2
0
        NamedPropData[] IMailbox.GetNamesFromIDs(PropTag[] pta)
        {
            MrsTracer.Provider.Function("StorageMailbox.GetNamedFromIDs", new object[0]);
            base.CheckDisposed();
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            new List <NamedProp>(pta.Length);
            List <ushort> list = new List <ushort>(pta.Length);

            foreach (PropTag propTag in pta)
            {
                list.Add((ushort)propTag.Id());
            }
            NamedPropertyDefinition.NamedPropertyKey[] namesFromIds;
            using (base.RHTracker.Start())
            {
                namesFromIds = NamedPropConverter.GetNamesFromIds(this.StoreSession, list);
            }
            NamedPropData[] array = new NamedPropData[namesFromIds.Length];
            for (int j = 0; j < namesFromIds.Length; j++)
            {
                array[j] = new NamedPropData();
                if (namesFromIds[j] is GuidNamePropertyDefinition.GuidNameKey)
                {
                    GuidNamePropertyDefinition.GuidNameKey guidNameKey = (GuidNamePropertyDefinition.GuidNameKey)namesFromIds[j];
                    array[j].Kind = 1;
                    array[j].Guid = guidNameKey.PropertyGuid;
                    array[j].Name = guidNameKey.PropertyName;
                }
                else
                {
                    if (!(namesFromIds[j] is GuidIdPropertyDefinition.GuidIdKey))
                    {
                        throw new CorruptNamedPropDataException((namesFromIds[j] == null) ? "null" : namesFromIds[j].GetType().ToString());
                    }
                    GuidIdPropertyDefinition.GuidIdKey guidIdKey = (GuidIdPropertyDefinition.GuidIdKey)namesFromIds[j];
                    array[j].Kind = 0;
                    array[j].Guid = guidIdKey.PropertyGuid;
                    array[j].Id   = guidIdKey.PropertyId;
                }
            }
            return(array);
        }