simplify ApplicationArguments

This commit is contained in:
Holger Boerchers 2018-07-30 23:09:41 +02:00
parent aa70a24a26
commit 9c23948f38
2 changed files with 10 additions and 38 deletions

View File

@ -6,19 +6,15 @@ namespace KattekerCreator
public class ApplicationArguments public class ApplicationArguments
{ {
private string _changeLog; private string _changeLog;
private string _channel;
private string _outputDir;
private string _programFile; private string _programFile;
private string _publishDir; private string _outputDir;
private string _version;
private string _filterAsString;
[DisplayName("Program")] [DisplayName("Program")]
[Description("Path to the program file")] [Description("Path to the program file")]
public string ProgramFile public string ProgramFile
{ {
get => _programFile; get => _programFile;
set => SetPropertyIfNotDefault(ref _programFile, Path.GetFullPath(value)); set => _programFile = Path.GetFullPath(value);
} }
[DisplayName("Changelog")] [DisplayName("Changelog")]
@ -26,56 +22,32 @@ namespace KattekerCreator
public string ChangeLog public string ChangeLog
{ {
get => _changeLog; get => _changeLog;
set => SetPropertyIfNotDefault(ref _changeLog, Path.GetFullPath(value)); set => _changeLog = Path.GetFullPath(value);
} }
[DisplayName("Channel")] [DisplayName("Channel")]
[Description("Channel of releasing.")] [Description("Channel of releasing.")]
public string Channel public string Channel { get; set; }
{
get => _channel;
set => SetPropertyIfNotDefault(ref _channel, value);
}
[DisplayName("Out")] [DisplayName("Out")]
[Description("Directory for the output")] [Description("Directory for the output")]
public string OutputDir public string OutputDir
{ {
get => _outputDir; get => _outputDir;
set => SetPropertyIfNotDefault(ref _outputDir, value); set => _outputDir = Path.GetFullPath(value);
} }
[DisplayName("Publish")] [DisplayName("Publish")]
[Description("Path for output from the point of view of the application.")] [Description("Path for output from the point of view of the application.")]
public string PublishDir public string PublishDir { get; set; }
{
get => _publishDir;
set => SetPropertyIfNotDefault(ref _publishDir, value);
}
[DisplayName("Version")] [DisplayName("Version")]
[Description("Override version number of the application.")] [Description("Override version number of the application.")]
public string Version public string Version { get; set; }
{
get => _version;
set => SetPropertyIfNotDefault(ref _version, value);
}
[DisplayName("Filter")] [DisplayName("Filter")]
[Description("Filter parameter. Use minimatch pattern.")] [Description("Filter parameter. Use minimatch pattern.")]
public string FilterAsString public string FilterAsString { get; set; }
{
get => _filterAsString;
set => SetPropertyIfNotDefault(ref _filterAsString, value);
}
private static bool SetPropertyIfNotDefault<T>(ref T field, T value)
{
if (Equals(value, field)) return false;
if (!Equals(field, default(T))) return false;
field = value;
return true;
}
public string[] Filter => string.IsNullOrWhiteSpace(FilterAsString) ? new string[0] : FilterAsString.Split(';'); public string[] Filter => string.IsNullOrWhiteSpace(FilterAsString) ? new string[0] : FilterAsString.Split(';');
} }

View File

@ -49,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")] [assembly: AssemblyVersion("1.1.2")]
[assembly: AssemblyFileVersion("1.1.0")] [assembly: AssemblyFileVersion("1.1.2")]