public static PhysicalKeyGroup GetPhysicalKeyGroup(PhysicalKey pk) { PhysicalKeyGroup pkg = new PhysicalKeyGroup(); pkg.PhysicalKeys.Add(pk); return(pkg); }
//////////////////////////////////////////////////////////////////////////// /// Static Methods //////////////////////////////////////////////////////////////////////////// private static void AddManualMouseMapping(UserSettings newSettings, VirtualKey vk, MouseButton mouseButton) { if (!newSettings.MappingsContainsKey(vk)) { newSettings.Mappings[vk] = new PhysicalKeyGroup(); } PhysicalKey pk = new PhysicalKey(); pk.MouseValue = mouseButton; newSettings.Mappings[vk].PhysicalKeys.Add(pk); }
public static UserSettings ImportValues(UserSettings_1_0_11 legacySettings) { StaticLogger.Information("UserSettings_1_0_11.ImportValues()"); UserSettings newSettings = UserSettings.GetInstance(); newSettings.AnalogStickLowerRange = legacySettings.AnalogStickLowerRange; newSettings.AnalogStickUpperRange = legacySettings.AnalogStickUpperRange; newSettings.MouseControlsL3 = legacySettings.MouseControlsL3; newSettings.MouseControlsR3 = legacySettings.MouseControlsR3; newSettings.MouseDistanceLowerRange = legacySettings.MouseDistanceLowerRange; newSettings.MouseDistanceUpperRange = legacySettings.MouseDistanceUpperRange; newSettings.MouseMaxDistance = legacySettings.MouseMaxDistance; newSettings.MousePollingRate = legacySettings.MousePollingRate; newSettings.MouseXAxisSensitivityAimModifier = legacySettings.MouseXAxisSensitivityModifier; newSettings.MouseXAxisSensitivityLookModifier = legacySettings.MouseXAxisSensitivityModifier; newSettings.MouseXAxisSensitivityMax = legacySettings.MouseXAxisSensitivityMax; newSettings.MouseYAxisSensitivityAimModifier = legacySettings.MouseYAxisSensitivityModifier; newSettings.MouseYAxisSensitivityLookModifier = legacySettings.MouseYAxisSensitivityModifier; newSettings.MouseYAxisSensitivityMax = legacySettings.MouseYAxisSensitivityMax; newSettings.XYRatio = legacySettings.XYRatio; foreach (VirtualKey key in legacySettings.Mappings.Keys) { PhysicalKey pk = new PhysicalKey(); pk.KeyboardValue = legacySettings.Mappings[key]; newSettings.Mappings[key] = GetPhysicalKeyGroup(pk); } // Now readd the mouse bindings that didnt exist as config in 1.0.11 AddManualMouseMapping(newSettings, VirtualKey.L2, MouseButton.Right); AddManualMouseMapping(newSettings, VirtualKey.R2, MouseButton.Left); newSettings.Version_2_0_0_OrGreater = true; return(newSettings); }
public static void SetMapping(VirtualKey key, PhysicalKey valueOld, PhysicalKey valueNew) { Log.Information("MainViewModel.SetMapping {VirtualKey:" + key + ", PhysicalKey: '" + valueOld + " -> " + valueNew + "'}"); if (!ThisInstance.MappingsContainsKey(key)) { ThisInstance.Mappings[key] = new PhysicalKeyGroup(); } if (valueOld != null) { ThisInstance.Mappings[key].PhysicalKeys.Remove(valueOld); } ThisInstance.Mappings[key].PhysicalKeys.Add(valueNew); Save(PROFILE_PREVIOUS); ThisInstance.PropertyChanged(ThisInstance, new PropertyChangedEventArgs("")); }