diff --git a/build/Stride.Launcher.sln b/build/Stride.Launcher.sln index 3bc538f023..a17b46d68b 100644 --- a/build/Stride.Launcher.sln +++ b/build/Stride.Launcher.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28803.352 +# Visual Studio Version 18 +VisualStudioVersion = 18.1.11312.151 d18.0 MinimumVisualStudioVersion = 16.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Launcher", "..\sources\launcher\Stride.Launcher\Stride.Launcher.csproj", "{0F8BE30E-C41F-4747-B52B-D2D4E13EC6A2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Launcher", "..\sources\launcher\Stride.Launcher\Stride.Launcher.csproj", "{78695DE1-E621-45DF-975D-CFD407081E23}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core", "..\sources\core\Stride.Core\Stride.Core.csproj", "{BAC8FB10-95ED-4FBB-9925-F6F0E15BD936}" EndProject @@ -21,34 +21,32 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.IO", "..\source EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.MicroThreading", "..\sources\core\Stride.Core.MicroThreading\Stride.Core.MicroThreading.csproj", "{076940AD-70F3-47A8-827C-8E722714F937}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.Presentation.Wpf", "..\sources\presentation\Stride.Core.Presentation.Wpf\Stride.Core.Presentation.Wpf.csproj", "{61E90191-22FF-4ADC-AFD0-FAB662589AB4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.Translation", "..\sources\core\Stride.Core.Translation\Stride.Core.Translation.csproj", "{8A23DF78-B3D6-41BD-BA50-19D0FBE4AB69}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.Presentation.Dialogs", "..\sources\presentation\Stride.Core.Presentation.Dialogs\Stride.Core.Presentation.Dialogs.csproj", "{5EB0493A-076D-4488-AF08-D812FB3FDF7C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.Packages", "..\sources\assets\Stride.Core.Packages\Stride.Core.Packages.csproj", "{1F5FBA04-C334-41C2-895A-ACC4B786F99E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.Translation", "..\sources\core\Stride.Core.Translation\Stride.Core.Translation.csproj", "{8A23DF78-B3D6-41BD-BA50-19D0FBE4AB69}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.Presentation", "..\sources\presentation\Stride.Core.Presentation\Stride.Core.Presentation.csproj", "{0C63EF8B-26F9-4511-9FC5-7431DE9657D6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.Translation.Presentation", "..\sources\presentation\Stride.Core.Translation.Presentation\Stride.Core.Translation.Presentation.csproj", "{7B286D71-5143-4A08-B9DE-113B310A3F0C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.CompilerServices", "..\sources\core\Stride.Core.CompilerServices\Stride.Core.CompilerServices.csproj", "{ADE0E241-CBDD-48C3-8F50-98FFE76C03C8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.Packages", "..\sources\assets\Stride.Core.Packages\Stride.Core.Packages.csproj", "{1F5FBA04-C334-41C2-895A-ACC4B786F99E}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10-CoreRuntime", "10-CoreRuntime", "{706260A8-86D4-432D-9FE0-F312863288F5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "30-CoreDesign", "30-CoreDesign", "{FE721A31-DF09-4E33-B791-BEC6C9E1C6F1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "50-Presentation", "50-Presentation", "{3BC606D7-27B3-41FA-8FB3-9D56AC8B4DD7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stride.Core.Presentation", "..\sources\presentation\Stride.Core.Presentation\Stride.Core.Presentation.csproj", "{0C63EF8B-26F9-4511-9FC5-7431DE9657D6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.Core.Presentation.Avalonia", "..\sources\presentation\Stride.Core.Presentation.Avalonia\Stride.Core.Presentation.Avalonia.csproj", "{3B613E66-671E-4049-8EF5-43CDAA549210}" EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\sources\assets\Stride.Core.Assets.Yaml\Stride.Core.Assets.Yaml.projitems*{0f8be30e-c41f-4747-b52b-d2d4e13ec6a2}*SharedItemsImports = 5 - ..\sources\editor\Stride.Core.MostRecentlyUsedFiles\Stride.Core.MostRecentlyUsedFiles.projitems*{0f8be30e-c41f-4747-b52b-d2d4e13ec6a2}*SharedItemsImports = 5 - ..\sources\editor\Stride.Editor.CrashReport\Stride.Editor.CrashReport.projitems*{0f8be30e-c41f-4747-b52b-d2d4e13ec6a2}*SharedItemsImports = 5 - ..\sources\editor\Stride.PrivacyPolicy\Stride.PrivacyPolicy.projitems*{0f8be30e-c41f-4747-b52b-d2d4e13ec6a2}*SharedItemsImports = 5 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0F8BE30E-C41F-4747-B52B-D2D4E13EC6A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F8BE30E-C41F-4747-B52B-D2D4E13EC6A2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F8BE30E-C41F-4747-B52B-D2D4E13EC6A2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F8BE30E-C41F-4747-B52B-D2D4E13EC6A2}.Release|Any CPU.Build.0 = Release|Any CPU + {78695DE1-E621-45DF-975D-CFD407081E23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78695DE1-E621-45DF-975D-CFD407081E23}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78695DE1-E621-45DF-975D-CFD407081E23}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78695DE1-E621-45DF-975D-CFD407081E23}.Release|Any CPU.Build.0 = Release|Any CPU {BAC8FB10-95ED-4FBB-9925-F6F0E15BD936}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BAC8FB10-95ED-4FBB-9925-F6F0E15BD936}.Debug|Any CPU.Build.0 = Debug|Any CPU {BAC8FB10-95ED-4FBB-9925-F6F0E15BD936}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -81,22 +79,10 @@ Global {076940AD-70F3-47A8-827C-8E722714F937}.Debug|Any CPU.Build.0 = Debug|Any CPU {076940AD-70F3-47A8-827C-8E722714F937}.Release|Any CPU.ActiveCfg = Release|Any CPU {076940AD-70F3-47A8-827C-8E722714F937}.Release|Any CPU.Build.0 = Release|Any CPU - {61E90191-22FF-4ADC-AFD0-FAB662589AB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {61E90191-22FF-4ADC-AFD0-FAB662589AB4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {61E90191-22FF-4ADC-AFD0-FAB662589AB4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {61E90191-22FF-4ADC-AFD0-FAB662589AB4}.Release|Any CPU.Build.0 = Release|Any CPU - {5EB0493A-076D-4488-AF08-D812FB3FDF7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5EB0493A-076D-4488-AF08-D812FB3FDF7C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5EB0493A-076D-4488-AF08-D812FB3FDF7C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5EB0493A-076D-4488-AF08-D812FB3FDF7C}.Release|Any CPU.Build.0 = Release|Any CPU {8A23DF78-B3D6-41BD-BA50-19D0FBE4AB69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8A23DF78-B3D6-41BD-BA50-19D0FBE4AB69}.Debug|Any CPU.Build.0 = Debug|Any CPU {8A23DF78-B3D6-41BD-BA50-19D0FBE4AB69}.Release|Any CPU.ActiveCfg = Release|Any CPU {8A23DF78-B3D6-41BD-BA50-19D0FBE4AB69}.Release|Any CPU.Build.0 = Release|Any CPU - {7B286D71-5143-4A08-B9DE-113B310A3F0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7B286D71-5143-4A08-B9DE-113B310A3F0C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7B286D71-5143-4A08-B9DE-113B310A3F0C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7B286D71-5143-4A08-B9DE-113B310A3F0C}.Release|Any CPU.Build.0 = Release|Any CPU {1F5FBA04-C334-41C2-895A-ACC4B786F99E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1F5FBA04-C334-41C2-895A-ACC4B786F99E}.Debug|Any CPU.Build.0 = Debug|Any CPU {1F5FBA04-C334-41C2-895A-ACC4B786F99E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -105,11 +91,36 @@ Global {0C63EF8B-26F9-4511-9FC5-7431DE9657D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C63EF8B-26F9-4511-9FC5-7431DE9657D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C63EF8B-26F9-4511-9FC5-7431DE9657D6}.Release|Any CPU.Build.0 = Release|Any CPU + {ADE0E241-CBDD-48C3-8F50-98FFE76C03C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADE0E241-CBDD-48C3-8F50-98FFE76C03C8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADE0E241-CBDD-48C3-8F50-98FFE76C03C8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADE0E241-CBDD-48C3-8F50-98FFE76C03C8}.Release|Any CPU.Build.0 = Release|Any CPU + {3B613E66-671E-4049-8EF5-43CDAA549210}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B613E66-671E-4049-8EF5-43CDAA549210}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3B613E66-671E-4049-8EF5-43CDAA549210}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B613E66-671E-4049-8EF5-43CDAA549210}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {BAC8FB10-95ED-4FBB-9925-F6F0E15BD936} = {706260A8-86D4-432D-9FE0-F312863288F5} + {1F01E12A-50B7-4092-B30A-DEE9638FB753} = {706260A8-86D4-432D-9FE0-F312863288F5} + {53CDAFA0-30DF-404C-AAF0-652CA4047605} = {FE721A31-DF09-4E33-B791-BEC6C9E1C6F1} + {A7AE1C3F-CDC6-42DC-B4C1-5F7150661984} = {FE721A31-DF09-4E33-B791-BEC6C9E1C6F1} + {CA70C887-2A83-45DF-82EB-2DFFA8841B7B} = {706260A8-86D4-432D-9FE0-F312863288F5} + {CEF8B221-56E0-4777-88C1-9E3F9F3D1D3D} = {FE721A31-DF09-4E33-B791-BEC6C9E1C6F1} + {B6687100-3D8C-428C-8288-84607D9D5EDF} = {706260A8-86D4-432D-9FE0-F312863288F5} + {076940AD-70F3-47A8-827C-8E722714F937} = {706260A8-86D4-432D-9FE0-F312863288F5} + {8A23DF78-B3D6-41BD-BA50-19D0FBE4AB69} = {FE721A31-DF09-4E33-B791-BEC6C9E1C6F1} + {0C63EF8B-26F9-4511-9FC5-7431DE9657D6} = {3BC606D7-27B3-41FA-8FB3-9D56AC8B4DD7} + {ADE0E241-CBDD-48C3-8F50-98FFE76C03C8} = {706260A8-86D4-432D-9FE0-F312863288F5} + {3B613E66-671E-4049-8EF5-43CDAA549210} = {3BC606D7-27B3-41FA-8FB3-9D56AC8B4DD7} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {04241BED-1662-4690-BA56-15C99A840CFE} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\sources\editor\Stride.Core.MostRecentlyUsedFiles\Stride.Core.MostRecentlyUsedFiles.projitems*{78695de1-e621-45df-975d-cfd407081e23}*SharedItemsImports = 5 + EndGlobalSection EndGlobal diff --git a/sources/Directory.Packages.props b/sources/Directory.Packages.props index d80c39307b..0671dd6d05 100644 --- a/sources/Directory.Packages.props +++ b/sources/Directory.Packages.props @@ -118,7 +118,8 @@ - 11.0.6 + 11.3.9 + 11.3.9 @@ -127,6 +128,9 @@ + + + @@ -148,4 +152,4 @@ - \ No newline at end of file + diff --git a/sources/core/Stride.Core.Yaml.Tests/Stride.Core.Yaml.Tests.csproj b/sources/core/Stride.Core.Yaml.Tests/Stride.Core.Yaml.Tests.csproj index 1977222ae3..f4b8d9af63 100644 --- a/sources/core/Stride.Core.Yaml.Tests/Stride.Core.Yaml.Tests.csproj +++ b/sources/core/Stride.Core.Yaml.Tests/Stride.Core.Yaml.Tests.csproj @@ -10,6 +10,7 @@ LinuxTools;WindowsTools + all diff --git a/sources/launcher/Stride.Launcher/App.axaml b/sources/launcher/Stride.Launcher/App.axaml new file mode 100644 index 0000000000..a31c2191fe --- /dev/null +++ b/sources/launcher/Stride.Launcher/App.axaml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + 12 + 0,0,0,20 + + + + + + + + + + + + + + + + + diff --git a/sources/launcher/Stride.Launcher/App.axaml.cs b/sources/launcher/Stride.Launcher/App.axaml.cs new file mode 100644 index 0000000000..0c3a8f7f3d --- /dev/null +++ b/sources/launcher/Stride.Launcher/App.axaml.cs @@ -0,0 +1,66 @@ +// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) +// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. + +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Data.Core.Plugins; +using Avalonia.Markup.Xaml; +using Stride.Core.Presentation.Avalonia.Services; +using Stride.Core.Presentation.ViewModels; +using Stride.Launcher.ViewModels; +using Stride.Launcher.Views; + +namespace Stride.Launcher; + +public partial class App : Application +{ + internal readonly CancellationTokenSource cts = new(); + + internal MainWindow? MainWindow { get; private set; } + + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + // Line below is needed to remove Avalonia data validation. + // Without this line you will get duplicate validations from both Avalonia and CT + BindingPlugins.DataValidators.RemoveAt(0); + + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + desktop.MainWindow = MainWindow = new() + { + DataContext = InitializeMainViewModel() + }; + } + else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform) + { + // don't remove; also used by visual designer. + singleViewPlatform.MainView = new MainView + { + DataContext = InitializeMainViewModel() + }; + } + + base.OnFrameworkInitializationCompleted(); + } + + private static MainViewModel InitializeMainViewModel() + { + return new(InitializeServiceProvider()); + } + + private static IViewModelServiceProvider InitializeServiceProvider() + { + var dispatcherService = DispatcherService.Create(); + var services = new object[] + { + dispatcherService, + new DialogService(dispatcherService) { ApplicationName = Launcher.ApplicationName } + }; + return new ViewModelServiceProvider(services); + } +} diff --git a/sources/launcher/Stride.Launcher/App.xaml b/sources/launcher/Stride.Launcher/App.xaml deleted file mode 100644 index dc853949d5..0000000000 --- a/sources/launcher/Stride.Launcher/App.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/sources/launcher/Stride.Launcher/App.xaml.cs b/sources/launcher/Stride.Launcher/App.xaml.cs deleted file mode 100644 index 0ed6af7ada..0000000000 --- a/sources/launcher/Stride.Launcher/App.xaml.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. -namespace Stride.LauncherApp -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App - { - } -} diff --git a/sources/launcher/Stride.Launcher/Assets/CrashReportImage.png b/sources/launcher/Stride.Launcher/Assets/CrashReportImage.png new file mode 100644 index 0000000000..b1bf3de6f6 --- /dev/null +++ b/sources/launcher/Stride.Launcher/Assets/CrashReportImage.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36917dc9595f57e66f7d9692cd77fc19e8cc0f7eb31d76fe117d877ad72b2d31 +size 3019 diff --git a/sources/launcher/Stride.Launcher/Resources/EditorIcon.png b/sources/launcher/Stride.Launcher/Assets/Images/EditorIcon.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/EditorIcon.png rename to sources/launcher/Stride.Launcher/Assets/Images/EditorIcon.png diff --git a/sources/launcher/Stride.Launcher/Resources/chat-16.png b/sources/launcher/Stride.Launcher/Assets/Images/chat.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/chat-16.png rename to sources/launcher/Stride.Launcher/Assets/Images/chat.png diff --git a/sources/launcher/Stride.Launcher/Resources/delete-26-dark.png b/sources/launcher/Stride.Launcher/Assets/Images/delete.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/delete-26-dark.png rename to sources/launcher/Stride.Launcher/Assets/Images/delete.png diff --git a/sources/launcher/Stride.Launcher/Resources/discord.png b/sources/launcher/Stride.Launcher/Assets/Images/discord.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/discord.png rename to sources/launcher/Stride.Launcher/Assets/Images/discord.png diff --git a/sources/launcher/Stride.Launcher/Resources/download-26-dark.png b/sources/launcher/Stride.Launcher/Assets/Images/download.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/download-26-dark.png rename to sources/launcher/Stride.Launcher/Assets/Images/download.png diff --git a/sources/launcher/Stride.Launcher/Resources/facebook_24.png b/sources/launcher/Stride.Launcher/Assets/Images/facebook.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/facebook_24.png rename to sources/launcher/Stride.Launcher/Assets/Images/facebook.png diff --git a/sources/launcher/Stride.Launcher/Resources/getting-started.png b/sources/launcher/Stride.Launcher/Assets/Images/getting-started.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/getting-started.png rename to sources/launcher/Stride.Launcher/Assets/Images/getting-started.png diff --git a/sources/launcher/Stride.Launcher/Resources/github.png b/sources/launcher/Stride.Launcher/Assets/Images/github.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/github.png rename to sources/launcher/Stride.Launcher/Assets/Images/github.png diff --git a/sources/launcher/Stride.Launcher/Resources/issues.png b/sources/launcher/Stride.Launcher/Assets/Images/issues.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/issues.png rename to sources/launcher/Stride.Launcher/Assets/Images/issues.png diff --git a/sources/launcher/Stride.Launcher/Resources/list-26.png b/sources/launcher/Stride.Launcher/Assets/Images/list.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/list-26.png rename to sources/launcher/Stride.Launcher/Assets/Images/list.png diff --git a/sources/launcher/Stride.Launcher/Resources/news.png b/sources/launcher/Stride.Launcher/Assets/Images/news.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/news.png rename to sources/launcher/Stride.Launcher/Assets/Images/news.png diff --git a/sources/launcher/Stride.Launcher/Resources/note-26-dark.png b/sources/launcher/Stride.Launcher/Assets/Images/note.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/note-26-dark.png rename to sources/launcher/Stride.Launcher/Assets/Images/note.png diff --git a/sources/launcher/Stride.Launcher/Resources/opencollective_24.png b/sources/launcher/Stride.Launcher/Assets/Images/opencollective.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/opencollective_24.png rename to sources/launcher/Stride.Launcher/Assets/Images/opencollective.png diff --git a/sources/launcher/Stride.Launcher/Resources/recent-projects.png b/sources/launcher/Stride.Launcher/Assets/Images/recent-projects.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/recent-projects.png rename to sources/launcher/Stride.Launcher/Assets/Images/recent-projects.png diff --git a/sources/launcher/Stride.Launcher/Resources/reddit_24.png b/sources/launcher/Stride.Launcher/Assets/Images/reddit.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/reddit_24.png rename to sources/launcher/Stride.Launcher/Assets/Images/reddit.png diff --git a/sources/launcher/Stride.Launcher/Resources/roadmap.png b/sources/launcher/Stride.Launcher/Assets/Images/roadmap.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/roadmap.png rename to sources/launcher/Stride.Launcher/Assets/Images/roadmap.png diff --git a/sources/launcher/Stride.Launcher/Assets/Images/robot.png b/sources/launcher/Stride.Launcher/Assets/Images/robot.png new file mode 100644 index 0000000000..9e25c59043 --- /dev/null +++ b/sources/launcher/Stride.Launcher/Assets/Images/robot.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:876b4471b32cb4e9fc354e9d84519b06ca03cc6cdbc56f3780374e511512efdf +size 362967 diff --git a/sources/launcher/Stride.Launcher/Resources/showcase.png b/sources/launcher/Stride.Launcher/Assets/Images/showcase.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/showcase.png rename to sources/launcher/Stride.Launcher/Assets/Images/showcase.png diff --git a/sources/launcher/Stride.Launcher/Resources/survey.png b/sources/launcher/Stride.Launcher/Assets/Images/survey.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/survey.png rename to sources/launcher/Stride.Launcher/Assets/Images/survey.png diff --git a/sources/launcher/Stride.Launcher/Resources/switch-version.png b/sources/launcher/Stride.Launcher/Assets/Images/switch-version.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/switch-version.png rename to sources/launcher/Stride.Launcher/Assets/Images/switch-version.png diff --git a/sources/launcher/Stride.Launcher/Resources/twitch_24.png b/sources/launcher/Stride.Launcher/Assets/Images/twitch.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/twitch_24.png rename to sources/launcher/Stride.Launcher/Assets/Images/twitch.png diff --git a/sources/launcher/Stride.Launcher/Resources/update.png b/sources/launcher/Stride.Launcher/Assets/Images/update.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/update.png rename to sources/launcher/Stride.Launcher/Assets/Images/update.png diff --git a/sources/launcher/Stride.Launcher/Resources/upgrade-16.png b/sources/launcher/Stride.Launcher/Assets/Images/upgrade.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/upgrade-16.png rename to sources/launcher/Stride.Launcher/Assets/Images/upgrade.png diff --git a/sources/launcher/Stride.Launcher/Resources/visual-studio.png b/sources/launcher/Stride.Launcher/Assets/Images/visual-studio.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/visual-studio.png rename to sources/launcher/Stride.Launcher/Assets/Images/visual-studio.png diff --git a/sources/launcher/Stride.Launcher/Resources/xtwitter_24.png b/sources/launcher/Stride.Launcher/Assets/Images/xtwitter.png similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/xtwitter_24.png rename to sources/launcher/Stride.Launcher/Assets/Images/xtwitter.png diff --git a/sources/launcher/Stride.Launcher/Resources/Launcher.ico b/sources/launcher/Stride.Launcher/Assets/Launcher.ico similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/Launcher.ico rename to sources/launcher/Stride.Launcher/Assets/Launcher.ico diff --git a/sources/launcher/Stride.Launcher/Resources/Strings.Designer.cs b/sources/launcher/Stride.Launcher/Assets/Localization/Strings.Designer.cs similarity index 99% rename from sources/launcher/Stride.Launcher/Resources/Strings.Designer.cs rename to sources/launcher/Stride.Launcher/Assets/Localization/Strings.Designer.cs index 130b285152..4544ed1c8b 100644 --- a/sources/launcher/Stride.Launcher/Resources/Strings.Designer.cs +++ b/sources/launcher/Stride.Launcher/Assets/Localization/Strings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Stride.LauncherApp.Resources { +namespace Stride.Launcher.Assets.Localization { using System; @@ -39,7 +39,7 @@ internal Strings() { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Stride.LauncherApp.Resources.Strings", typeof(Strings).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Stride.Launcher.Assets.Localization.Strings", typeof(Strings).Assembly); resourceMan = temp; } return resourceMan; @@ -139,9 +139,9 @@ public static string ButtonForums { /// /// Looks up a localized string similar to Fork on GitHub. /// - public static string ButtonGithub { + public static string ButtonGitHub { get { - return ResourceManager.GetString("ButtonGithub", resourceCulture); + return ResourceManager.GetString("ButtonGitHub", resourceCulture); } } diff --git a/sources/launcher/Stride.Launcher/Resources/Strings.ja-JP.resx b/sources/launcher/Stride.Launcher/Assets/Localization/Strings.ja-JP.resx similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/Strings.ja-JP.resx rename to sources/launcher/Stride.Launcher/Assets/Localization/Strings.ja-JP.resx diff --git a/sources/launcher/Stride.Launcher/Resources/Strings.resx b/sources/launcher/Stride.Launcher/Assets/Localization/Strings.resx similarity index 99% rename from sources/launcher/Stride.Launcher/Resources/Strings.resx rename to sources/launcher/Stride.Launcher/Assets/Localization/Strings.resx index b75c9f282f..a783719fad 100644 --- a/sources/launcher/Stride.Launcher/Resources/Strings.resx +++ b/sources/launcher/Stride.Launcher/Assets/Localization/Strings.resx @@ -133,7 +133,7 @@ Discuss about Stride /!\ Text must be short - + Fork on GitHub /!\ Text must be short diff --git a/sources/launcher/Stride.Launcher/Resources/Urls.Designer.cs b/sources/launcher/Stride.Launcher/Assets/Localization/Urls.Designer.cs similarity index 97% rename from sources/launcher/Stride.Launcher/Resources/Urls.Designer.cs rename to sources/launcher/Stride.Launcher/Assets/Localization/Urls.Designer.cs index d61a3b7c68..0be689bd72 100644 --- a/sources/launcher/Stride.Launcher/Resources/Urls.Designer.cs +++ b/sources/launcher/Stride.Launcher/Assets/Localization/Urls.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Stride.LauncherApp.Resources { +namespace Stride.Launcher.Assets.Localization { using System; @@ -39,7 +39,7 @@ internal Urls() { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Stride.LauncherApp.Resources.Urls", typeof(Urls).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Stride.Launcher.Assets.Localization.Urls", typeof(Urls).Assembly); resourceMan = temp; } return resourceMan; @@ -108,9 +108,9 @@ public static string GettingStarted { /// /// Looks up a localized string similar to https://github.com/stride3d/stride/. /// - public static string Github { + public static string GitHub { get { - return ResourceManager.GetString("Github", resourceCulture); + return ResourceManager.GetString("GitHub", resourceCulture); } } diff --git a/sources/launcher/Stride.Launcher/Resources/Urls.ja-JP.resx b/sources/launcher/Stride.Launcher/Assets/Localization/Urls.ja-JP.resx similarity index 100% rename from sources/launcher/Stride.Launcher/Resources/Urls.ja-JP.resx rename to sources/launcher/Stride.Launcher/Assets/Localization/Urls.ja-JP.resx diff --git a/sources/launcher/Stride.Launcher/Resources/Urls.resx b/sources/launcher/Stride.Launcher/Assets/Localization/Urls.resx similarity index 99% rename from sources/launcher/Stride.Launcher/Resources/Urls.resx rename to sources/launcher/Stride.Launcher/Assets/Localization/Urls.resx index 8ab986f887..ec6e7404d4 100644 --- a/sources/launcher/Stride.Launcher/Resources/Urls.resx +++ b/sources/launcher/Stride.Launcher/Assets/Localization/Urls.resx @@ -134,7 +134,7 @@ https://doc.stride3d.net/{0}/studio_getting_started_links.txt {0}: the major version of Stride (eg. 1.2) - + https://github.com/stride3d/stride/ @@ -161,4 +161,4 @@ https://visualstudio.microsoft.com/downloads - + \ No newline at end of file diff --git a/sources/launcher/Stride.Launcher/Constants.cs b/sources/launcher/Stride.Launcher/Constants.cs new file mode 100644 index 0000000000..b50f04c2ef --- /dev/null +++ b/sources/launcher/Stride.Launcher/Constants.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) +// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. + +namespace Stride.Launcher; + +internal struct Names +{ + public const string GameStudio = nameof(GameStudio); + public const string Stride = nameof(Stride); + public const string Xenko = nameof(Xenko); +} + +internal struct GameStudioNames +{ + public const string Stride = $"{Names.Stride}.{Names.GameStudio}"; + public const string StrideAvalonia = $"{Names.Stride}.{Names.GameStudio}.Avalonia.Desktop"; + public const string Xenko = $"{Names.Xenko}.{Names.GameStudio}"; +} diff --git a/sources/launcher/Stride.Launcher/Crash/CrashReportArgs.cs b/sources/launcher/Stride.Launcher/Crash/CrashReportArgs.cs new file mode 100644 index 0000000000..5933afe724 --- /dev/null +++ b/sources/launcher/Stride.Launcher/Crash/CrashReportArgs.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) +// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. + +namespace Stride.Crash; + +internal enum CrashLocation +{ + Main, + UnhandledException +} + +internal record CrashReportArgs +{ + public required Exception Exception { get; set; } + public required CrashLocation Location { get; set; } + public string[] Logs { get; set; } = []; + public string? ThreadName { get; set; } +} diff --git a/sources/launcher/Stride.Launcher/Crash/CrashReportData.cs b/sources/launcher/Stride.Launcher/Crash/CrashReportData.cs new file mode 100644 index 0000000000..6784925069 --- /dev/null +++ b/sources/launcher/Stride.Launcher/Crash/CrashReportData.cs @@ -0,0 +1,52 @@ +// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) +// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. + +using System.Text; +using System.Text.Json; + +namespace Stride.Crash; + +public sealed class CrashReportData +{ + public List<(string key, object? value)> Data = []; + + public object? this[string key] + { + get => Data.Find(p => p.key == key).value; + set + { + if (value == null) + return; + + int num = -1; + foreach (var current in Data) + { + if (current.key == key) + { + num = Data.IndexOf(current); + break; + } + } + if (num != -1) + { + Data[num] = (key, value); + } + else + { + Data.Add((key, value)); + } + } + } + + public string ToJson() => JsonSerializer.Serialize(Data.ToDictionary()); + + public override string ToString() + { + StringBuilder val = new(); + foreach (var (key, value) in Data) + { + val.AppendLine($"{key}: {value}"); + } + return val.ToString(); + } +} diff --git a/sources/launcher/Stride.Launcher/Crash/CrashReportViewModel.cs b/sources/launcher/Stride.Launcher/Crash/CrashReportViewModel.cs new file mode 100644 index 0000000000..d8f891399f --- /dev/null +++ b/sources/launcher/Stride.Launcher/Crash/CrashReportViewModel.cs @@ -0,0 +1,118 @@ +// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) +// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. + +using System.Diagnostics; +using System.Text; +using Stride.Core.Extensions; +using Stride.Core.Presentation.Avalonia.Services; +using Stride.Core.Presentation.Commands; +using Stride.Core.Presentation.Services; +using Stride.Core.Presentation.ViewModels; + +namespace Stride.Crash.ViewModels; + +internal sealed class CrashReportViewModel : ViewModelBase +{ + private readonly string applicationName; + private readonly CancellationTokenSource exitToken; + private readonly Func setClipboard; + + private bool isReportVisible; + + public CrashReportViewModel(string applicationName, CrashReportArgs args, Func setClipboard, CancellationTokenSource exitToken) + : base(new ViewModelServiceProvider()) + { + this.applicationName = applicationName; + this.exitToken = exitToken; + this.setClipboard = setClipboard; + + var dispatcher = DispatcherService.Create(); + ServiceProvider.RegisterService(dispatcher); + ServiceProvider.RegisterService(new DialogService(dispatcher) { ApplicationName = applicationName }); + + Report = ComputeReport(args); + + CopyReportCommand = new AnonymousTaskCommand(ServiceProvider, OnCopyReport); + CloseCommand = new AnonymousCommand(ServiceProvider, OnClose); + OpenIssueCommand = new AnonymousTaskCommand(ServiceProvider, OnOpenIssue); + ViewReportCommand = new AnonymousCommand(ServiceProvider, OnViewReport); + } + + public string ApplicationName => applicationName; + + public bool IsReportVisible + { + get => isReportVisible; + set => SetValue(ref isReportVisible, value); + } + + public CrashReportData Report { get; } + + public ICommandBase CopyReportCommand { get; } + public ICommandBase CloseCommand { get; } + public ICommandBase OpenIssueCommand { get; } + public ICommandBase ViewReportCommand { get; } + + private void OnClose() + { + exitToken.Cancel(); + } + + private Task OnCopyReport() + { + return setClipboard.Invoke(Report.ToJson()); + } + + private async Task OnOpenIssue() + { + try + { + Process.Start(new ProcessStartInfo + { + FileName = "https://github.com/stride3d/stride/issues/new?labels=bug&template=bug_report.md&", + UseShellExecute = true + }); + } + // FIXME: catch only specific exceptions? + catch (Exception) + { + DialogService.MainWindow!.Topmost = false; + // FIXME: localize resource string + await ServiceProvider.Get().MessageBoxAsync("An error occurred while trying to open a web browser", MessageBoxButton.OK, MessageBoxImage.Error); + } + } + + private void OnViewReport() + { + IsReportVisible = true; + } + + private CrashReportData ComputeReport(CrashReportArgs args) + { + return new() + { + ["Application"] = applicationName, + ["ThreadName"] = args.ThreadName, +#if DEBUG + ["ProcessID"] = Environment.ProcessId, + ["CurrentDirectory"] = Environment.CurrentDirectory, +#endif + ["OsArch"] = Environment.Is64BitOperatingSystem ? "x64" : "x86", + ["OsVersion"] = Environment.OSVersion, + ["ProcessorCount"] = Environment.ProcessorCount, + ["Exception"] = args.Exception.FormatFull(), + ["LastLogs"] = FormatLogs(args.Logs), + }; + + static string FormatLogs(string[] logs) + { + var builder = new StringBuilder(); + for (var i = 0; i < logs.Length; i++) + { + var log = logs[i]; + builder.AppendLine($"{i + 1}: {log}"); + } + return builder.ToString(); + } + } +} diff --git a/sources/launcher/Stride.Launcher/Crash/CrashReportWindow.axaml b/sources/launcher/Stride.Launcher/Crash/CrashReportWindow.axaml new file mode 100644 index 0000000000..d2119585a6 --- /dev/null +++ b/sources/launcher/Stride.Launcher/Crash/CrashReportWindow.axaml @@ -0,0 +1,47 @@ + + + + + + + + + + Unfortunately, has crashed. + Please help us improve Stride by sending information about this crash through Github Issues. + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +