using System.ComponentModel; using System.IO; namespace KattekerCreator { public class ApplicationArguments { private string _changeLog; private string _channel; private string _outputDir; private string _programFile; private string _publishDir; [DisplayName("Program")] [Description("Path to the program file")] public string ProgramFile { get => _programFile; set => SetPropertyIfNotDefault(ref _programFile, Path.GetFullPath(value)); } [DisplayName("Changelog")] [Description("Filename of the changelog file")] public string ChangeLog { get => _changeLog; set => SetPropertyIfNotDefault(ref _changeLog, value); } [DisplayName("Channel")] [Description("Channel of releasing.")] public string Channel { get => _channel; set => SetPropertyIfNotDefault(ref _channel, value); } [DisplayName("OutDir")] [Description("Directory for output")] public string OutputDir { get => _outputDir; set => SetPropertyIfNotDefault(ref _outputDir, value); } [DisplayName("PublishDir")] [Description("Path for output from the point of view of the application.")] public string PublishDir { get => _publishDir; set => SetPropertyIfNotDefault(ref _publishDir, 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; } } }