コード例 #1
0
        // Token: 0x060000C7 RID: 199 RVA: 0x00004E68 File Offset: 0x00003068
        protected override void InternalTaskExecute()
        {
            base.InternalTaskExecute();
            Restriction mapiRestriction = null;

            if (this.restriction != null)
            {
                mapiRestriction = ConvertHelper.ConvertToMapiRestriction(this.restriction);
                if (mapiRestriction == null)
                {
                    throw new NspiException(NspiStatus.TooComplex, "Restriction too complex");
                }
            }
            int[]      midList    = null;
            PropRowSet mapiRowset = null;

            PropTag[] mapiPropTags = ConvertHelper.ConvertToMapiPropTags(this.propertyTags);
            base.NspiContextCallWrapper("GetMatches", () => this.Context.GetMatches(this.NspiState, mapiRestriction, this.maxRows, mapiPropTags, out midList, out mapiRowset));
            if (base.Status == NspiStatus.Success)
            {
                this.returnState  = base.NspiState;
                this.returnMids   = midList;
                this.returnRowset = ConvertHelper.ConvertFromMapiPropRowSet(mapiRowset, MarshalHelper.GetString8CodePage(base.NspiState));
                base.TraceNspiState();
                NspiDispatchTask.NspiTracer.TraceDebug <int>((long)base.ContextHandle, "Rows returned: {0}", (mapiRowset == null) ? 0 : mapiRowset.Rows.Count);
            }
        }
コード例 #2
0
 public ADRawEntry[] Convert(PropRowSet rowset)
 {
     ADRawEntry[] array = new ADRawEntry[rowset.Rows.Count];
     for (int i = 0; i < rowset.Rows.Count; i++)
     {
         array[i] = this.Convert(rowset.Rows[i].Properties);
     }
     return(array);
 }
コード例 #3
0
 internal static PropertyValue[][] ConvertFromMapiPropRowSet(PropRowSet mapiPropRowSet, int codePage)
 {
     PropertyValue[][] array = null;
     if (mapiPropRowSet != null)
     {
         array = new PropertyValue[mapiPropRowSet.Rows.Count][];
         int num = 0;
         foreach (PropRow mapiPropRow in mapiPropRowSet.Rows)
         {
             array[num++] = ConvertHelper.ConvertFromMapiPropRow(mapiPropRow, codePage);
         }
     }
     return(array);
 }
コード例 #4
0
        protected override void InternalTaskExecute()
        {
            base.InternalTaskExecute();
            PropRowSet mapiRowset   = null;
            uint       localVersion = (uint)this.version;

            base.NspiContextCallWrapper("GetHierarchyInfo", () => this.Context.GetHierarchyInfo(this.flags, this.NspiState, ref localVersion, out mapiRowset));
            this.returnVersion = (int)localVersion;
            if (base.Status == NspiStatus.Success)
            {
                this.returnCodePage = base.NspiState.CodePage;
                this.returnRowset   = ConvertHelper.ConvertFromMapiPropRowSet(mapiRowset, this.returnCodePage);
                NspiDispatchTask.NspiTracer.TraceDebug <int>((long)base.ContextHandle, "Rows returned: {0}", (mapiRowset == null) ? 0 : mapiRowset.Rows.Count);
            }
        }
コード例 #5
0
        protected override void InternalTaskExecute()
        {
            base.InternalTaskExecute();
            PropTag[]  mapiPropTags = ConvertHelper.ConvertToMapiPropTags(this.propertyTags);
            PropRowSet mapiRowset   = null;

            base.NspiContextCallWrapper("QueryRows", () => this.Context.QueryRows(this.flags, this.NspiState, this.mids, this.rowCount, mapiPropTags, out mapiRowset));
            if (base.Status == NspiStatus.Success)
            {
                this.returnState  = base.NspiState;
                this.returnRowset = ConvertHelper.ConvertFromMapiPropRowSet(mapiRowset, MarshalHelper.GetString8CodePage(base.NspiState));
                base.TraceNspiState();
                NspiDispatchTask.NspiTracer.TraceDebug <int>((long)base.ContextHandle, "Rows returned: {0}", (mapiRowset == null) ? 0 : mapiRowset.Rows.Count);
            }
        }
