summaryrefslogtreecommitdiff
path: root/grapher/Models/Serialized
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2020-09-27 21:42:48 -0700
committerJacob Palecki <[email protected]>2020-09-27 21:42:48 -0700
commit7ccdb78b8c059de31e5b568b43f4547142d9aeb4 (patch)
tree992816135721cf33e41a373b161cfaee5d104d84 /grapher/Models/Serialized
parentFix tab behavior (diff)
downloadrawaccel-7ccdb78b8c059de31e5b568b43f4547142d9aeb4.tar.xz
rawaccel-7ccdb78b8c059de31e5b568b43f4547142d9aeb4.zip
Handle errors from bad arg on write
Diffstat (limited to 'grapher/Models/Serialized')
-rw-r--r--grapher/Models/Serialized/SettingsManager.cs29
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);