internal static SafeRpcMemoryHandle MarshalPropValueCollection(ICollection <PropValue> properties) { SafeRpcMemoryHandle safeRpcMemoryHandle = new SafeRpcMemoryHandle(); safeRpcMemoryHandle.Allocate(PropValue.GetBytesToMarshal(properties)); PropValue.MarshalToNative(properties, safeRpcMemoryHandle); return(safeRpcMemoryHandle); }
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); }
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); }
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); }
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); }