private void LoadPersistedHandDataRecordings() { new DirectoryInfo(LocalPersistPath).Create(); foreach (var filePath in System.IO.Directory.EnumerateFiles(LocalPersistPath)) { try { var fileContents = System.IO.File.ReadAllText(filePath); var persistedHandsDataRecording = XmlSerialize.Deserialize <PersistedHandsDataRecording>(fileContents); HandsDataRecording.Create(this.transform, persistedHandsDataRecording.Name, persistedHandsDataRecording.HandsDataRecordedFrames, persistedHandsDataRecording.InitHandData, DeleteLocalRecording, PlayRecording ); } catch (Exception e) { Debug.LogError($"Unable to {nameof(LoadPersistedHandDataRecordings)}"); } } }
public void StopRecording() { if (string.IsNullOrEmpty(NewRecordingName)) { Debug.LogError($"You need to specify '{nameof(NewRecordingName)}'"); return; } IsRecording = false; if (_handDataRecordedFrames.Count == 0) { Debug.LogError($"Recording: '{NewRecordingName}' captured 0 frames, it won't be saved."); return; } var recording = HandsDataRecording.Create(this.transform, NewRecordingName, _handDataRecordedFrames, _initHandData, DeleteLocalRecording, PlayRecording); PersistDataLocallySafe(recording.RecordingName, recording.HandsDataRecordedFrames); Debug.Log($"Recording: '{NewRecordingName}' competed, captured {_handDataRecordedFrames.Count} frames."); _currentHandDataRecorderFrame = null; _handDataRecordedFrames = new List <HandsDataRecordedFrame>(); NewRecordingName = string.Empty; }