mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Trycatch color settings load
updates in the future might break, be defensive
This commit is contained in:
parent
a8c7307d4b
commit
956f5ce499
1 changed files with 16 additions and 6 deletions
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using PKHeX.Core;
|
||||
using Exception = System.Exception;
|
||||
|
||||
namespace PKHeX.WinForms
|
||||
{
|
||||
|
@ -161,15 +163,23 @@ namespace PKHeX.WinForms
|
|||
var name = split[0];
|
||||
var value = split[1];
|
||||
|
||||
var pi = t.GetProperty(name);
|
||||
if (pi.PropertyType == typeof(Color))
|
||||
try
|
||||
{
|
||||
var color = Color.FromArgb(int.Parse(value));
|
||||
pi.SetValue(config, color);
|
||||
var pi = t.GetProperty(name);
|
||||
if (pi.PropertyType == typeof(Color))
|
||||
{
|
||||
var color = Color.FromArgb(int.Parse(value));
|
||||
pi.SetValue(config, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
pi.SetValue(config, split[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
pi.SetValue(config, split[1]);
|
||||
Debug.WriteLine($"Failed to write {name} to {value}!");
|
||||
Debug.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue