using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EasyDevCore.Configuration
{
///
///
///
[Flags]
public enum EasyConfigPropertyOptions
{
///
///
///
None = 0,
///
/// It will be save in Binary Serialization
///
Serialization = 1,
///
/// It has been encrypted
///
Encrypted = 2,
///
/// Internal property / Not save in file
///
Internal = 4
}
///
///
///
///
public class EasyConfigPropertyAttribute: Attribute
{
///
/// Gets or sets the default value.
///
/// The default value.
public object DefaultValue { get; set; }
///
/// Gets or sets the min value.
///
///
/// The min value.
///
public object MinValue { get; set; }
///
/// Gets or sets the max value.
///
///
/// The max value.
///
public object MaxValue { get; set; }
///
/// Gets or sets the tag.
///
///
/// The tag.
///
public string Tag { get; set; }
///
/// Gets or sets a value indicating whether this instance is encrypted.
///
///
/// true if this instance is encrypted; otherwise, false.
///
public bool IsEncrypted
{
get
{
return ((Options & EasyConfigPropertyOptions.Encrypted) != EasyConfigPropertyOptions.None);
}
set
{
if (value)
{
Options |= EasyConfigPropertyOptions.Encrypted;
}
else
{
Options &= ~EasyConfigPropertyOptions.Encrypted;
}
}
}
///
/// Gets or sets a value indicating whether this instance is internal.
///
///
/// true if this instance is internal; otherwise, false.
///
public bool IsInternal
{
get
{
return ((Options & EasyConfigPropertyOptions.Internal) != EasyConfigPropertyOptions.None);
}
set
{
if (value)
{
Options |= EasyConfigPropertyOptions.Internal;
}
else
{
Options &= ~EasyConfigPropertyOptions.Internal;
}
}
}
///
/// Gets or sets a value indicating whether this instance is serialization.
///
///
/// true if this instance is serialization; otherwise, false.
///
public bool IsSerialization
{
get
{
return ((Options & EasyConfigPropertyOptions.Serialization) != EasyConfigPropertyOptions.None);
}
set
{
if (value)
{
Options |= EasyConfigPropertyOptions.Serialization;
}
else
{
Options &= ~EasyConfigPropertyOptions.Serialization;
}
}
}
///
/// Gets or sets the alias.
///
///
/// The alias.
///
public string Alias { get; set; }
///
/// Gets or sets the options.
///
/// The options.
public EasyConfigPropertyOptions Options { get; set; }
}
}