mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 03:19:56 +00:00
Core - Removed JsonConvert.DefaultSettings assignement
This could break libraries used by plugins, this closes #501
This commit is contained in:
1 parent
81bb278abe
commit
190d64b497
12 files changed
+56
-44
No files matched your search
@@ -29,7 +29,7 @@ namespace Artemis.Core
|
||||
Name = pluginSettingEntity.Name;
|
||||
try
|
||||
{
|
||||
_value = JsonConvert.DeserializeObject<T>(pluginSettingEntity.Value);
|
||||
_value = JsonConvert.DeserializeObject<T>(pluginSettingEntity.Value, Constants.JsonConvertSettings);
|
||||
}
|
||||
catch (JsonReaderException)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// Determines whether the setting has been changed
|
||||
/// </summary>
|
||||
public bool HasChanged => JsonConvert.SerializeObject(Value) != _pluginSettingEntity.Value;
|
||||
public bool HasChanged => JsonConvert.SerializeObject(Value, Constants.JsonConvertSettings) != _pluginSettingEntity.Value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether changes must automatically be saved
|
||||
@@ -79,7 +79,7 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public void RejectChanges()
|
||||
{
|
||||
Value = JsonConvert.DeserializeObject<T>(_pluginSettingEntity.Value);
|
||||
Value = JsonConvert.DeserializeObject<T>(_pluginSettingEntity.Value, Constants.JsonConvertSettings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -90,7 +90,7 @@ namespace Artemis.Core
|
||||
if (!HasChanged)
|
||||
return;
|
||||
|
||||
_pluginSettingEntity.Value = JsonConvert.SerializeObject(Value);
|
||||
_pluginSettingEntity.Value = JsonConvert.SerializeObject(Value, Constants.JsonConvertSettings);
|
||||
_pluginRepository.SaveSetting(_pluginSettingEntity);
|
||||
OnSettingSaved();
|
||||
}
|
||||
|
||||
@@ -45,7 +45,12 @@ namespace Artemis.Core
|
||||
// If not found, create a new one
|
||||
if (settingEntity == null)
|
||||
{
|
||||
settingEntity = new PluginSettingEntity {Name = name, PluginGuid = Plugin.Guid, Value = JsonConvert.SerializeObject(defaultValue)};
|
||||
settingEntity = new PluginSettingEntity
|
||||
{
|
||||
Name = name,
|
||||
PluginGuid = Plugin.Guid,
|
||||
Value = JsonConvert.SerializeObject(defaultValue, Constants.JsonConvertSettings)
|
||||
};
|
||||
_pluginRepository.AddSetting(settingEntity);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user