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