Refactored ChangelogHelper

This commit is contained in:
Holger Boerchers
2018-05-26 23:18:39 +02:00
parent 71d5981b8d
commit d87adfc7f0
2 changed files with 45 additions and 30 deletions

View File

@ -10,7 +10,7 @@ namespace KattekerCreator
{
public class Program
{
private const string _executable = @"C:\Program Files (x86)\NSIS\makensis.exe";
private const string Executable = @"C:\Program Files (x86)\NSIS\makensis.exe";
private readonly string _baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
private ApplicationArguments _appArguments;
private AssemblyFileInfo _assemblyFileInfo;
@ -118,13 +118,13 @@ namespace KattekerCreator
private static string CompileSetupScript(string templateFile)
{
if (!File.Exists(_executable)) throw new FileNotFoundException("NSIS not installed properly.");
if (!File.Exists(Executable)) throw new FileNotFoundException("NSIS not installed properly.");
int exitcode;
using (var p = new Process())
{
p.StartInfo = new ProcessStartInfo
{
FileName = _executable,
FileName = Executable,
Arguments = $"\"{templateFile}\"",
UseShellExecute = false
};
@ -132,10 +132,10 @@ namespace KattekerCreator
p.Start();
p.WaitForExit();
exitcode = p.ExitCode;
Log.WriteInfoLine($"{Path.GetFileName(_executable)} has exited with Exitcode: {exitcode} (Took: {sw.ElapsedMilliseconds}ms)");
Log.WriteInfoLine($"{Path.GetFileName(Executable)} has exited with Exitcode: {exitcode} (Took: {sw.ElapsedMilliseconds}ms)");
}
if (exitcode != 0) throw new Exception($"{Path.GetFileName(_executable)} has exited with Exitcode: {exitcode}");
if (exitcode != 0) throw new Exception($"{Path.GetFileName(Executable)} has exited with Exitcode: {exitcode}");
return Path.ChangeExtension(templateFile, "exe");
}