diff options
| author | a1xd <[email protected]> | 2020-09-28 01:32:02 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-09-28 01:32:02 -0400 |
| commit | e49d06cae37765bb614c1740f9495a8c1d3100ac (patch) | |
| tree | 6ca7d9612db7a139b60ccfd7407c338e4a0109f7 /grapher/Models/Serialized/SettingsManager.cs | |
| parent | Merge pull request #26 from a1xd/argcheck (diff) | |
| parent | Fix legacy offset bugs (diff) | |
| download | rawaccel-e49d06cae37765bb614c1740f9495a8c1d3100ac.tar.xz rawaccel-e49d06cae37765bb614c1740f9495a8c1d3100ac.zip | |
Merge pull request #27 from JacobPalecki/GUI
GUI Error Handling
Diffstat (limited to 'grapher/Models/Serialized/SettingsManager.cs')
| -rw-r--r-- | grapher/Models/Serialized/SettingsManager.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/grapher/Models/Serialized/SettingsManager.cs b/grapher/Models/Serialized/SettingsManager.cs index 93cf42b..416823e 100644 --- a/grapher/Models/Serialized/SettingsManager.cs +++ b/grapher/Models/Serialized/SettingsManager.cs @@ -2,6 +2,7 @@ using System; using System.Windows.Forms; using System.Threading; +using System.Text; namespace grapher.Models.Serialized { @@ -47,6 +48,34 @@ namespace grapher.Models.Serialized #region Methods + public static string ErrorStringFrom(SettingsErrors errors) + { + StringBuilder builder = new StringBuilder(); + bool yPresent = errors.y?.Count > 0; + + if (yPresent) + { + builder.AppendLine("\nx:"); + } + + foreach (var error in errors.x) + { + builder.AppendLine(error); + } + + if (yPresent) + { + builder.AppendLine("\ny:"); + + foreach (var error in errors.y) + { + builder.AppendLine(error); + } + } + + return builder.ToString(); + } + public SettingsErrors TryUpdateActiveSettings(DriverSettings settings) { var errors = TryUpdateAccel(settings); |