Skip to content

Commit

Permalink
More fixes and unification for Android and iOS NET 8 projects.
Browse files Browse the repository at this point in the history
Removed Xamarin button.
  • Loading branch information
vchelaru committed Apr 20, 2024
1 parent 859c288 commit b2ea847
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 95 deletions.
10 changes: 5 additions & 5 deletions FRBDK/Glue/Glue/IO/BuiltFileCopier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@

<Rectangle Width="5"></Rectangle>

<Button Visibility="{Binding XamarinButtonVisibility}" Click="OpenInXamarinStudio">
<Image Source="Images/XamarinIcon.png" />
</Button>
<Button Click="OpenInVisualStudio">
<Image Source="Images/VsIcon.png" />
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" ||
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

/// <summary>
/// An ObservableCollection of orphaned files - files which are referenced by the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
;

}
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions FRBDK/Glue/Glue/VSHelpers/Projects/VisualStudioProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions FRBDK/Glue/OfficialPlugins/ContentPipelinePlugin/BuildLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
;

}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b2ea847

Please sign in to comment.