Exemple #1
0
        public License[] EnumerateLicenses()
        {
            IntPtr pArray;
            uint   size;
            int    status = SafeNativeMethods.xnEnumerateLicenses(this.InternalObject, out pArray, out size);

            WrapperUtils.ThrowOnError(status);

            License[] result = null;

            try
            {
                result = new License[size];
                IntPtr ptr = pArray;

                for (int i = 0; i < size; ++i)
                {
                    result[i] = (License)Marshal.PtrToStructure(ptr, typeof(License));
                    ptr       = (IntPtr)(ptr.ToInt64() + Marshal.SizeOf(typeof(License)));
                }
            }
            finally
            {
                SafeNativeMethods.xnFreeLicensesList(pArray);
            }

            return(result);
        }
Exemple #2
0
        public void AddNodeFromList(IEnumerator <NodeInfo> current)
        {
            NodeInfoListEnumerator enumer = (NodeInfoListEnumerator)current;
            int status = SafeNativeMethods.xnNodeInfoListAddNodeFromList(this.InternalObject, enumer.InternalObject);

            WrapperUtils.ThrowOnError(status);
        }
Exemple #3
0
        public void Remove(IEnumerator <NodeInfo> location)
        {
            NodeInfoListEnumerator enumer = (NodeInfoListEnumerator)location;
            int status = SafeNativeMethods.xnNodeInfoListRemove(this.InternalObject, enumer.InternalObject);

            WrapperUtils.ThrowOnError(status);
        }
Exemple #4
0
        private Context(IntPtr pContext, bool addRef) :
            base(pContext)
        {
            this.errorStateChangedHandler = this.ErrorStateChangedCallback;
            this.nodeCreationHandler      = this.NodeCreationCallback;
            this.nodeDestructionHandler   = this.NodeDestructionCallback;

            lock (Context.staticLock)
            {
                if (Context.allContexts.ContainsKey(pContext))
                {
                    throw new GeneralException("C# wrapper: creating a Context object wrapping an already wrapped object!");
                }
                Context.allContexts.Add(pContext, this);
            }

            if (addRef)
            {
                WrapperUtils.ThrowOnError(SafeNativeMethods.xnContextAddRef(pContext));
            }

            this.shutdownHandler = OnContextShuttingDown;

            WrapperUtils.ThrowOnError(SafeNativeMethods.xnContextRegisterForShutdown(pContext, this.shutdownHandler, IntPtr.Zero, out this.shutdownCallbackHandle));
        }
Exemple #5
0
        public void Add(ProductionNodeDescription description, string creationInfo, NodeInfoList neededNodes)
        {
            int status = SafeNativeMethods.xnNodeInfoListAdd(this.InternalObject, description, creationInfo,
                                                             neededNodes == null ? IntPtr.Zero : neededNodes.InternalObject);

            WrapperUtils.ThrowOnError(status);
        }
Exemple #6
0
        public void OpenFileRecording(string fileName)
        {
            this.usingDeprecatedAPI = true;
            int status = SafeNativeMethods.xnContextOpenFileRecording(this.InternalObject, fileName);

            WrapperUtils.ThrowOnError(status);
        }
Exemple #7
0
        public Point3D GetCoM(UserID id)
        {
            Point3D com    = new Point3D();
            int     status = SafeNativeMethods.xnGetUserCoM(this.InternalObject, id, out com);

            WrapperUtils.ThrowOnError(status);
            return(com);
        }
Exemple #8
0
        private static IntPtr Create(Context context, CodecID codecID, ProductionNode initializer)
        {
            IntPtr nodeHandle;
            int    status = SafeNativeMethods.xnCreateCodec(context.InternalObject, codecID.InternalValue, initializer.InternalObject, out nodeHandle);

            WrapperUtils.ThrowOnError(status);
            return(nodeHandle);
        }
Exemple #9
0
        public int DecodeData(IntPtr source, int sourceSize, IntPtr destination, int destinationSize)
        {
            UInt32 written;
            int    status = SafeNativeMethods.xnDecodeData(this.InternalObject, source, (UInt32)sourceSize, destination, (UInt32)destinationSize, out written);

            WrapperUtils.ThrowOnError(status);
            return((int)written);
        }
        private static IntPtr Create()
        {
            IntPtr pErrors;
            int    status = SafeNativeMethods.xnEnumerationErrorsAllocate(out pErrors);

            WrapperUtils.ThrowOnError(status);
            return(pErrors);
        }
Exemple #11
0
        public ProductionNode GetProductionNodeByName(string name)
        {
            IntPtr nodeHandle;
            int    status = SafeNativeMethods.xnGetNodeHandleByName(this.InternalObject, name, out nodeHandle);

            WrapperUtils.ThrowOnError(status);
            return(CreateProductionNodeObject(nodeHandle));
        }
Exemple #12
0
        private static IntPtr Create(Context context, string format)
        {
            IntPtr nodeHandle;
            int    status = SafeNativeMethods.xnCreateScriptNode(context.InternalObject, format, out nodeHandle);

            WrapperUtils.ThrowOnError(status);
            return(nodeHandle);
        }
        public Int32 GetNumFrames(string nodeName)
        {
            UInt32 frames;
            int    status = SafeNativeMethods.xnGetPlayerNumFrames(this.InternalObject, nodeName, out frames);

            WrapperUtils.ThrowOnError(status);
            return((Int32)frames);
        }
