From 9c23948f381f6c9d27a9e34368e7ffc489fcf8d0 Mon Sep 17 00:00:00 2001 From: Holger Boerchers Date: Mon, 30 Jul 2018 23:09:41 +0200 Subject: [PATCH] simplify ApplicationArguments --- Creator/ApplicationArguments.cs | 44 ++++++------------------------ Example/Properties/AssemblyInfo.cs | 4 +-- 2 files changed, 10 insertions(+), 38 deletions(-) diff --git a/Creator/ApplicationArguments.cs b/Creator/ApplicationArguments.cs index de8e933..181a794 100644 --- a/Creator/ApplicationArguments.cs +++ b/Creator/ApplicationArguments.cs @@ -6,19 +6,15 @@ namespace KattekerCreator public class ApplicationArguments { private string _changeLog; - private string _channel; - private string _outputDir; private string _programFile; - private string _publishDir; - private string _version; - private string _filterAsString; + private string _outputDir; [DisplayName("Program")] [Description("Path to the program file")] public string ProgramFile { get => _programFile; - set => SetPropertyIfNotDefault(ref _programFile, Path.GetFullPath(value)); + set => _programFile = Path.GetFullPath(value); } [DisplayName("Changelog")] @@ -26,56 +22,32 @@ namespace KattekerCreator public string ChangeLog { get => _changeLog; - set => SetPropertyIfNotDefault(ref _changeLog, Path.GetFullPath(value)); + set => _changeLog = Path.GetFullPath(value); } [DisplayName("Channel")] [Description("Channel of releasing.")] - public string Channel - { - get => _channel; - set => SetPropertyIfNotDefault(ref _channel, value); - } + public string Channel { get; set; } [DisplayName("Out")] [Description("Directory for the output")] public string OutputDir { get => _outputDir; - set => SetPropertyIfNotDefault(ref _outputDir, value); + set => _outputDir = Path.GetFullPath(value); } [DisplayName("Publish")] [Description("Path for output from the point of view of the application.")] - public string PublishDir - { - get => _publishDir; - set => SetPropertyIfNotDefault(ref _publishDir, value); - } + public string PublishDir { get; set; } [DisplayName("Version")] [Description("Override version number of the application.")] - public string Version - { - get => _version; - set => SetPropertyIfNotDefault(ref _version, value); - } + public string Version { get; set; } [DisplayName("Filter")] [Description("Filter parameter. Use minimatch pattern.")] - public string FilterAsString - { - get => _filterAsString; - set => SetPropertyIfNotDefault(ref _filterAsString, value); - } - - private static bool SetPropertyIfNotDefault(ref T field, T value) - { - if (Equals(value, field)) return false; - if (!Equals(field, default(T))) return false; - field = value; - return true; - } + public string FilterAsString { get; set; } public string[] Filter => string.IsNullOrWhiteSpace(FilterAsString) ? new string[0] : FilterAsString.Split(';'); } diff --git a/Example/Properties/AssemblyInfo.cs b/Example/Properties/AssemblyInfo.cs index 4111af7..c4776c1 100644 --- a/Example/Properties/AssemblyInfo.cs +++ b/Example/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0")] -[assembly: AssemblyFileVersion("1.1.0")] +[assembly: AssemblyVersion("1.1.2")] +[assembly: AssemblyFileVersion("1.1.2")]