Exemple #1
0
    //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);
            }
        }
    }
Exemple #2
0
    //Public method that allows to stop recording
    //It saves the reports list in the indicated path
    public void StopRecording()
    {
        VRPNEventManager.StopListeningButton(ButtonType, ButtonName, Record);
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(path);

        bf.Serialize(file, data);
        file.Close();
        data        = new VRPNButton.ButtonReports();
        firstReport = true;
        isRecording = false;
    }
    //Public method that allows to stop recording
    //It saves the reports list in the indicated path
    public void StopRecording()
    {
        VRPNEventManager.StopListeningButton(ButtonType, ButtonName, Record);
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(path);

        bf.Serialize(file, data);
        file.Close();
        data = new VRPNButton.ButtonReports();
        firstReport = true;
        isRecording = false;
    }
Exemple #4
0
    //Public method that allows to start playing
    //It reads the data from the indicated path
    public void StartPlaying()
    {
        if (File.Exists(path))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(path, FileMode.Open);
            data = (VRPNButton.ButtonReports)bf.Deserialize(file);

            file.Close();

            isPlaying = true;

            e = data.list.GetEnumerator();
        }
    }
    //Public method that allows to start playing
    //It reads the data from the indicated path
    public void StartPlaying()
    {
        if (File.Exists(path))
        {
            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Open(path, FileMode.Open);
            data = (VRPNButton.ButtonReports)bf.Deserialize(file);

            file.Close();

            isPlaying = true;

            e = data.list.GetEnumerator();
        }
    }
Exemple #6
0
    //VRPNButtonRecording Constructor
    public VRPNButtonRecording(string nName, float nTime, VRPNButton.ButtonReports nData)
    {
        name       = nName;
        reportTime = nTime;
        data       = nData;

        e = data.list.GetEnumerator();

        while (e.MoveNext())
        {
            VRPNButton.ButtonReportNew report = e.Current;
            int test;
            if (!buttons.TryGetValue(report.button, out test))
            {
                buttons.Add(report.button, report.button);
            }
            lastTime = report.msg_time.tv_sec + (report.msg_time.tv_usec / 1000000f);
        }

        e = data.list.GetEnumerator();
    }
    //VRPNButtonRecording Constructor
    public VRPNButtonRecording(string nName, float nTime, VRPNButton.ButtonReports nData)
    {
        name = nName;
        reportTime = nTime;
        data = nData;

        e = data.list.GetEnumerator();

        while (e.MoveNext())
        {
            VRPNButton.ButtonReportNew report = e.Current;
            int test;
            if (!buttons.TryGetValue(report.button, out test))
            {
                buttons.Add(report.button, report.button);
            }
            lastTime = report.msg_time.tv_sec + (report.msg_time.tv_usec / 1000000f);
        }

        e = data.list.GetEnumerator();
    }