Exemple #14
0
        public Int64 GetIntProperty(string propName)
        {
            UInt64 value;
            int    status = SafeNativeMethods.xnGetIntProperty(this.InternalObject, propName, out value);

            WrapperUtils.ThrowOnError(status);
            return((Int64)value);
        }
Exemple #15
0
        public ProductionNode OpenFileRecordingEx(string fileName)
        {
            IntPtr hPlayer;
            int    status = SafeNativeMethods.xnContextOpenFileRecordingEx(this.InternalObject, fileName, out hPlayer);

            WrapperUtils.ThrowOnError(status);
            return(new Player(this, hPlayer, false));
        }
Exemple #16
0
        public BoundingBox3D GetPosition(int index)
        {
            BoundingBox3D pos    = new BoundingBox3D();
            int           status = SafeNativeMethods.xnGetUserPosition(this.InternalObject, (uint)index, ref pos);

            WrapperUtils.ThrowOnError(status);
            return(pos);
        }
Exemple #17
0
        public Point3D[] ConvertRealWorldToProjective(Point3D[] realWorldPoints)
        {
            Point3D[] projective = new Point3D[realWorldPoints.Length];
            int       status     = SafeNativeMethods.xnConvertRealWorldToProjective(this.InternalObject, (uint)realWorldPoints.Length, realWorldPoints, projective);

            WrapperUtils.ThrowOnError(status);
            return(projective);
        }
Exemple #18
0
        public Point3D[] ConvertProjectiveToRealWorld(Point3D[] projectivePoints)
        {
            Point3D[] realWorld = new Point3D[projectivePoints.Length];
            int       status    = SafeNativeMethods.xnConvertProjectiveToRealWorld(this.InternalObject, (uint)projectivePoints.Length, projectivePoints, realWorld);

            WrapperUtils.ThrowOnError(status);
            return(realWorld);
        }
Exemple #19
0
        public LockHandle LockForChanges()
        {
            int handle;
            int status = SafeNativeMethods.xnLockNodeForChanges(this.InternalObject, out handle);

            WrapperUtils.ThrowOnError(status);
            return(new LockHandle(handle));
        }
Exemple #20
0
        public double GetRealProperty(string propName)
        {
            double value;
            int    status = SafeNativeMethods.xnGetRealProperty(this.InternalObject, propName, out value);

            WrapperUtils.ThrowOnError(status);
            return(value);
        }
        public Int64 TellTimestamp()
        {
            UInt64 timestamp;
            int    status = SafeNativeMethods.xnTellPlayerTimestamp(this.InternalObject, out timestamp);

            WrapperUtils.ThrowOnError(status);
            return((Int64)timestamp);
        }
Exemple #22
0
        public ProductionNode OpenFileRecordingEx(string fileName)
        {
            IntPtr hScriptNode;
            int    status = SafeNativeMethods.xnContextOpenFileRecordingEx(this.InternalObject, fileName, out hScriptNode);

            WrapperUtils.ThrowOnError(status);
            return(CreateProductionNodeFromNative(hScriptNode));
        }
Exemple #23
0
        public SkeletonJointOrientation GetSkeletonJointOrientation(UserID user, SkeletonJoint joint)
        {
            SkeletonJointOrientation orientation = new SkeletonJointOrientation();
            int status = SafeNativeMethods.xnGetSkeletonJointOrientation(this.InternalObject, user, joint, ref orientation);

            WrapperUtils.ThrowOnError(status);
            return(orientation);
        }
Exemple #24
0
        public ProductionNode CreateProductionTree(NodeInfo nodeInfo)
        {
            IntPtr nodeHandle;
            int    status = SafeNativeMethods.xnCreateProductionTree(this.InternalObject, nodeInfo.InternalObject, out nodeHandle);

            WrapperUtils.ThrowOnError(status);
            return(CreateProductionNodeObject(nodeHandle, nodeInfo.Description.Type));
        }
        public Int32 TellFrame(string nodeName)
        {
            UInt32 frame;
            int    status = SafeNativeMethods.xnTellPlayerFrame(this.InternalObject, nodeName, out frame);

            WrapperUtils.ThrowOnError(status);
            return((Int32)frame);
        }
Exemple #26
0
        public NodeInfoList EnumerateExistingNodes(NodeType type)
        {
            IntPtr pList;
            int    status = SafeNativeMethods.xnEnumerateExistingNodesByType(this.InternalObject, type, out pList);

            WrapperUtils.ThrowOnError(status);
            return(new NodeInfoList(pList));
        }
        static private IntPtr Create()
        {
            IntPtr pQuery;
            int    status = SafeNativeMethods.xnNodeQueryAllocate(out pQuery);

            WrapperUtils.ThrowOnError(status);
            return(pQuery);
        }
Exemple #28
0
        private static IntPtr Init()
        {
            IntPtr pContext;
            int    status = SafeNativeMethods.xnInit(out pContext);

            WrapperUtils.ThrowOnError(status);
            return(pContext);
        }
        private static IntPtr Create(Context context, string name)
        {
            IntPtr handle;
            int    status = SafeNativeMethods.xnCreateMockNode(context.InternalObject, NodeType.Audio, name, out handle);

            WrapperUtils.ThrowOnError(status);
            return(handle);
        }
Exemple #30
0
        public ProductionNode FindExistingNode(NodeType type)
        {
            IntPtr nodeHandle;
            int    status = SafeNativeMethods.xnFindExistingNodeByType(this.InternalObject, type, out nodeHandle);

            WrapperUtils.ThrowOnError(status);
            return(CreateProductionNodeObject(nodeHandle, type));
        }