diff --git a/.editorconfig b/.editorconfig index 791f05ca4..a0afeab7f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,7 +8,7 @@ root = true indent_style = tab # Xml project files -[*.{csproj}] +[*.{csproj,json}] indent_style = space indent_size = 2 diff --git a/Build/NuGetPackageSpecs/Duality.Launcher.nuspec b/Build/NuGetPackageSpecs/Duality.Launcher.nuspec deleted file mode 100644 index d2762dab5..000000000 --- a/Build/NuGetPackageSpecs/Duality.Launcher.nuspec +++ /dev/null @@ -1,29 +0,0 @@ - - - - AdamsLair.Duality.Launcher - 4.0.0-alpha3 - Duality Core Team - Duality Core Team - Duality Launcher - icon.png - MIT - https://github.com/AdamsLair/duality - false - The default launcher application for Duality games. - The default launcher application for Duality games. - Duality Launcher - Patch Version Update - - - - - - - - - - - - - diff --git a/Source/Launcher/Program.cs b/Source/Core/Duality/Launcher/DualityLauncher.cs similarity index 85% rename from Source/Launcher/Program.cs rename to Source/Core/Duality/Launcher/DualityLauncher.cs index c3fc74ab2..00690731c 100644 --- a/Source/Launcher/Program.cs +++ b/Source/Core/Duality/Launcher/DualityLauncher.cs @@ -1,20 +1,14 @@ using System; -using System.Linq; -using System.Diagnostics; -using System.Runtime.InteropServices; using System.IO; -using System.Drawing; - -using Duality; -using Duality.Resources; +using System.Linq; using Duality.Backend; +using Duality.Resources; namespace Duality.Launcher { - internal static class Program + public class DualityLauncher { - [STAThread] - public static void Main(string[] args) + public static void Run(string[] args) { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture; @@ -22,8 +16,7 @@ public static void Main(string[] args) bool isDebugging = System.Diagnostics.Debugger.IsAttached || args.Contains(DualityApp.CmdArgDebug); bool isRunFromEditor = args.Contains(DualityApp.CmdArgEditor); bool isProfiling = args.Contains(DualityApp.CmdArgProfiling); - if (isDebugging || isRunFromEditor) ShowConsole(); - + // Set up console logging Logs.AddGlobalOutput(new ConsoleLogOutput()); @@ -46,7 +39,7 @@ public static void Main(string[] args) AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; // Write initial log message before actually booting Duality - Logs.Core.Write("Running DualityLauncher with flags: {1}{0}", + Logs.Core.Write("Running DualityLauncher with flags: {1}{0}", Environment.NewLine, new[] { isDebugging ? "Debugging" : null, isProfiling ? "Profiling" : null, isRunFromEditor ? "RunFromEditor" : null }.NotNull().ToString(", ")); @@ -56,7 +49,7 @@ public static void Main(string[] args) DualityApp.ExecutionContext.Game, new DefaultAssemblyLoader(), args); - + // Open up a new window WindowOptions options = new WindowOptions { @@ -77,15 +70,13 @@ public static void Main(string[] args) // Shut down the Duality core DualityApp.Terminate(); } - + // Clean up the log file if (logfileWriter != null) { Logs.RemoveGlobalOutput(logfileOutput); logfileWriter.Flush(); logfileWriter.Close(); - logfileWriter = null; - logfileOutput = null; } } @@ -94,16 +85,8 @@ private static void CurrentDomain_UnhandledException(object sender, UnhandledExc try { Logs.Core.WriteError(LogFormat.Exception(e.ExceptionObject as Exception)); - } + } catch (Exception) { /* Ensure we're not causing any further exception by logging... */ } } - - private static bool hasConsole = false; - public static void ShowConsole() - { - if (hasConsole) return; - SafeNativeMethods.AllocConsole(); - hasConsole = true; - } } -} +} \ No newline at end of file diff --git a/Source/Launcher/ConsoleLogOutput.cs b/Source/Core/Duality/Utility/Log/ConsoleLogOutput.cs similarity index 99% rename from Source/Launcher/ConsoleLogOutput.cs rename to Source/Core/Duality/Utility/Log/ConsoleLogOutput.cs index 6edaab573..f5979ebf7 100644 --- a/Source/Launcher/ConsoleLogOutput.cs +++ b/Source/Core/Duality/Utility/Log/ConsoleLogOutput.cs @@ -1,6 +1,7 @@ using System; +using Duality; -namespace Duality.Launcher +namespace Duality { /// /// A Log output that uses the as message destination. diff --git a/Source/DualityTemplates/Templates/SolutionTemplate/DualityGame.sln b/Source/DualityTemplates/Templates/SolutionTemplate/DualityGame.sln index 7eef593b9..52d7debfd 100644 --- a/Source/DualityTemplates/Templates/SolutionTemplate/DualityGame.sln +++ b/Source/DualityTemplates/Templates/SolutionTemplate/DualityGame.sln @@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29911.84 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameLauncher", "Source\Launchers\GameLauncher\GameLauncher.csproj", "{EB32E368-2C3C-444F-9F7A-C808C03D462E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DualityGame", "Source\Launchers\DualityGame\DualityGame.csproj", "{EB32E368-2C3C-444F-9F7A-C808C03D462E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameEditor", "Source\Launchers\GameEditor\GameEditor.csproj", "{E587311C-714A-4078-ADAE-EC00E8D971CB}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DualityGameCorePlugin", "Source\Plugins\DualityGameCorePlugin\DualityGameCorePlugin.csproj", "{E77740F1-234A-4B92-B1BC-43AD9EB9BA03}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Source\Plugins", "{F75B2813-797D-44A5-A301-331C229992C7}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{F75B2813-797D-44A5-A301-331C229992C7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DualityGameEditorPlugin", "Source\Plugins\DualityGameEditorPlugin\DualityGameEditorPlugin.csproj", "{F0DCA20C-6888-4294-97C4-14C82B4DBC82}" EndProject diff --git a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/Directory.Build.props b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/Directory.Build.props index abaca8d13..a06c287b7 100644 --- a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/Directory.Build.props +++ b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/Directory.Build.props @@ -31,8 +31,4 @@ - - - true - \ No newline at end of file diff --git a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameLauncher/GameLauncher.csproj b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/DualityGame.csproj similarity index 85% rename from Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameLauncher/GameLauncher.csproj rename to Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/DualityGame.csproj index 211b90ec9..375f92be1 100644 --- a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameLauncher/GameLauncher.csproj +++ b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/DualityGame.csproj @@ -1,9 +1,12 @@  + + Exe + + - diff --git a/Source/Launcher/NativeMethods.cs b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/NativeMethods.cs similarity index 59% rename from Source/Launcher/NativeMethods.cs rename to Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/NativeMethods.cs index 275ca69dc..992bca669 100644 --- a/Source/Launcher/NativeMethods.cs +++ b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/NativeMethods.cs @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Runtime.InteropServices; -using System.Drawing; -namespace Duality.Launcher +namespace DualityGame { internal static class NativeMethods { diff --git a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/Program.cs b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/Program.cs new file mode 100644 index 000000000..0aebd4254 --- /dev/null +++ b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/Program.cs @@ -0,0 +1,27 @@ +using System; +using System.Linq; +using Duality; +using Duality.Launcher; + +namespace DualityGame +{ + internal static class Program + { + [STAThread] + public static void Main(string[] args) + { + bool isDebugging = System.Diagnostics.Debugger.IsAttached || args.Contains(DualityApp.CmdArgDebug); + bool isRunFromEditor = args.Contains(DualityApp.CmdArgEditor); + if (isDebugging || isRunFromEditor) ShowConsole(); + DualityLauncher.Run(args); + } + + private static bool hasConsole = false; + private static void ShowConsole() + { + if (hasConsole) return; + SafeNativeMethods.AllocConsole(); + hasConsole = true; + } + } +} diff --git a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameLauncher/Properties/launchSettings.json b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/Properties/launchSettings.json similarity index 71% rename from Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameLauncher/Properties/launchSettings.json rename to Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/Properties/launchSettings.json index f197895e8..919856728 100644 --- a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameLauncher/Properties/launchSettings.json +++ b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/Properties/launchSettings.json @@ -2,8 +2,8 @@ "profiles": { "Debug Game": { "commandName": "Executable", - "executablePath": ".\\DualityLauncher.exe", + "executablePath": ".\\DualityGame.exe", "workingDirectory": ".\\..\\..\\.." } } -} \ No newline at end of file +} diff --git a/Source/Launcher/SafeNativeMethods.cs b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/SafeNativeMethods.cs similarity index 61% rename from Source/Launcher/SafeNativeMethods.cs rename to Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/SafeNativeMethods.cs index b2a4eed9b..d5cf56b1e 100644 --- a/Source/Launcher/SafeNativeMethods.cs +++ b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/DualityGame/SafeNativeMethods.cs @@ -1,11 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; -using System.Drawing; -namespace Duality.Launcher +namespace DualityGame { internal static class SafeNativeMethods { diff --git a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameEditor/GameEditor.csproj b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameEditor/GameEditor.csproj index 67e90cf4c..a7d108b1d 100644 --- a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameEditor/GameEditor.csproj +++ b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Launchers/GameEditor/GameEditor.csproj @@ -1,5 +1,5 @@  - + @@ -11,12 +11,15 @@ - + - - false - + - + + + + true + + \ No newline at end of file diff --git a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Plugins/DualityGameCorePlugin/DualityGameCorePlugin.csproj b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Plugins/DualityGameCorePlugin/DualityGameCorePlugin.csproj index 4010aaf21..14adaf517 100644 --- a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Plugins/DualityGameCorePlugin/DualityGameCorePlugin.csproj +++ b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Plugins/DualityGameCorePlugin/DualityGameCorePlugin.csproj @@ -4,7 +4,7 @@ netstandard2.0 false true - DualityGameCorePlugin.core + DualityGameCorePlugin.core diff --git a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Plugins/DualityGameEditorPlugin/DualityGameEditorPlugin.csproj b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Plugins/DualityGameEditorPlugin/DualityGameEditorPlugin.csproj index cdb28dca6..49b509e63 100644 --- a/Source/DualityTemplates/Templates/SolutionTemplate/Source/Plugins/DualityGameEditorPlugin/DualityGameEditorPlugin.csproj +++ b/Source/DualityTemplates/Templates/SolutionTemplate/Source/Plugins/DualityGameEditorPlugin/DualityGameEditorPlugin.csproj @@ -4,7 +4,7 @@ net472 false true - DualityGameEditorPlugin.editor + DualityGameEditorPlugin.editor diff --git a/Source/Launcher/DualityLauncher.csproj b/Source/Launcher/DualityLauncher.csproj index 6b181f88d..aac448f01 100644 --- a/Source/Launcher/DualityLauncher.csproj +++ b/Source/Launcher/DualityLauncher.csproj @@ -1,16 +1,18 @@  - - net472 - 7.3 - $(RootFolder)Build\Output\ - Copyright © Duality Core Team 2020 - Duality.Launcher - false - DualityIcon.ico - Exe - 4.0.0-alpha3 - + + net472 + 7.3 + $(RootFolder)Build\Output\ + Copyright © Duality Core Team 2020 + DualityGame + false + DualityIcon.ico + WinExe + 4.0.0-alpha3 + false + DualityGame + @@ -24,6 +26,7 @@ +