/* ======================================================================== * Methods to add recordings * ========================================================================*/ //Public method that allows to add a tracker recording public void AddTracker(string name, float timeTracker, string path) { if (File.Exists(path)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(path, FileMode.Open); VRPNTracker.TrackerReports data = (VRPNTracker.TrackerReports)bf.Deserialize(file); file.Close(); VRPNTrackerRecording recording = new VRPNTrackerRecording(name, timeTracker, data); VRPNTrackerRecordings test; if (VRPNTrackerDevice.TryGetValue(data.deviceType + " " + data.deviceName, out test)) { test.recordings.Add(recording); } else { test = new VRPNTrackerRecordings(); test.recordings.Add(recording); VRPNTrackerDevice.Add(data.deviceType + " " + data.deviceName, test); } } }
//Method that returns a recordings' enumerator of a given tracker device public List <VRPNTrackerRecording> .Enumerator GetTrackerRecordingsEnumerator(string name) { VRPNTrackerRecordings test = new VRPNTrackerRecordings(); if (VRPNTrackerDevice.TryGetValue(name, out test)) { return(test.recordings.GetEnumerator()); } return(test.recordings.GetEnumerator()); }
//Method that returns a recordings' enumerator of a given tracker device public List<VRPNTrackerRecording>.Enumerator GetTrackerRecordingsEnumerator(string name) { VRPNTrackerRecordings test = new VRPNTrackerRecordings(); if (VRPNTrackerDevice.TryGetValue(name, out test)) { return test.recordings.GetEnumerator(); } return test.recordings.GetEnumerator(); }
/* ======================================================================== * Methods to add recordings * ========================================================================*/ //Public method that allows to add a tracker recording public void AddTracker(string name, float timeTracker, string path) { if (File.Exists(path)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(path, FileMode.Open); VRPNTracker.TrackerReports data = (VRPNTracker.TrackerReports)bf.Deserialize(file); file.Close(); VRPNTrackerRecording recording = new VRPNTrackerRecording(name, timeTracker, data); VRPNTrackerRecordings test; if (VRPNTrackerDevice.TryGetValue(data.deviceType + " " + data.deviceName, out test)) { test.recordings.Add(recording); } else { test = new VRPNTrackerRecordings(); test.recordings.Add(recording); VRPNTrackerDevice.Add(data.deviceType + " " + data.deviceName, test); } } }