Inheritance: VisualStudioProject
Example #1
0
        private static ProjectBase TryGetProjectTypeFromDefineConstants(Project coreVisualStudioProject, out string message)
        {
            string preProcessorConstants = GetPreProcessorConstantsFromProject(coreVisualStudioProject);

            //string sasfd = ProjectManager.LibrariesPath;

            // Check for other platforms before checking for FRB_XNA because those projects
            // include FRB_XNA in them

            ProjectBase toReturn = null;

            if (preProcessorConstants.Contains("ANDROID"))
            {
                toReturn = new AndroidProject(coreVisualStudioProject);
            }
            else if (preProcessorConstants.Contains("WINDOWS_8"))
            {
                toReturn = new Windows8MonoGameProject(coreVisualStudioProject);
            }
            else if (preProcessorConstants.Contains("IOS"))
            {
                toReturn = new IosMonogameProject(coreVisualStudioProject);
            }
            else if (preProcessorConstants.Contains("UWP"))
            {
                toReturn = new UwpProject(coreVisualStudioProject);
            }
            else if (preProcessorConstants.Contains("WINDOWS_PHONE"))
            {
                toReturn = new WindowsPhoneProject(coreVisualStudioProject);
            }
            else if (preProcessorConstants.Contains("LINUX"))
            {
                toReturn = new DesktopGlLinuxProject(coreVisualStudioProject);
            }
            else if (preProcessorConstants.Contains("DESKTOP_GL"))
            {
                toReturn = new DesktopGlProject(coreVisualStudioProject);
            }


            // Do XNA_4 last, since every
            // other project type has this
            // preprocessor type, so every project
            // type would return true here
            else if (preProcessorConstants.Contains("XNA4"))
            {
                toReturn = new Xna4Project(coreVisualStudioProject);
            }

            message = null;
            if (toReturn == null)
            {
                message = $"Could not determine project type from preprocessor directives. The preprocessor directive string is \"{preProcessorConstants}\"";
            }

            return(toReturn);
        }
Example #2
0
        public static ProjectBase CreatePlatformSpecificProject(Project coreVisualStudioProject, string fileName)
        {
            ProjectBase toReturn = null;
            if (FileManager.GetExtension(fileName) == "contentproj")
            {
                toReturn = new XnaContentProject(coreVisualStudioProject);
            }


            if (toReturn == null)
            {
                toReturn = TryGetProjectTypeFromDefineConstants(coreVisualStudioProject);
            }


            if (toReturn == null)
            {
                // If we got here that means that the preprocessor defines don't match what
                // Glue expects.  This is probably bad - Glue generated code will likely not
                // compile, so let's warn the user
                string warning = "Could not determine project type based off of preprocessor defines.  Glue will try to load the project, but you may have compilation errors";
                GlueGui.ShowMessageBox(warning);


                #region Backup Method for detecting project type off of FlatRedBall

                foreach (ProjectItem buildItem in coreVisualStudioProject.AllEvaluatedItems.Where(buildItem => buildItem.EvaluatedInclude.Contains("FlatRedBall")))
                {
                    if (buildItem.EvaluatedInclude.Contains("Mdx"))
                    {
                        toReturn = new MdxProject(coreVisualStudioProject);
                        break;
                    }

                    if (buildItem.EvaluatedInclude.Contains("FlatRedBall"))
                    {
                        if (buildItem.EvaluatedInclude.Contains("x86"))
                        {
                            toReturn = new XnaProject(coreVisualStudioProject);
                            break;
                        }
                        
                    }

                    break;
                }
                #endregion
            }

            if (toReturn == null)
            {

                foreach (ProjectItem buildItem in coreVisualStudioProject.AllEvaluatedItems.Where(buildItem => buildItem.EvaluatedInclude.Contains("Microsoft.Phone")))
                {
                    toReturn = new WindowsPhoneProject(coreVisualStudioProject);
                    break;
                }

            }


            return toReturn;
        }
Example #3
0
        private static ProjectBase TryGetProjectTypeFromDefineConstants(Project coreVisualStudioProject)
        {
            string preProcessorConstants = GetPreProcessorConstantsFromProject(coreVisualStudioProject);

            //string sasfd = ProjectManager.LibrariesPath;

            // Check for other platforms before checking for FRB_XNA because those projects
            // include FRB_XNA in them

            ProjectBase toReturn = null;

            if (preProcessorConstants.Contains("ANDROID"))
            {
                toReturn = new AndroidProject(coreVisualStudioProject);
            }
            else if (preProcessorConstants.Contains("WINDOWS_8"))
            {
                toReturn = new Windows8MonoGameProject(coreVisualStudioProject);
            }
            else if(preProcessorConstants.Contains("IOS"))
            {
                toReturn = new IosMonogameProject(coreVisualStudioProject);
            }
            else if(preProcessorConstants.Contains("UWP"))
            {
                toReturn = new UwpProject(coreVisualStudioProject);
            }
            else if (preProcessorConstants.Contains("WINDOWS_PHONE"))
            {
                toReturn = new WindowsPhoneProject(coreVisualStudioProject);
            }

            else if (preProcessorConstants.Contains("XNA4"))
            {
                toReturn = new Xna4Project(coreVisualStudioProject);
            }

            else if (preProcessorConstants.Contains("FRB_XNA"))
            {
                toReturn = new XnaProject(coreVisualStudioProject);
            }

            else if (preProcessorConstants.Contains("FSB") || preProcessorConstants.Contains("SILVERLIGHT"))
            {
                toReturn = new FsbProject(coreVisualStudioProject);
            }

            else if (preProcessorConstants.Contains("FRB_MDX"))
            {
                toReturn = new MdxProject(coreVisualStudioProject);
            }
            
            return toReturn;
        }