public void Dispose()
 {
     Stop();
     if (reader != null)
     {
         reader.Dispose();
         reader = null;
     }
     allFramesReplay = null;
 }
Esempio n. 2
0
        public void Dispose()
        {
            Stop();

            colorReplay    = null;
            depthReplay    = null;
            skeletonReplay = null;

            if (reader != null)
            {
                reader.Dispose();
                reader = null;
            }

            if (stream != null)
            {
                stream.Dispose();
                stream = null;
            }
        }
Esempio n. 3
0
        public KinectReplay(Stream stream)
        {
            this.stream = stream;
            reader      = new BinaryReader(stream);

            synchronizationContext = SynchronizationContext.Current;

            KinectRecordOptions options = (KinectRecordOptions)reader.ReadInt32();

            if ((options & KinectRecordOptions.Color) != 0)
            {
                colorReplay = new ReplaySystem <ReplayColorImageFrame>();
            }
            if ((options & KinectRecordOptions.Depth) != 0)
            {
                depthReplay = new ReplaySystem <ReplayDepthImageFrame>();
            }
            if ((options & KinectRecordOptions.Skeletons) != 0)
            {
                skeletonReplay = new ReplaySystem <ReplaySkeletonFrame>();
            }

            while (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                KinectRecordOptions header = (KinectRecordOptions)reader.ReadInt32();
                switch (header)
                {
                case KinectRecordOptions.Color:
                    colorReplay.AddFrame(reader);
                    break;

                case KinectRecordOptions.Depth:
                    depthReplay.AddFrame(reader);
                    break;

                case KinectRecordOptions.Skeletons:
                    skeletonReplay.AddFrame(reader);
                    break;
                }
            }
        }