示例#1
0
        private void SaveDescription()
        {
            string filename = Path.Combine(_scratchDirectory, _descriptionFilename);

            lock (_descriptionLock)
            {
                PointCloudStreamDescription.Save(filename, _description);
            }
        }
        internal static PointCloudStreamDescription Load(Stream stream)
        {
            var desc = XamlServices.Load(stream) as PointCloudStreamDescription;

            if (desc == null)
            {
                desc = new PointCloudStreamDescription();
            }

            return(desc);
        }
        public static PointCloudStreamDescription Load(string filename)
        {
            if (!File.Exists(filename))
            {
                return new PointCloudStreamDescription();
            }
            var desc = XamlServices.Load(filename) as PointCloudStreamDescription;
            if (desc == null)
                desc = new PointCloudStreamDescription();

            return desc;
        }
        public static PointCloudStreamDescription Load(string filename)
        {
            if (!File.Exists(filename))
            {
                return(new PointCloudStreamDescription());
            }
            var desc = XamlServices.Load(filename) as PointCloudStreamDescription;

            if (desc == null)
            {
                desc = new PointCloudStreamDescription();
            }

            return(desc);
        }
示例#5
0
        public void StartRecording(string filename, string scratchDirectory)
        {
            if (_isRecording)
            {
                throw new InvalidOperationException("Recording in process. Call StopRecording() first.");
            }

            _isRecording = true;

            _description = new PointCloudStreamDescription()
            {
                FrameCount = 0
            };

            this._scratchDirectory = scratchDirectory;
            this._filename         = filename;

            VerifyDirectories();

            soundRecording.Start(scratchDirectory);
        }
        public void Load(string filename)
        {
            Reset();

            if (!File.Exists(filename))
            {
                Unload();
                return;
            }

            lock (_zipFileLock)
            {
                if (_zipFile != null)
                {
                    _zipFile.Dispose();
                    _zipFile = null;
                }

                _zipFile = new ZipFile(filename);

                if (!_zipFile.EntryFileNames.Contains(descriptionFilename))
                {
                    Unload();
                    return;
                }

                var frameFiles = _zipFile.EntryFileNames.Where(s => s.Substring(s.Length - 3, 3) == "mfx");

                _filesToLoad = frameFiles.OrderBy(f => f).ToList();

                if (_filesToLoad.Count == 0)
                {
                    Unload();
                    return;
                }

                if (_zipFile.EntryFileNames.Contains(audioFilename))
                {
                    if (_audioStream != null)
                    {
                        _audioStream.Dispose();
                        _audioStream = null;
                    }
                    _audioStream = new MemoryStream();
                    _zipFile[audioFilename].Extract(_audioStream);
                    _audioStream.Position = 0;
                    _soundPlayer.LoadWavStream(_audioStream);
                }

                using (var settingsStream = new MemoryStream())
                {
                    _zipFile[descriptionFilename].Extract(settingsStream);
                    settingsStream.Position = 0;
                    var description = PointCloudStreamDescription.Load(settingsStream);

                    MinTimeUTC     = description.RecordingStartDateTimeUTC;
                    CurrentTimeUTC = MinTimeUTC;
                    MaxTimeUTC     = description.RecordingStopDateTimeUTC;

                    int count = description.FrameCount;
                    var span  = MaxTimeUTC - MinTimeUTC;
                    if (count > 0 && span.TotalSeconds > 0)
                    {
                        FileFPS = count / span.TotalSeconds;
                    }
                }
            }

            Status = PointCloudPlayerStatus.Stopped;
            Seek(0);
        }
        public void StartRecording(string filename, string scratchDirectory)
        {
            if (_isRecording)
            {
                throw new InvalidOperationException("Recording in process. Call StopRecording() first.");
            }

            _isRecording = true;

            _description = new PointCloudStreamDescription()
            {
                FrameCount = 0
            };

            this._scratchDirectory = scratchDirectory;
            this._filename = filename;

            VerifyDirectories();

            soundRecording.Start(scratchDirectory);
        }
 public static void Save(Stream stream, PointCloudStreamDescription desc)
 {
     XamlServices.Save(stream, desc);
 }
 public static void Save(string filename, PointCloudStreamDescription desc)
 {
     XamlServices.Save(filename, desc);
 }
        internal static PointCloudStreamDescription Load(Stream stream)
        {
            var desc = XamlServices.Load(stream) as PointCloudStreamDescription;
            if (desc == null)
                desc = new PointCloudStreamDescription();

            return desc;
        }
 public static void Save(Stream stream, PointCloudStreamDescription desc)
 {
     XamlServices.Save(stream, desc);
 }
 public static void Save(string filename, PointCloudStreamDescription desc)
 {
     XamlServices.Save(filename, desc);
 }