mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-24 12:06:34 +00:00
* Setup executable installer * Increment update to 0.9.3 * Improve installer
41 lines
965 B
C#
41 lines
965 B
C#
// See https://aka.ms/new-console-template for more information
|
|
using System.Diagnostics;
|
|
using System.IO.Compression;
|
|
|
|
const string tempFile = "tempfile.zip";
|
|
const string executableName = "Daybreak.exe";
|
|
Console.Title = "Daybreak Installer";
|
|
Console.WriteLine("Starting installation...");
|
|
if (File.Exists(tempFile) is false)
|
|
{
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
|
Console.WriteLine("Unable to find launcher package. Aborting installation");
|
|
Console.ReadKey();
|
|
return;
|
|
}
|
|
|
|
Console.WriteLine("Unpacking files...");
|
|
try
|
|
{
|
|
ZipFile.ExtractToDirectory(tempFile, AppContext.BaseDirectory, true);
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
Console.WriteLine("Deleting package");
|
|
File.Delete(tempFile);
|
|
Console.WriteLine("Launching application");
|
|
var process = new Process
|
|
{
|
|
StartInfo = new ProcessStartInfo
|
|
{
|
|
FileName = executableName
|
|
}
|
|
};
|
|
|
|
if (process.Start() is false)
|
|
{
|
|
Console.WriteLine("Failed to launch application");
|
|
Console.ReadKey();
|
|
} |