diff --git a/.gitignore b/.gitignore index 9414c53..209c75b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/ bin/ obj/ -.vs/ \ No newline at end of file +.vs/ +packages \ No newline at end of file diff --git a/H1emu/FodyWeavers.xml b/H1emu/FodyWeavers.xml new file mode 100644 index 0000000..5029e70 --- /dev/null +++ b/H1emu/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/H1emu/FodyWeavers.xsd b/H1emu/FodyWeavers.xsd new file mode 100644 index 0000000..e82ada3 --- /dev/null +++ b/H1emu/FodyWeavers.xsd @@ -0,0 +1,136 @@ + + + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with line breaks. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Controls if (.NET Core) runtime assemblies are also embedded. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with |. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/H1emu/H1emu.csproj b/H1emu/H1emu.csproj index 1007ce3..00cfe8a 100644 --- a/H1emu/H1emu.csproj +++ b/H1emu/H1emu.csproj @@ -1,5 +1,6 @@  + Debug @@ -14,6 +15,8 @@ 4 true + + AnyCPU @@ -35,13 +38,71 @@ 4 + + ..\packages\Costura.Fody.5.0.2\lib\netstandard1.0\Costura.dll + + + ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll + + + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + + + ..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll + + + + ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll + + + ..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll + + + ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll + + + + ..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll + + + ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll + + + ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll + + + ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + + + ..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll + + + + ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + + + ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll + + + ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + + + ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + 4.0 + + + ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll + @@ -51,6 +112,9 @@ MSBuild:Compile Designer + + UpdateWindow.xaml + MSBuild:Compile Designer @@ -63,6 +127,10 @@ MainWindow.xaml Code + + Designer + MSBuild:Compile + @@ -80,6 +148,7 @@ + @@ -92,4 +161,12 @@ + + + + Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}. + + + + \ No newline at end of file diff --git a/H1emu/MainWindow.xaml b/H1emu/MainWindow.xaml index c4b958b..a5f6591 100644 --- a/H1emu/MainWindow.xaml +++ b/H1emu/MainWindow.xaml @@ -1,9 +1,9 @@  /// Interaction logic for MainWindow.xaml @@ -24,6 +28,33 @@ public MainWindow() powershellShell.FileName = "powershell.exe"; powershellShell.RedirectStandardInput = true; powershellShell.UseShellExecute = false; + string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + String localVersion = version.TrimEnd('0').TrimEnd('.'); + GetLatestOnlineVersion(localVersion); + } + + static readonly HttpClient client = new HttpClient(); + + static async Task GetLatestOnlineVersion(String localeVersion) + { + var _UserAgent = "d-fens HttpClient"; + client.DefaultRequestHeaders.Add("User-Agent", _UserAgent); + try + { + HttpResponseMessage response = await client.GetAsync("https://api.github.com/repos/H1emu/H1emu-server-app/releases/latest"); + response.EnsureSuccessStatusCode(); + string responseBody = await response.Content.ReadAsStringAsync(); + String LatestOnlineVersion = JObject.Parse(responseBody).SelectToken("tag_name").ToString().TrimStart('v'); + if (localeVersion != LatestOnlineVersion) + { + new UpdateWindow().Show(); + } + } + catch (HttpRequestException e) + { + Console.WriteLine("\nException Caught!"); + Console.WriteLine("Message :{0} ", e.Message); + } } @@ -105,7 +136,7 @@ private void LaunchH1Z1_OnClick(object sender, RoutedEventArgs e) private void InstallLatest_OnClick(object sender, RoutedEventArgs e) { InstallServer(); - + Process p = new Process(); p.StartInfo = cmdShell; diff --git a/H1emu/UpdateWindow.xaml b/H1emu/UpdateWindow.xaml new file mode 100644 index 0000000..029e499 --- /dev/null +++ b/H1emu/UpdateWindow.xaml @@ -0,0 +1,20 @@ + + + + + diff --git a/H1emu/UpdateWindow.xaml.cs b/H1emu/UpdateWindow.xaml.cs new file mode 100644 index 0000000..b83306c --- /dev/null +++ b/H1emu/UpdateWindow.xaml.cs @@ -0,0 +1,21 @@ +using System.Windows; + +namespace H1emu +{ + /// + /// Logique d'interaction pour UpdateWindow.xaml + /// + public partial class UpdateWindow : Window + { + public UpdateWindow() + { + InitializeComponent(); + } + public void DownloadUpdate(object sender, RoutedEventArgs e) + { + string url = "https://github.com/H1emu/H1emu-server-app/releases/latest/download/H1emu.exe"; + + System.Diagnostics.Process.Start(url); + } + } +} diff --git a/H1emu/packages.config b/H1emu/packages.config new file mode 100644 index 0000000..3187aee --- /dev/null +++ b/H1emu/packages.config @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file