コード例 #6
0
ファイル: NspiClient.cs プロジェクト: YHZX2013/exchange_diff
        private static PropRowSet GetRowSetAndDisposeHandle(SafeRpcMemoryHandle rowsetHandle)
        {
            PropRowSet result;

            if (rowsetHandle != null)
            {
                result = new PropRowSet(rowsetHandle, true);
                rowsetHandle.Dispose();
            }
            else
            {
                result = null;
            }
            return(result);
        }
コード例 #7
0
        internal static PropRowSet ConvertToMapiPropRow(PropertyValue[][] propertyRows)
        {
            PropRowSet propRowSet = null;

            if (propertyRows != null)
            {
                propRowSet = new PropRowSet(propertyRows.Length);
                for (int i = 0; i < propertyRows.Length; i++)
                {
                    PropRow row = ConvertHelper.ConvertToMapiPropRow(propertyRows[i]);
                    propRowSet.Add(row);
                }
            }
            return(propRowSet);
        }
コード例 #8
0
        protected override void InternalTaskExecute()
        {
            base.InternalTaskExecute();
            PropRowSet mapiRowset = null;

            int[]     midList      = null;
            PropTag[] mapiPropTags = ConvertHelper.ConvertToMapiPropTags(this.propertyTags);
            base.NspiContextCallWrapper("ResolveNames", () => this.Context.ResolveNames(this.NspiState, mapiPropTags, this.names, out midList, out mapiRowset));
            if (base.Status == NspiStatus.Success)
            {
                this.returnCodePage = base.NspiState.CodePage;
                this.returnMids     = midList;
                this.returnRowset   = ConvertHelper.ConvertFromMapiPropRowSet(mapiRowset, this.returnCodePage);
            }
            NspiDispatchTask.NspiTracer.TraceDebug <int>((long)base.ContextHandle, "Rows returned: {0}", (mapiRowset == null) ? 0 : mapiRowset.Rows.Count);
        }
コード例 #9
0
ファイル: NspiMarshal.cs プロジェクト: YHZX2013/exchange_diff
        internal static SafeRpcMemoryHandle MarshalRowSet(PropRowSet rowset)
        {
            if (rowset == null)
            {
                return(null);
            }
            SafeRpcMemoryHandle safeRpcMemoryHandle = new SafeRpcMemoryHandle();

            foreach (PropRow propRow in rowset.Rows)
            {
                SafeRpcMemoryHandle safeRpcMemoryHandle2 = NspiMarshal.MarshalPropValueCollection(propRow.Properties);
                propRow.MarshalledPropertiesHandle = safeRpcMemoryHandle2;
                safeRpcMemoryHandle.AddAssociatedHandle(safeRpcMemoryHandle2);
            }
            safeRpcMemoryHandle.Allocate(rowset.GetBytesToMarshal());
            rowset.MarshalToNative(safeRpcMemoryHandle);
            return(safeRpcMemoryHandle);
        }
コード例 #10
0
        // Token: 0x06000110 RID: 272 RVA: 0x00005E64 File Offset: 0x00004064
        protected override void InternalTaskExecute()
        {
            base.InternalTaskExecute();
            if (this.target == null)
            {
                NspiDispatchTask.NspiTracer.TraceError((long)base.ContextHandle, "Target is null");
                throw new NspiException(NspiStatus.GeneralFailure, "Target is null");
            }
            PropValue mapiPropValue = ConvertHelper.ConvertToMapiPropValue(this.target.Value);

            PropTag[]  mapiPropTags = ConvertHelper.ConvertToMapiPropTags(this.propertyTags);
            PropRowSet mapiRowset   = null;

            base.NspiContextCallWrapper("SeekEntries", () => this.Context.SeekEntries(this.NspiState, mapiPropValue, this.restriction, mapiPropTags, out mapiRowset));
            if (base.Status == NspiStatus.Success)
            {
                this.returnState  = base.NspiState;
                this.returnRowset = ConvertHelper.ConvertFromMapiPropRowSet(mapiRowset, MarshalHelper.GetString8CodePage(base.NspiState));
                base.TraceNspiState();
                NspiDispatchTask.NspiTracer.TraceDebug <int>((long)base.ContextHandle, "Rows returned: {0}", (mapiRowset == null) ? 0 : mapiRowset.Rows.Count);
            }
        }
