diff --git a/BFR/Operations/Attributes/DescriptionAttribute.cs b/BFR/Operations/Attributes/DescriptionAttribute.cs deleted file mode 100644 index 57b32b6..0000000 --- a/BFR/Operations/Attributes/DescriptionAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace BFR.Operations.Attributes -{ - class DescriptionAttribute : Attribute - { - public string Description { get; } - - public DescriptionAttribute(string description) => - Description = description; - } -} diff --git a/BFR/Operations/Attributes/DisplayNameAttribute.cs b/BFR/Operations/Attributes/DisplayNameAttribute.cs deleted file mode 100644 index 6982347..0000000 --- a/BFR/Operations/Attributes/DisplayNameAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace BFR.Operations.Attributes -{ - class DisplayNameAttribute : Attribute - { - public string DisplayName { get; } - - public DisplayNameAttribute(string displayName) => - DisplayName = displayName; - } -} diff --git a/BFR/Operations/OperationModeAttribute.cs b/BFR/Operations/OperationModeAttribute.cs new file mode 100644 index 0000000..4737703 --- /dev/null +++ b/BFR/Operations/OperationModeAttribute.cs @@ -0,0 +1,13 @@ +using System; + +namespace BFR.Operations +{ + class OperationModeAttribute : Attribute + { + public string DisplayName { get; } + public string Description { get; } + + public OperationModeAttribute(string displayName, string description) => + (DisplayName, Description) = (displayName, description); + } +} diff --git a/BFR/Operations/ReplaceMode.cs b/BFR/Operations/ReplaceMode.cs index 877c1af..03b6b28 100644 --- a/BFR/Operations/ReplaceMode.cs +++ b/BFR/Operations/ReplaceMode.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Collections.Generic; using BFR.Helpers; -using BFR.Operations.Attributes; namespace BFR.Operations { @@ -23,22 +22,22 @@ namespace BFR.Operations protected static ReplaceOperationMode[] All() => ((IEnumerable)Enum.GetValues(typeof(ReplaceMode))).Select(x => new ReplaceOperationMode( x, - x.GetAttribute().DisplayName, - x.GetAttribute().Description + x.GetAttribute().DisplayName, + x.GetAttribute().Description )).ToArray(); } public enum ReplaceMode { - [DisplayName(nameof(Pattern)), Description("Replaces the specified pattern.")] + [OperationMode(nameof(Pattern), "Replaces the specified pattern.")] Pattern, - [DisplayName(nameof(Characters)), Description("Replaces each of the specified characters.")] + [OperationMode(nameof(Characters), "Replaces each of the specified characters.")] Characters, - [DisplayName("From N to N"), Description("Replaces everything in the specified range (zero-based indeces).")] + [OperationMode("From N to N", "Replaces everything in the specified range (zero-based indeces).")] FromNToN, - [DisplayName("First N"), Description("Replaces the first N characters.")] + [OperationMode("First N", "Replaces the first N characters.")] FirstN, - [DisplayName("Last N"), Description("Replaces the last N characters.")] + [OperationMode("Last N", "Replaces the last N characters.")] LastN, } }