diff --git a/Creator/App.config b/Creator/App.config
index ba6b45f..b34a1ea 100644
--- a/Creator/App.config
+++ b/Creator/App.config
@@ -21,6 +21,10 @@
+
+
+
+
diff --git a/Creator/ApplicationArguments.cs b/Creator/ApplicationArguments.cs
deleted file mode 100644
index 181a794..0000000
--- a/Creator/ApplicationArguments.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System.ComponentModel;
-using System.IO;
-
-namespace KattekerCreator
-{
- public class ApplicationArguments
- {
- private string _changeLog;
- private string _programFile;
- private string _outputDir;
-
- [DisplayName("Program")]
- [Description("Path to the program file")]
- public string ProgramFile
- {
- get => _programFile;
- set => _programFile = Path.GetFullPath(value);
- }
-
- [DisplayName("Changelog")]
- [Description("Path of the changelog file")]
- public string ChangeLog
- {
- get => _changeLog;
- set => _changeLog = Path.GetFullPath(value);
- }
-
- [DisplayName("Channel")]
- [Description("Channel of releasing.")]
- public string Channel { get; set; }
-
- [DisplayName("Out")]
- [Description("Directory for the output")]
- public string OutputDir
- {
- get => _outputDir;
- set => _outputDir = Path.GetFullPath(value);
- }
-
- [DisplayName("Publish")]
- [Description("Path for output from the point of view of the application.")]
- public string PublishDir { get; set; }
-
- [DisplayName("Version")]
- [Description("Override version number of the application.")]
- public string Version { get; set; }
-
- [DisplayName("Filter")]
- [Description("Filter parameter. Use minimatch pattern.")]
- public string FilterAsString { get; set; }
-
- public string[] Filter => string.IsNullOrWhiteSpace(FilterAsString) ? new string[0] : FilterAsString.Split(';');
- }
-}
\ No newline at end of file
diff --git a/Creator/AssemblyFileInfo.cs b/Creator/AssemblyFileInfo.cs
index 9c826e7..b975f59 100644
--- a/Creator/AssemblyFileInfo.cs
+++ b/Creator/AssemblyFileInfo.cs
@@ -15,17 +15,17 @@ namespace KattekerCreator
private readonly string _description;
private readonly string _productName;
- public AssemblyFileInfo(ApplicationArguments appArguments, string tempDir)
+ public AssemblyFileInfo(string programFile, string version, string tempDir)
{
- FileInfo = new FileInfo(appArguments.ProgramFile);
+ FileInfo = new FileInfo(programFile);
using (var resourceInfo = new ResourceInfo())
{
- resourceInfo.Load(appArguments.ProgramFile);
+ resourceInfo.Load(programFile);
if (resourceInfo.ResourceTypes.All(x => x.ResourceType != Kernel32.ResourceTypes.RT_VERSION)) return;
var versionResource = (VersionResource) resourceInfo[Kernel32.ResourceTypes.RT_VERSION].First();
var stringFileInfo = ((StringFileInfo) versionResource[nameof(StringFileInfo)]).Strings
.FirstOrDefault().Value;
- AssemblyIconPath = GetAssemblyIcon(appArguments.ProgramFile, tempDir);
+ AssemblyIconPath = GetAssemblyIcon(programFile, tempDir);
if (stringFileInfo.Strings.ContainsKey("CompanyName"))
_company = stringFileInfo.Strings["CompanyName"].StringValue.TrimEnd('\0');
if (stringFileInfo.Strings.ContainsKey("FileDescription"))
@@ -35,7 +35,7 @@ namespace KattekerCreator
if (stringFileInfo.Strings.ContainsKey("ProductName"))
_productName = stringFileInfo.Strings["ProductName"].StringValue.TrimEnd('\0');
if (!stringFileInfo.Strings.ContainsKey("ProductVersion")) return;
- AssemblyVersion = appArguments.Version != null ? GetSemanticVersion(appArguments.Version) : GetSemanticVersion(stringFileInfo.Strings["ProductVersion"].StringValue.TrimEnd('\0'));
+ AssemblyVersion = version != null ? GetSemanticVersion(version) : GetSemanticVersion(stringFileInfo.Strings["ProductVersion"].StringValue.TrimEnd('\0'));
}
}
diff --git a/Creator/Helper/Minimatcher.cs b/Creator/Helper/Minimatcher.cs
index 450a0e9..3df30fa 100644
--- a/Creator/Helper/Minimatcher.cs
+++ b/Creator/Helper/Minimatcher.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using System.Text.RegularExpressions;
namespace Minimatch
diff --git a/Creator/Helper/SimpleCommandLineParser.cs b/Creator/Helper/SimpleCommandLineParser.cs
deleted file mode 100644
index bc9b96c..0000000
--- a/Creator/Helper/SimpleCommandLineParser.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-
-namespace KattekerCreator.Helper
-{
- public class SimpleCommandLineParser where TObject : new()
- {
- private TObject _parsedObject;
-
- public SimpleCommandLineParser(IEnumerable args)
- {
- Parse(args);
- }
-
- private IDictionary Arguments { get; } = new Dictionary();
-
- public bool Contains(string name) => Arguments.ContainsKey(name);
-
- public TObject GetObject()
- {
- if (!EqualityComparer.Default.Equals(_parsedObject, default(TObject)))
- return _parsedObject;
- _parsedObject = new TObject();
- try
- {
- LoopProperties(pi =>
- {
- var displayName = GetDisplayName(pi);
- if (displayName == null) return;
- if (!Arguments.TryGetValue(displayName.ToLowerInvariant(), out var argument)) return;
- if (pi.PropertyType == typeof(bool))
- {
- pi.SetValue(_parsedObject, true);
- return;
- }
- if (pi.PropertyType.IsArray)
- pi.SetValue(_parsedObject, argument);
- else
- pi.SetValue(_parsedObject, argument.FirstOrDefault());
- });
- }
- catch (Exception e)
- {
- Log.WriteErrorLine("Error parsing commandline arguments: " + e.Message);
- ShowHelp();
- }
- return _parsedObject;
- }
-
- public void ShowHelp(TextWriter textWriter = null)
- {
- if (textWriter == null) textWriter = Console.Out;
- var executable = Assembly.GetExecutingAssembly().GetName().Name + ".exe";
- var assemblyTitle = ((AssemblyTitleAttribute) Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false))?.Title ?? executable;
- var assemblyDescription = ((AssemblyDescriptionAttribute) Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute), false))?.Description;
-
- textWriter.WriteLine();
- textWriter.WriteLine(assemblyTitle);
- textWriter.WriteLine();
- textWriter.WriteLine(assemblyDescription);
- textWriter.WriteLine();
- textWriter.WriteLine(executable + " ");
- textWriter.WriteLine();
- var dict = new Dictionary();
- LoopProperties(pi =>
- {
- var displayName = GetDisplayName(pi);
- if (displayName == null) return;
- var description = GetDescription(pi);
- if (pi.PropertyType == typeof(bool)) description = "(Switch) " + description;
- dict.Add(displayName, description);
- });
- var longestWord = dict.Keys.Max(x => x.Length);
- foreach (var kv in dict)
- {
- textWriter.Write("-" + kv.Key.PadRight(longestWord + 3, ' '));
- textWriter.WriteLine(kv.Value);
- }
- textWriter.WriteLine();
- textWriter.WriteLine("A switch will be set to true, if it will called.");
- textWriter.WriteLine($"Example: {executable} ");
- textWriter.WriteLine();
- textWriter.WriteLine("A parameter will be set.");
- textWriter.WriteLine($"Example: {executable} \"Value\"");
- }
-
- ///
- /// Shows the current set options.
- ///
- /// If not set Console.Out will be set.
- public void ShowProgramArguments(TextWriter textWriter = null)
- {
- if (textWriter == null) textWriter = Console.Out;
- LoopProperties(pi =>
- {
- var displayName = GetDisplayName(pi);
- if (displayName == null) return;
- var value = pi.GetValue(_parsedObject);
- textWriter.Write(displayName.PadRight(20, ' '));
- if (value == null)
- {
- textWriter.WriteLine("");
- }
- else
- {
- if (value.GetType().IsArray)
- {
- var arrayAsString = ((IEnumerable) value)
- .Cast