Enforce new() constraint on ConfigFile<TSettings>
This commit is contained in:
parent
96d7d2c54a
commit
50c1b757be
3 changed files with 2 additions and 12 deletions
|
|
@ -8,12 +8,12 @@ namespace TShockAPI.Configuration
|
|||
/// Implements <see cref="IConfigFile{TSettings}"/> to provide a generic config file containing some settings
|
||||
/// </summary>
|
||||
/// <typeparam name="TSettings"></typeparam>
|
||||
public class ConfigFile<TSettings> : IConfigFile<TSettings>
|
||||
public class ConfigFile<TSettings> : IConfigFile<TSettings> where TSettings : new()
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings managed by this config file
|
||||
/// </summary>
|
||||
public virtual TSettings Settings { get; set; }
|
||||
public virtual TSettings Settings { get; set; } = new TSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Action invoked when the config file is read
|
||||
|
|
|
|||
|
|
@ -73,11 +73,6 @@ namespace TShockAPI.Configuration
|
|||
/// </summary>
|
||||
public class ServerSideConfig : ConfigFile<SscSettings>
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings managed by this configuration object
|
||||
/// </summary>
|
||||
public override SscSettings Settings { get; set; } = new SscSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Dumps all configuration options to a text file in Markdown format
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -592,11 +592,6 @@ namespace TShockAPI.Configuration
|
|||
/// </summary>
|
||||
public class TShockConfig : ConfigFile<TShockSettings>
|
||||
{
|
||||
/// <summary>
|
||||
/// TShock settings managed by this configuration object
|
||||
/// </summary>
|
||||
public override TShockSettings Settings { get; set; } = new TShockSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Upgrades the configuration file from the old format if required, then reads and returns the currently configured <see cref="TShockSettings"/>
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue