Invalid plugin settings will fall back to their type's default

Main window remembers it's position now
Surface editor's surface list size is saved
This commit is contained in:
Robert committed 2019-11-14 21:16:50 +01:00
1 parent 1a98ef62d3
commit 5a8a2b2684
6 files changed
+75 -31

No files matched your search

@@ -21,7 +21,14 @@ namespace Artemis.Core.Plugins.Models
_pluginSettingEntity = pluginSettingEntity;
Name = pluginSettingEntity.Name;
Value = JsonConvert.DeserializeObject<T>(pluginSettingEntity.Value);
try
{
Value = JsonConvert.DeserializeObject<T>(pluginSettingEntity.Value);
}
catch (JsonReaderException)
{
Value = default(T);
}
}
/// <summary>
@@ -86,5 +93,10 @@ namespace Artemis.Core.Plugins.Models
{
SettingChanged?.Invoke(this, EventArgs.Empty);
}
public override string ToString()
{
return $"{nameof(Name)}: {Name}, {nameof(Value)}: {Value}, {nameof(HasChanged)}: {HasChanged}";
}
}
}