/// <summary>
        /// Retrieves the configuration file location for the individual controller.
        /// If using an XInput controller, pass null.
        /// </summary>
        private void GetConfigLocation(DInputController dInputController)
        {
            // Get Configuration Details
            LoaderConfigParser.Config config = LoaderConfigParser.ParseConfig();

            // Set the device type
            ConfigType = config.DirectInputConfigType;

            // If XInput/DInput
            if (DeviceType == InputDeviceType.DirectInput)
            {
                // If InstanceGUID or ProductGUID.
                if (ConfigType == DirectInputConfigType.InstanceGUID)
                {
                    ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/Instances/" +
                                                dInputController.Information.InstanceGuid + ".json";
                }

                else if (ConfigType == DirectInputConfigType.ProductGUID)
                {
                    ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/" +
                                                PathSanitizer.ForceValidFilePath(dInputController.Information.ProductName) + ".json";
                }
            }
            else if (DeviceType == InputDeviceType.XInput)
            {
                ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/XInput/" + "Controller_" + XInputPort + ".json";
            }
        }
Beispiel #2
0
        /// <summary>
        /// Retrieves the location of the mod loader's main configuration file.
        /// </summary>
        public static string GetModLoaderConfig()
        {
            // Create loader config if it does not exist.
            if (!File.Exists(ConfigFileLocation))
            {
                LoaderConfigParser localParser = new LoaderConfigParser();
                localParser.CreateConfig(ConfigFileLocation);
            }

            return(ConfigFileLocation);
        }
Beispiel #3
0
        /// <summary>
        /// Loads all configurations to be used by the program, alongside with their parsers.
        /// </summary>
        private void InitializeGlobalProperties()
        {
            // Instantiate the Global Config Manager
            Global.ConfigurationManager = new ConfigManager();

            // Grab relevant configs.
            // Note: Game list is grabbed upon entry to the main screen form.
            Global.LoaderConfiguration = LoaderConfigParser.ParseConfig();

            // Initialize other Properties.
            Global.Theme = new Theme();

            // Set the initial menu name.
            Global.CurrentMenuName = "Main Menu";
        }
Beispiel #4
0
 /// <summary>
 /// Saves the mod loader configuration which stores the currently used theme.
 /// </summary>
 private void SaveCurrentTheme()
 {
     // Save the mod loader configuration.
     LoaderConfigParser.WriteConfig(Global.LoaderConfiguration);
 }