コード例 #11
0
ファイル: NspiClient.cs プロジェクト: YHZX2013/exchange_diff
        public NspiStatus SeekEntries(PropValue propValue, int[] mids, IList <PropTag> propTags, out PropRowSet rowset)
        {
            int[]             intArrayFromPropTagArray = NspiClient.GetIntArrayFromPropTagArray(propTags);
            IList <PropValue> list = new List <PropValue>();

            list.Add(propValue);
            NspiStatus result;

            using (SafeRpcMemoryHandle safeRpcMemoryHandle = new SafeRpcMemoryHandle(propValue.GetBytesToMarshal()))
            {
                PropValue.MarshalToNative(list, safeRpcMemoryHandle);
                this.MarshalStatToNative();
                SafeRpcMemoryHandle rowsetHandle;
                NspiStatus          nspiStatus = this.client.SeekEntries(this.statHandle.DangerousGetHandle(), safeRpcMemoryHandle.DangerousGetHandle(), mids, intArrayFromPropTagArray, out rowsetHandle);
                this.MarshalNativeToStat();
                rowset = NspiClient.GetRowSetAndDisposeHandle(rowsetHandle);
                result = nspiStatus;
            }
            return(result);
        }
コード例 #12
0
ファイル: NspiClient.cs プロジェクト: YHZX2013/exchange_diff
        public NspiStatus ResolveNames(byte[][] names, IList <PropTag> propTags, out ResolveResult[] results, out PropRowSet rowset)
        {
            int[] intArrayFromPropTagArray = NspiClient.GetIntArrayFromPropTagArray(propTags);
            this.MarshalStatToNative();
            int[] array;
            SafeRpcMemoryHandle rowsetHandle;
            NspiStatus          result = this.client.ResolveNames(this.statHandle.DangerousGetHandle(), intArrayFromPropTagArray, names, out array, out rowsetHandle);

            this.MarshalNativeToStat();
            rowset = NspiClient.GetRowSetAndDisposeHandle(rowsetHandle);
            if (array != null)
            {
                results = new ResolveResult[array.Length];
                for (int i = 0; i < array.Length; i++)
                {
                    results[i] = (ResolveResult)array[i];
                }
            }
            else
            {
                results = null;
            }
            return(result);
        }
コード例 #13
0
ファイル: NspiClient.cs プロジェクト: YHZX2013/exchange_diff
        public NspiStatus QueryRows(NspiQueryRowsFlags flags, int[] mids, int count, IList <PropTag> propTags, out PropRowSet rowset)
        {
            int[] intArrayFromPropTagArray = NspiClient.GetIntArrayFromPropTagArray(propTags);
            this.MarshalStatToNative();
            SafeRpcMemoryHandle rowsetHandle;
            NspiStatus          result = this.client.QueryRows(flags, this.statHandle.DangerousGetHandle(), mids, count, intArrayFromPropTagArray, out rowsetHandle);

            this.MarshalNativeToStat();
            rowset = NspiClient.GetRowSetAndDisposeHandle(rowsetHandle);
            return(result);
        }
コード例 #14
0
ファイル: NspiClient.cs プロジェクト: YHZX2013/exchange_diff
        public NspiStatus GetMatches(Restriction restriction, object propName, int maxRows, IList <PropTag> propTags, out int[] mids, out PropRowSet rowset)
        {
            NspiStatus result;

            using (SafeRpcMemoryHandle safeRpcMemoryHandle = new SafeRpcMemoryHandle())
            {
                if (restriction != null)
                {
                    safeRpcMemoryHandle.Allocate(restriction.GetBytesToMarshalNspi());
                    restriction.MarshalToNativeNspi(safeRpcMemoryHandle);
                }
                int[] intArrayFromPropTagArray = NspiClient.GetIntArrayFromPropTagArray(propTags);
                this.MarshalStatToNative();
                SafeRpcMemoryHandle rowsetHandle;
                NspiStatus          matches = this.client.GetMatches(this.statHandle.DangerousGetHandle(), safeRpcMemoryHandle.DangerousGetHandle(), IntPtr.Zero, maxRows, intArrayFromPropTagArray, out mids, out rowsetHandle);
                this.MarshalNativeToStat();
                rowset = NspiClient.GetRowSetAndDisposeHandle(rowsetHandle);
                result = matches;
            }
            return(result);
        }
