mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-19 06:17:43 +01:00
chore: warnings pass
This commit is contained in:
parent
505e37fd28
commit
b093323acc
49 changed files with 352 additions and 254 deletions
|
|
@ -21,36 +21,6 @@ namespace Dalamud.Configuration
|
|||
this.configDirectory.Create();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes a plugin configuration object.
|
||||
/// </summary>
|
||||
/// <param name="config">The configuration object.</param>
|
||||
/// <returns>A string representing the serialized configuration object.</returns>
|
||||
internal static string SerializeConfig(object? config)
|
||||
{
|
||||
return JsonConvert.SerializeObject(config, Formatting.Indented, new JsonSerializerSettings
|
||||
{
|
||||
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
|
||||
TypeNameHandling = TypeNameHandling.Objects,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes a plugin configuration from a string.
|
||||
/// </summary>
|
||||
/// <param name="data">The serialized configuration.</param>
|
||||
/// <returns>The configuration object, or null.</returns>
|
||||
internal static IPluginConfiguration? DeserializeConfig(string data)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<IPluginConfiguration>(
|
||||
data,
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
|
||||
TypeNameHandling = TypeNameHandling.Objects,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save/Load plugin configuration.
|
||||
/// NOTE: Save/Load are still using Type information for now,
|
||||
|
|
@ -145,6 +115,36 @@ namespace Dalamud.Configuration
|
|||
/// <returns>FileInfo of the config file.</returns>
|
||||
public FileInfo GetConfigFile(string pluginName) => new(Path.Combine(this.configDirectory.FullName, $"{pluginName}.json"));
|
||||
|
||||
/// <summary>
|
||||
/// Serializes a plugin configuration object.
|
||||
/// </summary>
|
||||
/// <param name="config">The configuration object.</param>
|
||||
/// <returns>A string representing the serialized configuration object.</returns>
|
||||
internal static string SerializeConfig(object? config)
|
||||
{
|
||||
return JsonConvert.SerializeObject(config, Formatting.Indented, new JsonSerializerSettings
|
||||
{
|
||||
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
|
||||
TypeNameHandling = TypeNameHandling.Objects,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes a plugin configuration from a string.
|
||||
/// </summary>
|
||||
/// <param name="data">The serialized configuration.</param>
|
||||
/// <returns>The configuration object, or null.</returns>
|
||||
internal static IPluginConfiguration? DeserializeConfig(string data)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<IPluginConfiguration>(
|
||||
data,
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
|
||||
TypeNameHandling = TypeNameHandling.Objects,
|
||||
});
|
||||
}
|
||||
|
||||
private DirectoryInfo GetDirectoryPath(string pluginName) => new(Path.Combine(this.configDirectory.FullName, pluginName));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue