Exemplo n.º 1
0
    /* ========================================================================
     * 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);
            }
        }
    }
Exemplo n.º 2
0
    /* ========================================================================
     * Methods to remove recordings
     * ========================================================================*/

    //Public method that allows to remove a tracker recording
    public void RemoveTracker(string name, float timeTracker, string tracker)
    {
        VRPNTrackerRecordings test;

        if (VRPNTrackerDevice.TryGetValue(tracker, out test))
        {
            List <VRPNTrackerRecording> .Enumerator e = test.recordings.GetEnumerator();
            VRPNTrackerRecording recording            = null;
            while (e.MoveNext())
            {
                if (e.Current.reportTime == timeTracker && e.Current.name == name)
                {
                    recording = e.Current;
                    break;
                }
            }
            if (recording != null)
            {
                test.recordings.Remove(recording);
            }
            if (test.recordings.Count == 0)
            {
                VRPNTrackerDevice.Remove(tracker);
            }
        }
    }
Exemplo n.º 3
0
    /* ========================================================================
     * 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);
            }
        }
    }