Beispiel #1
0
        internal static SafeRpcMemoryHandle MarshalPropValueCollection(ICollection <PropValue> properties)
        {
            SafeRpcMemoryHandle safeRpcMemoryHandle = new SafeRpcMemoryHandle();

            safeRpcMemoryHandle.Allocate(PropValue.GetBytesToMarshal(properties));
            PropValue.MarshalToNative(properties, safeRpcMemoryHandle);
            return(safeRpcMemoryHandle);
        }
Beispiel #2
0
        internal static SafeRpcMemoryHandle MarshalRow(PropRow row)
        {
            if (row == null)
            {
                return(null);
            }
            SafeRpcMemoryHandle safeRpcMemoryHandle  = new SafeRpcMemoryHandle();
            SafeRpcMemoryHandle safeRpcMemoryHandle2 = NspiMarshal.MarshalPropValueCollection(row.Properties);

            row.MarshalledPropertiesHandle = safeRpcMemoryHandle2;
            safeRpcMemoryHandle.AddAssociatedHandle(safeRpcMemoryHandle2);
            safeRpcMemoryHandle.Allocate(row.GetBytesToMarshal());
            row.MarshalToNative(safeRpcMemoryHandle);
            return(safeRpcMemoryHandle);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        internal static SafeRpcMemoryHandle MarshalIntList(IList <int> list)
        {
            if (list == null)
            {
                return(null);
            }
            int size = (list.Count + 1) * 4;
            SafeRpcMemoryHandle safeRpcMemoryHandle = new SafeRpcMemoryHandle();

            safeRpcMemoryHandle.Allocate(size);
            int num = 0;

            Marshal.WriteInt32(safeRpcMemoryHandle.DangerousGetHandle(), num, list.Count);
            foreach (int val in list)
            {
                num += 4;
                Marshal.WriteInt32(safeRpcMemoryHandle.DangerousGetHandle(), num, val);
            }
            return(safeRpcMemoryHandle);
        }
Beispiel #5
0
        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);
        }