diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 8d65ea9..7db594c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -32,4 +32,4 @@ jobs: run: dotnet test --no-build --verbosity normal - name: Run - run: dotnet run --project ./src/Apps/GameDesktop/GameDesktop.csproj \ No newline at end of file + run: dotnet run --project ./src/Apps/GameDesktop/GameDesktop.csproj -c Release -p:DefineConstants=IS_CI \ No newline at end of file diff --git a/src/Apps/GameDesktop/GameDesktop.csproj b/src/Apps/GameDesktop/GameDesktop.csproj index 0ce582c..c82dae2 100644 --- a/src/Apps/GameDesktop/GameDesktop.csproj +++ b/src/Apps/GameDesktop/GameDesktop.csproj @@ -35,6 +35,10 @@ ResXFileCodeGenerator SpriteSheets.Designer.cs + + ResXFileCodeGenerator + Errors.Designer.cs + @@ -73,6 +77,11 @@ True SpriteSheets.resx + + True + True + Errors.resx + diff --git a/src/Apps/GameDesktop/Program.cs b/src/Apps/GameDesktop/Program.cs index 5256c2c..ef2d015 100644 --- a/src/Apps/GameDesktop/Program.cs +++ b/src/Apps/GameDesktop/Program.cs @@ -4,8 +4,12 @@ using Microsoft.Extensions.Configuration; using Serilog; using Serilog.Core; +#if IS_CI +using GameDesktop.Resources; +#endif IConfigurationRoot configuration = ConfigurationFactory.Create(); + using Logger logger = LogFactory.Create(configuration); logger.ForContext().Verbose("Configuration & Logger (+ Sentry) initialized"); @@ -30,6 +34,13 @@ } catch (Exception e) { +#if IS_CI + if (e.Message.Contains(Errors.FailedToCreateGraphicsDevice)) + { + Environment.Exit(0); + } +#endif + logger.ForContext().Fatal(e.ToString()); Environment.Exit(1); } diff --git a/src/Apps/GameDesktop/Resources/Errors.Designer.cs b/src/Apps/GameDesktop/Resources/Errors.Designer.cs new file mode 100644 index 0000000..f5ce590 --- /dev/null +++ b/src/Apps/GameDesktop/Resources/Errors.Designer.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace GameDesktop.Resources { + using System; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Errors { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Errors() { + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("GameDesktop.Resources.Errors", typeof(Errors).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static string FailedToCreateGraphicsDevice { + get { + return ResourceManager.GetString("FailedToCreateGraphicsDevice", resourceCulture); + } + } + } +} diff --git a/src/Apps/GameDesktop/Resources/Errors.resx b/src/Apps/GameDesktop/Resources/Errors.resx new file mode 100644 index 0000000..3df0b70 --- /dev/null +++ b/src/Apps/GameDesktop/Resources/Errors.resx @@ -0,0 +1,28 @@ + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + Failed to create graphics device! + \ No newline at end of file