コード例 #15
0
ファイル: NspiClient.cs プロジェクト: YHZX2013/exchange_diff
        public NspiStatus GetHierarchyInfo(NspiGetHierarchyInfoFlags flags, ref uint version, out PropRowSet rowset)
        {
            this.MarshalStatToNative();
            SafeRpcMemoryHandle rowsetHandle;
            NspiStatus          hierarchyInfo = this.client.GetHierarchyInfo(flags, this.statHandle.DangerousGetHandle(), ref version, out rowsetHandle);

            this.MarshalNativeToStat();
            rowset = NspiClient.GetRowSetAndDisposeHandle(rowsetHandle);
            return(hierarchyInfo);
        }
コード例 #16
0
        public ADRawEntry[] GetPropertyBags(int offset, int count)
        {
            if (count < 0)
            {
                throw new ArgumentOutOfRangeException("count");
            }
            if (count == 0)
            {
                return(Array <ADRawEntry> .Empty);
            }
            Encoding        encoding        = Encoding.GetEncoding(this.codePage);
            NspiPropertyMap nspiPropertyMap = NspiPropertyMap.Create(this.properties, encoding);
            PropRowSet      propRowSet      = null;

            try
            {
                using (NspiRpcClientConnection nspiRpcClientConnection = this.session.GetNspiRpcClientConnection())
                {
                    int addressListEphemeralId = NspiVirtualListView.GetAddressListEphemeralId(nspiRpcClientConnection, this.addressListId.ObjectGuid);
                    if (addressListEphemeralId == 0)
                    {
                        return(null);
                    }
                    NspiState nspiState = new NspiState
                    {
                        SortIndex      = SortIndex.DisplayName,
                        ContainerId    = addressListEphemeralId,
                        CurrentRecord  = 0,
                        Delta          = offset,
                        CodePage       = this.codePage,
                        TemplateLocale = this.session.Lcid,
                        SortLocale     = this.session.Lcid
                    };
                    using (SafeRpcMemoryHandle safeRpcMemoryHandle = new SafeRpcMemoryHandle(nspiState.GetBytesToMarshal()))
                    {
                        SafeRpcMemoryHandle safeRpcMemoryHandle2 = null;
                        try
                        {
                            IntPtr intPtr = safeRpcMemoryHandle.DangerousGetHandle();
                            nspiState.MarshalToNative(intPtr);
                            int num = nspiRpcClientConnection.RpcClient.UpdateStat(intPtr);
                            if (num != 0)
                            {
                                throw new NspiFailureException(num);
                            }
                            num = nspiRpcClientConnection.RpcClient.QueryRows(0, intPtr, null, count, nspiPropertyMap.NspiProperties, out safeRpcMemoryHandle2);
                            if (num != 0)
                            {
                                throw new NspiFailureException(num);
                            }
                            nspiState.MarshalFromNative(intPtr);
                            this.currentRow        = nspiState.Position;
                            this.estimatedRowCount = nspiState.TotalRecords;
                            if (safeRpcMemoryHandle2 != null)
                            {
                                propRowSet = new PropRowSet(safeRpcMemoryHandle2, true);
                            }
                        }
                        finally
                        {
                            if (safeRpcMemoryHandle2 != null)
                            {
                                safeRpcMemoryHandle2.Dispose();
                            }
                        }
                    }
                }
            }
            catch (RpcException ex)
            {
                throw new DataSourceOperationException(DirectoryStrings.NspiRpcError(ex.Message), ex);
            }
            if (propRowSet == null)
            {
                return(null);
            }
            return(nspiPropertyMap.Convert(propRowSet));
        }