Exemplo n.º 1
0
        public static FolderRec Create(StoreSession storageSession, PropValue[] pva)
        {
            byte[]               array      = null;
            byte[]               array2     = null;
            FolderType           folderType = FolderType.Generic;
            string               text       = null;
            DateTime             dateTime   = DateTime.MinValue;
            List <PropValueData> list       = new List <PropValueData>();

            foreach (PropValue native in pva)
            {
                if (!native.IsNull() && !native.IsError())
                {
                    PropTag propTag = native.PropTag;
                    if (propTag <= PropTag.EntryId)
                    {
                        if (propTag == PropTag.ParentEntryId)
                        {
                            array2 = native.GetBytes();
                            goto IL_CD;
                        }
                        if (propTag == PropTag.EntryId)
                        {
                            array = native.GetBytes();
                            goto IL_CD;
                        }
                    }
                    else
                    {
                        if (propTag == PropTag.DisplayName)
                        {
                            text = native.GetString();
                            goto IL_CD;
                        }
                        if (propTag == PropTag.LastModificationTime)
                        {
                            dateTime = native.GetDateTime();
                            goto IL_CD;
                        }
                        if (propTag == PropTag.FolderType)
                        {
                            folderType = (FolderType)native.GetInt();
                            goto IL_CD;
                        }
                    }
                    list.Add(DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(native));
                }
                IL_CD :;
            }
            if (array != null)
            {
                FolderRec folderRec = new FolderRec(array, array2, folderType, text, dateTime, (list.Count > 0) ? list.ToArray() : null);
                if (storageSession != null && folderRec[PropTag.ReplicaList] != null)
                {
                    folderRec.IsGhosted = !CoreFolder.IsContentAvailable(storageSession, CoreFolder.GetContentMailboxInfo(ReplicaListProperty.GetStringArrayFromBytes((byte[])folderRec[PropTag.ReplicaList])));
                }
                return(folderRec);
            }
            return(null);
        }