using ServerManagerTool.Common.Enums;
using System;
namespace ServerManagerTool.Common.Attibutes
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
public abstract class BaseIniFileEntryAttribute : Attribute
{
///
/// Attribute for the IniFile serializer
///
/// The file into which the setting should be serialized.
/// The section in the ini file.
/// The category of the setting.
/// The key within the section. Defaults to the same name as the attributed field.
protected BaseIniFileEntryAttribute(Enum file, Enum section, Enum category, string key = "")
{
this.File = file;
this.Section = section;
this.Category = category;
this.Key = key;
this.QuotedString = QuotedStringType.False;
this.Multiline = false;
this.MultilineSeparator = @"\n";
}
public Enum File { get; set; }
///
/// The section of the ini file.
///
public Enum Section { get; set; }
///
/// The category of the setting.
///
public Enum Category { get; set; }
///
/// The key within the section.
///
public string Key;
///
/// Only write the attributed value if the value is different to the specified value.
///
public object WriteIfNotValue;
///
/// If true, the value of booleans will be inverted when read or written.
///
public bool InvertBoolean;
///
/// If true, will also write a true boolean value when the underlying field is non-default (or empty for strings), otherwise a false value will be written.
///
public bool WriteBoolValueIfNonEmpty;
///
/// If true, the value of booleans will be written as an integer (0 = false, 1 = true).
///
public bool WriteBooleanAsInteger;
///
/// Clear the section before writing this value.
///
public bool ClearSection;
///
/// If true, the value will always be written with quotes, if remove, the value will always be written without quotes even if added.
///
public QuotedStringType QuotedString;
///
/// Only write the attributed value if the named field is true.
///
public string ConditionedOn;
///
/// If true, the value will be treated as a multiline value.
///
public bool Multiline;
///
/// The new line separator to use when Multiline = True.
///
public string MultilineSeparator;
///
/// Clears the value when the named field is off, otherwise if on will skip the update.
/// NOTE: Use this for config fields that are updated by the server, while it is ruuning.
///
public string ClearWhenOff;
public bool IsCustom;
}
}