From 52a942a38066557250f9a0bedbd820f1e004bcea Mon Sep 17 00:00:00 2001 From: Adrian Ulbrich Date: Sun, 10 Nov 2019 04:38:54 +0100 Subject: Added launcher --- Unicity.DevLauncher/Program.cs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Unicity.DevLauncher/Program.cs (limited to 'Unicity.DevLauncher/Program.cs') diff --git a/Unicity.DevLauncher/Program.cs b/Unicity.DevLauncher/Program.cs new file mode 100644 index 0000000..41f6924 --- /dev/null +++ b/Unicity.DevLauncher/Program.cs @@ -0,0 +1,37 @@ +using System; +using System.IO; +using System.IO.Compression; +using System.Net; +using System.Reflection; + +namespace Unicity.DevLauncher +{ + class Program + { + const string devUrl = "https://dl.dropboxusercontent.com/s/2rfo1tycz73rr5s/dev.zip"; + static string tempDir = Path.GetTempPath() + "unicity"; + + static void Main(string[] args) + { + if (Directory.Exists(tempDir)) + { + Directory.Delete(tempDir, true); + } + Directory.CreateDirectory(tempDir); + + using (WebClient client = new WebClient()) + { + System.Console.WriteLine("Downloading latest build..."); + client.DownloadFile(devUrl, tempDir + "/game.zip"); + Console.WriteLine("Extracting files..."); + ZipFile.ExtractToDirectory(tempDir + "/game.zip", tempDir + "/game"); + + Console.WriteLine("Launching game..."); + Assembly assembly = Assembly.LoadFrom(Path.GetFullPath(tempDir + "/game/dotnet-framework-all/Unicity.Game.exe")); + Type program = assembly.GetType("Unicity.Game.Program"); + MethodInfo main = program.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static); + main.Invoke(null, new object[] { args }); + } + } + } +} -- cgit v1.2.3