Compare commits

..

No commits in common. "26343921f731eb6e6a76f32711ffdd5661979f76" and "f7800dfb113e721ec1c5964f124ac4b3d2a246a4" have entirely different histories.

2 changed files with 28 additions and 43 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;
@ -119,13 +119,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
};
@ -133,10 +133,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");
}

View File

@ -48,16 +48,7 @@ namespace Katteker
{
if (!path.EndsWith("/", StringComparison.Ordinal))
path += "/";
var changelog = await ReadFromRemoteFile(path + filename) ?? ReadFromLocalFile(filename);
return changelog;
}
return null;
}
private static async Task<string> ReadFromRemoteFile(string path)
{
var webReq = WebRequest.Create(path);
var webReq = WebRequest.Create(path + filename);
try
{
using (var response = await webReq.GetResponseAsync().ConfigureAwait(false))
@ -67,30 +58,24 @@ namespace Katteker
}
}
catch (Exception)
{
// ignore;
}
return null;
}
private static string ReadFromLocalFile(string filename)
{
try
{
var changelogFilename = Path.GetFileName(filename);
if (changelogFilename == null) return null;
var currentChangelogPath = Path.Combine(Environment.CurrentDirectory, changelogFilename);
if (File.Exists(currentChangelogPath))
{
return File.ReadAllText(currentChangelogPath);
}
}
catch (Exception)
{
// ignore;
}
}
}
return null;
}