Reworked the JSON serialisation
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Test_Merge
|
||||
public string GrandPrixName { get => _grandPrixName; private set => _grandPrixName = value; }
|
||||
public int GrandPrixYear { get => _grandPrixYear; private set => _grandPrixYear = value; }
|
||||
public List<string> DriverList { get => _driverList; private set => _driverList = value; }
|
||||
public string SelectedConfigFile { get => _selectedConfigFile;private set => _selectedConfigFile = value; }
|
||||
public string SelectedConfigFile { get => _selectedConfigFile; private set => _selectedConfigFile = value; }
|
||||
|
||||
public Settings()
|
||||
{
|
||||
@@ -49,7 +49,7 @@ namespace Test_Merge
|
||||
}
|
||||
private void RefreshUI()
|
||||
{
|
||||
|
||||
|
||||
lsbDrivers.DataSource = null;
|
||||
lsbDrivers.DataSource = DriverList;
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Test_Merge
|
||||
if (Config != null)
|
||||
{
|
||||
pbxMain.Image = Config.MainZone.Draw();
|
||||
if(Config.MainZone.Zones.Count > 0)
|
||||
if (Config.MainZone.Zones.Count > 0)
|
||||
pbxDriverZone.Image = Config.MainZone.Zones[0].Draw();
|
||||
}
|
||||
}
|
||||
@@ -384,7 +384,7 @@ namespace Test_Merge
|
||||
string presetName = tbxPresetName.Text;
|
||||
if (Config != null)
|
||||
{
|
||||
Config.SaveToJson(DriverList,presetName);
|
||||
Config.SaveToJson(DriverList, presetName);
|
||||
}
|
||||
RefreshUI();
|
||||
}
|
||||
@@ -396,17 +396,17 @@ namespace Test_Merge
|
||||
|
||||
private void btnLoadPreset_Click(object sender, EventArgs e)
|
||||
{
|
||||
//MessageBox.Show(lsbPresets.SelectedIndex.ToString());
|
||||
if (lsbPresets.SelectedIndex >= 0 && pbxMain.Image != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
string fileName = lsbPresets.Items[lsbPresets.SelectedIndex].ToString();
|
||||
Reader reader = new Reader(fileName, (Bitmap)pbxMain.Image,false);
|
||||
Reader reader = new Reader(fileName, (Bitmap)pbxMain.Image, false);
|
||||
//MainZones #0 is the big main zone containing driver zones
|
||||
Config = new ConfigurationTool((Bitmap)pbxMain.Image, reader.MainZones[0].Bounds);
|
||||
Config.MainZone = reader.MainZones[0];
|
||||
DriverList = reader.Drivers;
|
||||
|
||||
SelectedConfigFile = fileName;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user