public TriggeredActionControlEventArgs(TriggeredAction theAction, TriggeredActionControl theControl)
 {
     TheAction  = theAction;
     TheControl = theControl;
 }
Beispiel #2
0
        public void LoadFromXml(XElement xUserProfile)
        {
            if (xUserProfile != null)
            {
                Name        = xUserProfile.GetElementValueTrimmed("Name");
                Frozen      = xUserProfile.GetElementValueBool("Frozen");
                RequireHome = xUserProfile.GetElementValueBool("RequireHome");

                if (xUserProfile.GetElementValueOrNull("API") == null)
                {
                    API = Config.LegacyAPI; // backwards compatibility, API was in config-xml before
                }
                else
                {
                    if (Enum.TryParse(xUserProfile.GetElementValueTrimmed("API"), out VRAPI a))
                    {
                        API = a;
                    }
                    else
                    {
                        API = VRAPI.OculusVR;
                    }
                }

                string wout = xUserProfile.GetElementValueTrimmed("WaveOutDeviceSource");
                if (Enum.TryParse(wout, out AudioDeviceSource ads))
                {
                    WaveOutDeviceSource = ads;
                }
                else
                {
                    if (String.Compare(wout, "Oculus", true) == 0) // backwards compatibility
                    {
                        WaveOutDeviceSource = AudioDeviceSource.OculusHome;
                    }
                    else
                    {
                        WaveOutDeviceSource = AudioDeviceSource.Windows;
                    }
                }

                string waveOutName = xUserProfile.GetElementValueTrimmed("WaveOutDeviceName");
                TheWaveOutDevice = AudioDevicePool.GetWaveOutDevice(waveOutName);

                OriginalWaveOutDeviceNotFound = false;
                if (TheWaveOutDevice == null && WaveOutDeviceSource == AudioDeviceSource.Manual)
                {
                    OriginalWaveOutDeviceNotFound = true;
                    NotFoundDeviceName            = waveOutName;
                    if (API == VRAPI.OculusVR)
                    {
                        WaveOutDeviceSource = AudioDeviceSource.OculusHome;
                    }
                    else
                    {
                        WaveOutDeviceSource = AudioDeviceSource.Windows;
                    }
                }

                foreach (var trig in xUserProfile.Descendants().Where(element => element.Name == "TriggeredAction"))
                {
                    TriggeredAction newAct = new TriggeredAction(FormMain.Tracker, this);
                    newAct.LoadFromXml(trig);
                }
            }
        }