//Public method that allows to add a button recording public void AddButton(string name, float timeButton, string path) { if (File.Exists(path)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(path, FileMode.Open); VRPNButton.ButtonReports data = (VRPNButton.ButtonReports)bf.Deserialize(file); file.Close(); VRPNButtonRecording recording = new VRPNButtonRecording(name, timeButton, data); VRPNButtonRecordings test; if (VRPNButtonDevice.TryGetValue(data.deviceType + " " + data.deviceName, out test)) { test.recordings.Add(recording); } else { test = new VRPNButtonRecordings(); test.recordings.Add(recording); VRPNButtonDevice.Add(data.deviceType + " " + data.deviceName, test); } } }
//Method that returns a recordings' enumerator of a given button device public List <VRPNButtonRecording> .Enumerator GetButtonRecordingsEnumerator(string name) { VRPNButtonRecordings test = new VRPNButtonRecordings(); if (VRPNButtonDevice.TryGetValue(name, out test)) { return(test.recordings.GetEnumerator()); } return(test.recordings.GetEnumerator()); }
//Method that returns a recordings' enumerator of a given button device public List<VRPNButtonRecording>.Enumerator GetButtonRecordingsEnumerator(string name) { VRPNButtonRecordings test = new VRPNButtonRecordings(); if (VRPNButtonDevice.TryGetValue(name, out test)) { return test.recordings.GetEnumerator(); } return test.recordings.GetEnumerator(); }