From b2ea847ec5f97da35cd084be06f5c046c4237832 Mon Sep 17 00:00:00 2001 From: Victor Date: Sat, 20 Apr 2024 09:44:45 -0600 Subject: [PATCH] More fixes and unification for Android and iOS NET 8 projects. Removed Xamarin button. --- FRBDK/Glue/Glue/IO/BuiltFileCopier.cs | 10 ++-- .../CameraPlugin/CameraMainPlugin.cs | 6 +- .../SyncedProjects/ProjectListEntry.xaml | 3 - .../SyncedProjects/ProjectListEntry.xaml.cs | 55 ------------------- .../SyncedProjects/SyncedProjectLogic.cs | 4 +- .../SyncedProjects/SyncedProjectViewModel.cs | 15 ----- .../Windows8ContentAdd/XnbContentAdder.cs | 15 ++--- .../VSHelpers/Projects/VisualStudioProject.cs | 2 + .../ContentPipelinePlugin/BuildLogic.cs | 11 ++-- 9 files changed, 26 insertions(+), 95 deletions(-) diff --git a/FRBDK/Glue/Glue/IO/BuiltFileCopier.cs b/FRBDK/Glue/Glue/IO/BuiltFileCopier.cs index 89a1674ee..6a923137f 100644 --- a/FRBDK/Glue/Glue/IO/BuiltFileCopier.cs +++ b/FRBDK/Glue/Glue/IO/BuiltFileCopier.cs @@ -100,11 +100,11 @@ void HandleNewFile(ReferencedFileSave rfs, AssetTypeInfo assetTypeInfo) bool NeedsCopiedXnbs(ProjectBase project) { - return project is IosMonogameProject || - project is Windows8MonoGameProject || - project is AndroidProject || - project is UwpProject || - project is MonoGameDesktopGlBaseProject; + return project is IosMonogameProject or IosMonoGameNet8Project + or Windows8MonoGameProject + or AndroidProject or AndroidMonoGameNet8Project + or UwpProject + or MonoGameDesktopGlBaseProject; } diff --git a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/CameraPlugin/CameraMainPlugin.cs b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/CameraPlugin/CameraMainPlugin.cs index 4f10758e5..dcabcf270 100644 --- a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/CameraPlugin/CameraMainPlugin.cs +++ b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/CameraPlugin/CameraMainPlugin.cs @@ -193,9 +193,9 @@ public void ShowCameraUi() bool GetIfSupportsOrientation(ProjectBase projectBase) { - return projectBase is IosMonogameProject || - projectBase is AndroidProject || - projectBase is UwpProject; + return projectBase is IosMonogameProject or IosMonoGameNet8Project + or AndroidProject or AndroidMonoGameNet8Project + or UwpProject; } } } diff --git a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/ProjectListEntry.xaml b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/ProjectListEntry.xaml index d41217fa8..9bd4b7087 100644 --- a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/ProjectListEntry.xaml +++ b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/ProjectListEntry.xaml @@ -26,9 +26,6 @@ - diff --git a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/ProjectListEntry.xaml.cs b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/ProjectListEntry.xaml.cs index 9d353d6cc..1455d6813 100644 --- a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/ProjectListEntry.xaml.cs +++ b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/ProjectListEntry.xaml.cs @@ -119,61 +119,6 @@ private void OpenInExplorer(object sender, RoutedEventArgs e) OpenInExplorer(Project); } - private void OpenInXamarinStudio(object sender, RoutedEventArgs e) - { - string solutionName = ProjectSyncer.LocateSolution(Project.FullFileName.FullPath); - - HandleOpenInXamarinStudioClick(solutionName); - } - - - private bool HandleOpenInXamarinStudioClick(string solution) - { - string standardizedSolution = FileManager.Standardize(solution).ToLowerInvariant(); - - ProjectBase project = null; - - string mainSolution = ProjectSyncer.LocateSolution(GlueState.Self.CurrentMainContentProject.FullFileName.FullPath); - - if (standardizedSolution == FileManager.Standardize(mainSolution).ToLowerInvariant()) - { - project = GlueState.Self.CurrentMainContentProject; - } - - if (project == null) - { - // Maybe this is a synced project? - foreach (var potentialProject in GlueState.Self.SyncedProjects) - { - string potentialSolutionName = FileManager.Standardize(ProjectSyncer.LocateSolution(potentialProject.FullFileName.FullPath)).ToLowerInvariant(); - - if (potentialSolutionName == standardizedSolution) - { - project = potentialProject; - break; - } - } - } - - bool shouldHandle = project != null && project is AndroidProject; - - if (shouldHandle) - { - try - { - string xamarinStudioLocation = GetProgramFilesx86() + "Xamarin Studio/bin/XamarinStudio.exe"; - Process.Start(xamarinStudioLocation, solution); - } - catch (Exception ex) - { - PluginManager.ReceiveError(ex.ToString()); - MessageBox.Show(L.Texts.ErrorCannotOpenXamarin); - } - } - return shouldHandle; - } - - static string GetProgramFilesx86() { if (8 == IntPtr.Size diff --git a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/SyncedProjectLogic.cs b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/SyncedProjectLogic.cs index b19e53ba1..9459cd57e 100644 --- a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/SyncedProjectLogic.cs +++ b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/SyncedProjectLogic.cs @@ -115,7 +115,7 @@ private bool IsContentFile(ProjectItem bi, ProjectBase buildItemOwner, VisualStu public bool GetIfHandledByContentPipelinePlugin(VisualStudioProject targetProject, string extension, ReferencedFileSave rfs) { // this depends on the type of project: - if(targetProject is AndroidProject) + if(targetProject is AndroidProject or AndroidMonoGameNet8Project) { return extension == "wav" || extension == "fbx" || @@ -131,7 +131,7 @@ public bool GetIfHandledByContentPipelinePlugin(VisualStudioProject targetProjec (extension == "wav" || extension == "mp3" || extension == "png") && rfs?.UseContentPipeline == true; } - else if(targetProject is IosMonogameProject) + else if(targetProject is IosMonogameProject or IosMonoGameNet8Project) { // Turns out we don't want to ignore MP3s on iOS. // We just need to make an additional XNB which is diff --git a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/SyncedProjectViewModel.cs b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/SyncedProjectViewModel.cs index e10d4c882..656bbb065 100644 --- a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/SyncedProjectViewModel.cs +++ b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/SyncedProjects/SyncedProjectViewModel.cs @@ -43,21 +43,6 @@ public string DisplayName } } - public Visibility XamarinButtonVisibility - { - get - { - if(projectBase is AndroidProject) - { - return Visibility.Visible; - } - else - { - // so columns are the same size - return Visibility.Hidden; - } - } - } /// /// An ObservableCollection of orphaned files - files which are referenced by the diff --git a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/Windows8ContentAdd/XnbContentAdder.cs b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/Windows8ContentAdd/XnbContentAdder.cs index bb85aa29b..272658e49 100644 --- a/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/Windows8ContentAdd/XnbContentAdder.cs +++ b/FRBDK/Glue/Glue/Plugins/EmbeddedPlugins/Windows8ContentAdd/XnbContentAdder.cs @@ -47,10 +47,10 @@ void HandleInitializeMenuHandler(MenuStrip menuStrip) bool NeedsXnbs(ProjectBase project) { - return project is IosMonogameProject || - project is Windows8MonoGameProject || - project is AndroidProject || - project is UwpProject + return project is IosMonogameProject or IosMonoGameNet8Project + or Windows8MonoGameProject + or AndroidProject or AndroidMonoGameNet8Project + or UwpProject ; } @@ -97,7 +97,7 @@ private void AddXnbsToProject(VisualStudioProject project) public bool ShouldAssociatedXnbBeCopied(string fileName, ProjectBase project) { // On Android we (currently) only copy WAV's. MP3s work fine without XNB: - if (project is AndroidProject ) + if (project is AndroidProject or AndroidMonoGameNet8Project) { return FileManager.GetExtension(fileName) == "wav"; @@ -131,8 +131,8 @@ private static bool AddAudioBuildItemToProject(VisualStudioProject project, Proj string extension = FileManager.GetExtension(buildItem.UnevaluatedInclude); - bool isIos = project is IosMonogameProject; - bool isAndroid = project is AndroidProject; + bool isIos = project is IosMonogameProject or IosMonoGameNet8Project; + bool isAndroid = project is AndroidProject or AndroidMonoGameNet8Project; string whatToAddToProject = null; @@ -178,6 +178,7 @@ private static bool AddAudioBuildItemToProject(VisualStudioProject project, Proj linkToSet = "Content\\" + FileManager.RemoveExtension(buildItem.UnevaluatedInclude) + ".xnb"; } + // not needed for .NET 8 (not sure why...) if(project is AndroidProject) { linkToSet = "Assets\\" + linkToSet; diff --git a/FRBDK/Glue/Glue/VSHelpers/Projects/VisualStudioProject.cs b/FRBDK/Glue/Glue/VSHelpers/Projects/VisualStudioProject.cs index 189ef1dfc..71a1ffb65 100644 --- a/FRBDK/Glue/Glue/VSHelpers/Projects/VisualStudioProject.cs +++ b/FRBDK/Glue/Glue/VSHelpers/Projects/VisualStudioProject.cs @@ -157,6 +157,7 @@ private void GetDotNetVersion() try { + // Only needed for Xamarin - .NET 8 is a normal .NET project if(this is AndroidProject or IosMonogameProject) { // this doesn't have a dotnet version, so gotta use xamarin: @@ -171,6 +172,7 @@ private void GetDotNetVersion() try { + // This doesn't have a dotnet version, not needed for .NET 8: if (this is AndroidProject or IosMonogameProject) { DotNetVersion = new Version(0,0); diff --git a/FRBDK/Glue/OfficialPlugins/ContentPipelinePlugin/BuildLogic.cs b/FRBDK/Glue/OfficialPlugins/ContentPipelinePlugin/BuildLogic.cs index a22ebc7df..bb3641016 100644 --- a/FRBDK/Glue/OfficialPlugins/ContentPipelinePlugin/BuildLogic.cs +++ b/FRBDK/Glue/OfficialPlugins/ContentPipelinePlugin/BuildLogic.cs @@ -87,11 +87,11 @@ public async Task RefreshBuiltFilesFor(VisualStudioProject project, bool forcePn public static bool GetIfNeedsMonoGameFilesBuilt(ProjectBase project) { - return project is MonoGameDesktopGlBaseProject || - project is AndroidProject || - project is UwpProject || - project is AndroidMonoGameNet8Project || - project is IosMonoGameNet8Project + return project is MonoGameDesktopGlBaseProject + or AndroidProject + or UwpProject + or AndroidMonoGameNet8Project + or IosMonoGameNet8Project ; } @@ -643,6 +643,7 @@ private void AddFileToProjectIfNotAlreadyIncluded(VisualStudioProject project, s link = "Content\\" + link; + // This is not needed for .NET 8 projects, only Xamarin Android: if (project is AndroidProject) { link = "Assets\\" + link;