in ScpControl/Utilities/IniConfig.cs [21:82]
private IniConfig()
{
var iniOpts = new IniOptions()
{
CommentStarter = IniCommentStarter.Semicolon,
KeyDuplicate = IniDuplication.Allowed
};
var ini = new IniFile(iniOpts);
var fullPath = Path.Combine(GlobalConfiguration.AppDirectory, CfgFile);
if (!File.Exists(fullPath))
{
Log.FatalFormat("Configuration file {0} not found!", fullPath);
return;
}
// parse data from INI
try
{
ini.Load(fullPath);
Hci = new HciCfg()
{
SupportedNames = ini.Sections["Host Controller Interface"].Keys.Where(k => k.Name == "SupportedName").Select(v => v.Value),
GenuineMacAddresses = ini.Sections["Host Controller Interface"].Keys.Where(k => k.Name == "GenuineMacAddress").Select(v => v.Value)
};
Ds3Driver = new Ds3DriverCfg()
{
DeviceGuid = ini.Sections["DualShock 3 Controllers"].Keys["DeviceGuid"].Value,
HardwareIds = ini.Sections["DualShock 3 Controllers"].Keys.Where(k => k.Name == "HardwareId").Select(v => v.Value)
};
Ds4Driver = new Ds4DriverCfg()
{
DeviceGuid = ini.Sections["DualShock 4 Controllers"].Keys["DeviceGuid"].Value,
HardwareIds = ini.Sections["DualShock 4 Controllers"].Keys.Where(k => k.Name == "HardwareId").Select(v => v.Value)
};
BthDongleDriver = new BthDongleDriverCfg()
{
DeviceGuid = ini.Sections["Bluetooth Dongles"].Keys["DeviceGuid"].Value,
HardwareIds = ini.Sections["Bluetooth Dongles"].Keys.Where(k => k.Name == "HardwareId").Select(v => v.Value)
};
BthChipManufacturers = new List<BthChipManufacturerCfg>();
foreach (var key in ini.Sections["Bluetooth Chip Manufacturers"].Keys)
{
BthChipManufacturers.Add(new BthChipManufacturerCfg()
{
Name = key.Name,
PartialMacAddress = key.Value
});
}
}
catch (Exception ex)
{
Log.FatalFormat("Error while parsing configuration file: {0}", ex);
}
}