Ejemplo n.º 1
0
 public static void SetDefaultAudioDevice(MMDevice mMDevice)
 {
     try
     {
         var            config = new PolicyConfig();
         int            hr1;
         int            hr2;
         int            hr3;
         bool?          win10   = null;
         IPolicyConfig2 config2 = config as IPolicyConfig2;
         if (config2 != null)
         {
             win10 = false;
             hr1   = config2.SetDefaultEndpoint(mMDevice.ID, AudioDeviceRole.Multimedia);
             hr2   = config2.SetDefaultEndpoint(mMDevice.ID, AudioDeviceRole.Communications);
             hr3   = config2.SetDefaultEndpoint(mMDevice.ID, AudioDeviceRole.Console);
         }
         else
         {
             win10 = true;
             hr1   = ((IPolicyConfig3)config).SetDefaultEndpoint(mMDevice.ID, AudioDeviceRole.Multimedia);
             hr2   = ((IPolicyConfig3)config).SetDefaultEndpoint(mMDevice.ID, AudioDeviceRole.Communications);
             hr3   = ((IPolicyConfig3)config).SetDefaultEndpoint(mMDevice.ID, AudioDeviceRole.Console);
         }
         Toolbox.uAddDebugLog($"NAudio HResult Definitions: s_OK({HResult.S_OK}) | s_FALSE({HResult.S_FALSE}) | e_INVALIDARG({HResult.E_INVALIDARG})");
         Toolbox.uAddDebugLog($"SetAudioDefaultResults: win10({win10}) | hr1({hr1}) | hr2({hr2}) | hr3({hr3})");
     }
     catch (Exception ex)
     {
         Toolbox.LogException(ex);
     }
 }
Ejemplo n.º 2
0
 private void uDebugLogAdd(string _log, DebugType _type = DebugType.INFO, [CallerMemberName] string caller = "")
 {
     try
     {
         Toolbox.uAddDebugLog($"CLSSETTINGS: {_log}", _type, caller);
     }
     catch (Exception ex)
     {
         Toolbox.LogException(ex);
     }
 }
Ejemplo n.º 3
0
        public void ChangeStartProfile(StartProfile startProfile)
        {
            try
            {
                uDebugLogAdd($"Saving current start list for profile: {CurrentStartProfile.ToString()}");
                switch (CurrentStartProfile)
                {
                case StartProfile.Start1:
                    StartProfile1 = ActiveStartList;
                    break;

                case StartProfile.Start2:
                    StartProfile2 = ActiveStartList;
                    break;

                case StartProfile.Start3:
                    StartProfile3 = ActiveStartList;
                    break;

                case StartProfile.Start4:
                    StartProfile4 = ActiveStartList;
                    break;
                }
                uDebugLogAdd($"Moving from StartProfile {CurrentStartProfile.ToString()} to {startProfile.ToString()}");
                CurrentStartProfile = startProfile;
                switch (startProfile)
                {
                case StartProfile.Start1:
                    ActiveStartList = StartProfile1;
                    break;

                case StartProfile.Start2:
                    ActiveStartList = StartProfile2;
                    break;

                case StartProfile.Start3:
                    ActiveStartList = StartProfile3;
                    break;

                case StartProfile.Start4:
                    ActiveStartList = StartProfile4;
                    break;
                }
                uDebugLogAdd("Finished changing start profile");
                Events.TriggerStartInfoChange();
            }
            catch (Exception ex)
            {
                Toolbox.LogException(ex);
            }
        }
Ejemplo n.º 4
0
        public void ChangeWindowProfile(WindowProfile windowProfile)
        {
            try
            {
                uDebugLogAdd($"Saving current window list for profile: {CurrentWindowProfile.ToString()}");
                switch (CurrentWindowProfile)
                {
                case WindowProfile.Profile1:
                    WindowProfile1 = ActiveWindowList;
                    break;

                case WindowProfile.Profile2:
                    WindowProfile2 = ActiveWindowList;
                    break;

                case WindowProfile.Profile3:
                    WindowProfile3 = ActiveWindowList;
                    break;

                case WindowProfile.Profile4:
                    WindowProfile4 = ActiveWindowList;
                    break;
                }
                uDebugLogAdd($"Moving from WindowProfile {CurrentWindowProfile.ToString()} to {windowProfile.ToString()}");
                CurrentWindowProfile = windowProfile;
                switch (windowProfile)
                {
                case WindowProfile.Profile1:
                    ActiveWindowList = WindowProfile1;
                    break;

                case WindowProfile.Profile2:
                    ActiveWindowList = WindowProfile2;
                    break;

                case WindowProfile.Profile3:
                    ActiveWindowList = WindowProfile3;
                    break;

                case WindowProfile.Profile4:
                    ActiveWindowList = WindowProfile4;
                    break;
                }
                uDebugLogAdd("Finished changing window profile");
                Events.TriggerWindowInfoChange();
            }
            catch (Exception ex)
            {
                Toolbox.LogException(ex);
            }
        }
Ejemplo n.º 5
0
 private static void LogException(Exception ex, [CallerLineNumber] int lineNum = 0, [CallerMemberName] string caller = "", [CallerFilePath] string path = "")
 {
     Toolbox.LogException(ex, lineNum, caller, path);
 }