示例#1
0
        private void enableProfile(Profile profile)
        {
            RegistryMap registry = new RegistryMap();

            if (registry.setActiveProfile(profile)) {
                MessageBox.Show("Success!", "Load Profile", MessageBoxButtons.OK, MessageBoxIcon.Information);
            } else {
                MessageBox.Show("Failure!", "Load Profile", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        public void loadProfilesFromFile()
        {
            XDocument doc = XDocument.Load(this.profileXml);

            foreach (var profileNode in doc.Descendants("profile"))
            {
                Profile p = new Profile();
                p.loadFromXml(profileNode);

                this.profiles.Add(p);
            }
        }
        public bool setActiveProfile(Profile profile)
        {
            if (profile == null) {
                return false;
            }

            Registry.SetValue(REGKEY_G27, "OperatingRange", profile.operatingRange);
            Registry.SetValue(REGKEY_G27, "DamperGainPercentage", profile.damperGainPercentage);
            Registry.SetValue(REGKEY_G27, "DefaultSpringGainPercentage", profile.defaultSpringGainPercentage);
            Registry.SetValue(REGKEY_G27, "OverallGainPercentage", profile.overallGainPercentage);
            Registry.SetValue(REGKEY_G27, "SpringGainPercentage", profile.springGainPercentage);

            Registry.SetValue(REGKEY_G27, "ForceFeedbackEnable", profile.forceFeedbackEnable ? 1 : 0);
            Registry.SetValue(REGKEY_G27, "CombinedPedalsEnable", profile.combinedPedalsEnable ? 1 : 0);
            Registry.SetValue(REGKEY_G27, "PersistentSpringEnable", profile.persistentSpringEnable ? 1 : 0);
            Registry.SetValue(REGKEY_G27, "GameSettingsEnable", profile.gameSettingsEnable ? 1 : 0);

            return true;
        }