public void CopyConvertedFrameDataToArray(byte[] frameData, ColorImageFormat colorFormat) { using (var ptr = new UnmanagedMemory(frameData.Length)) { ComPointer.CopyConvertedFrameDataToArray((ulong)frameData.Length, ptr.Pointer, (UInt64)colorFormat); Marshal.Copy(ptr.Pointer, frameData, 0, frameData.Length); } }
private void InitFromRawPointer(IntPtr rawObjectPtr, bool addRef) { if (!UnmanagedMemoryHelper.ValidateComObject(rawObjectPtr)) { throw new ArgumentException("Expected COM object, but validation failed."); } _typeLibPointer = ComPointer <ITypeLibInternal> .GetObject(rawObjectPtr, addRef); InitCommon(); }
public void GetJoints(Joint[] joints) { using (var ptr = new UnmanagedMemory(Marshal.SizeOf(typeof(Joint)) * (int)JointType.Count)) { ComPointer.GetJoints((uint)JointType.Count, ptr.Pointer); for (int i = 0; i < joints.Length; i++) { IntPtr p = (IntPtr)(ptr.Pointer.ToInt64() + (Marshal.SizeOf(typeof(Joint)) * i)); joints[i] = (Joint)Marshal.PtrToStructure(p, typeof(Joint)); } } }
public BodyFrame AcquireLatestFrame() { IntPtr ptr = IntPtr.Zero; var hr = ComPointer.AcquireLatestFrame(out ptr); if (hr != 0) { throw new Exception(hr.ToString()); } return(new BodyFrame(ptr)); }
public BodyFrameReader OpenReader() { if (bodyFrameReader == null) { IntPtr ptr = IntPtr.Zero; var hr = ComPointer.OpenReader(out ptr); if (hr != 0) { throw new Exception(hr.ToString()); } bodyFrameReader = new BodyFrameReader(ptr); } return(bodyFrameReader); }
public void GetAndRefreshBodyData(Body[] bodies) { int capacity = IntPtr.Size * 6; IntPtr p = Marshal.AllocHGlobal(capacity); ComPointer.GetAndRefreshBodyData(6, p); Marshal.FreeHGlobal(p); //using ( var ptr = new UnmanagedMemory( IntPtr.Size * 6 ) ) { // IntPtr p = ptr.Pointer; // ComPointer.GetAndRefreshBodyData( 6, out p ); //} //for ( int i = 0; i < bodies.Length; i++ ) { // bodies[i] = new Body( ptr[i] ); //} }
private void InitFromRawPointer(IntPtr rawObjectPtr, bool addRef) { if (!UnmanagedMemoryHelper.ValidateComObject(rawObjectPtr)) { throw new ArgumentException("Expected COM object, but validation failed."); } // We have to restrict interface requests to VBE hosted ITypeInfos due to a bug in their implementation. // See TypeInfoWrapper class XML doc for details. // VBE provides two implementations of ITypeInfo for each component. Both versions have different quirks and limitations. // We use both versions to try to expose a more complete/accurate version of ITypeInfo. _typeInfoPointer = ComPointer <ITypeInfoInternal> .GetObjectViaAggregation(rawObjectPtr, addRef, queryType : false); _typeInfoAlternatePointer = ComPointer <ITypeInfoInternal> .GetObjectViaAggregation(rawObjectPtr, addRef, queryType : true); // safely test whether the provided ITypeInfo is hosted by the VBE, and thus exposes the VBE extensions HasVBEExtensions = ComHelper.DoesComObjPtrSupportInterface <IVBEComponent>(rawObjectPtr); InitCommon(); DetectUserFormClass(); }
public ColorFrameReader OpenReader() { return(new ColorFrameReader(ComPointer.OpenReader())); }
public void Close() { ComPointer.Close(); }
public void Open() { ComPointer.Open(); }
public ColorFrame AcquireLatestFrame() { return(new ColorFrame(ComPointer.AcquireLatestFrame())); }
public TypeInfoVBEExtensions(ITypeInfoWrapper parent, IntPtr tiPtr) { _parent = parent; //_target_IVBEComponent = ComHelper.ComCastViaAggregation<IVBEComponent>(tiPtr); _vbeComponentPointer = ComPointer <IVBEComponent> .GetObjectViaAggregation(tiPtr, false, true); }
public Int64 RelativeTime() { return(ComPointer.get_RelativeTime()); }