private void SaveRecording(string outputFile) { if (_recording == null) { return; } //Create directory if it doesn't exist if (!Directory.Exists(FOLDER)) { Directory.CreateDirectory(FOLDER); } var filePath = FOLDER + "/" + outputFile + _recordCount + ".kr"; //Don't overwrite previous recordings while (File.Exists(filePath)) { _recordCount++; filePath = FOLDER + "/" + outputFile + _recordCount + ".kr"; } //open the filestream using (var output = new FileStream(@filePath, FileMode.Create)) { //Open binartFormatter var bf = new BinaryFormatter(); bf.Serialize(output, _recording); _recording = null; _recordCount++; } }
public RemoveSingleFrame(KinectRecording rec, int index) { _recording = rec; _index = index; _frame = _recording.GetFrame(_index); Execute(); }
//Actual opening and saving private void DeserializeRecordingFile(string filename) { //Load in the file _currentFile = filename; using (var file = new FileStream(_currentFile, FileMode.Open)) { //Loads the serialized data try { _recording = null; var bf = new BinaryFormatter(); _recording = bf.Deserialize(file) as KinectRecording; //_recording.RecreateFrames(); _recording.SetupBones(); _recording.OnFramesUpdated += (() => { RaisePropertyChanged("TotalFrames"); RaisePropertyChanged("CurrentFrameIndex"); }); } catch (Exception) { Debug.Log(LogLevel.Warning, "Failed to load recording" + filename); RaisePropertyChanged("TotalFrames"); RaisePropertyChanged("IsLoaded"); return; } } Debug.Log(LogLevel.Info, String.Format("Succesfully loaded file: {0}", _recording.FileName)); CurrentFrameIndex = 0; _recording.SetupBones(); //Need to let WPF know the Recording got changed RaisePropertyChanged("TotalFrames"); RaisePropertyChanged("CurrentFrameIndex"); RaisePropertyChanged("HasRecording"); }
public void StartRecording() { IsRecording = true; Debug.Log(LogLevel.Info, "Started recording Kinect input data"); _recording = new KinectRecording(FileName); }
public void SetRecording(KinectRecording r) { _recording = r; }
public CleanUpFrames(KinectRecording rec) { _recording = rec; _originalKinectFrames = rec.FrameList; Execute(); }