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..0e957f1 100644 --- a/src/Apps/GameDesktop/Program.cs +++ b/src/Apps/GameDesktop/Program.cs @@ -1,11 +1,14 @@ using System; using GameDesktop; +using GameDesktop.Resources; using LightInject; using Microsoft.Extensions.Configuration; using Serilog; using Serilog.Core; IConfigurationRoot configuration = ConfigurationFactory.Create(); +bool IsCI = configuration.GetValue("IS_CI", "false") == "true"; + using Logger logger = LogFactory.Create(configuration); logger.ForContext().Verbose("Configuration & Logger (+ Sentry) initialized"); @@ -30,6 +33,11 @@ } catch (Exception e) { + if (e.Message.Contains(Errors.NoGraphicsDevice) && IsCI) + { + Environment.Exit(0); + } + 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..6b9c201 --- /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 NoGraphicsDevice { + get { + return ResourceManager.GetString("NoGraphicsDevice", resourceCulture); + } + } + } +} diff --git a/src/Apps/GameDesktop/Resources/Errors.resx b/src/Apps/GameDesktop/Resources/Errors.resx new file mode 100644 index 0000000..52765e0 --- /dev/null +++ b/src/Apps/GameDesktop/Resources/Errors.resx @@ -0,0 +1,30 @@ + + + + + + + + + + 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 + + + + + Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException: Failed to create graphics device! + + \ No newline at end of file