Ejemplo n.º 1
0
 public object Clone()
 {
     return(new Settings()
     {
         HotkeyProfiles = HotkeyProfiles.ToDictionary(x => x.Key, x => (HotkeyProfile)(x.Value.Clone())),
         WarnOnReset = WarnOnReset,
         RecentSplits = new List <RecentSplitsFile>(RecentSplits),
         RecentLayouts = new List <string>(RecentLayouts),
         LastComparison = LastComparison,
         RaceViewer = RaceViewer,
         AgreedToSRLRules = AgreedToSRLRules,
         SimpleSumOfBest = SimpleSumOfBest,
         ActiveAutoSplitters = new List <string>(ActiveAutoSplitters),
         ComparisonGeneratorStates = new Dictionary <string, bool>(ComparisonGeneratorStates)
     });
 }
Ejemplo n.º 2
0
        public void RegisterHotkeys(CompositeHook hook, string hotkeyProfileName)
        {
            try
            {
                UnregisterAllHotkeys(hook);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }

            if (HotkeyProfiles.ContainsKey(hotkeyProfileName))
            {
                var hotkeyProfile = HotkeyProfiles[hotkeyProfileName];
                var deactivateForOtherPrograms = hotkeyProfile.GlobalHotkeysEnabled && hotkeyProfile.DeactivateHotkeysForOtherPrograms;
                if (hotkeyProfile.SplitKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.SplitKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.ResetKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.ResetKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.SkipKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.SkipKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.UndoKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.UndoKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.PauseKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.PauseKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.ToggleGlobalHotkeys != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.ToggleGlobalHotkeys, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.SwitchComparisonPrevious != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.SwitchComparisonPrevious, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.SwitchComparisonNext != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.SwitchComparisonNext, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
            }
        }