/// <summary>
        /// Builds the versions from the projects
        /// </summary>
        /// <param name="MainSolution">The main solution.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception"></exception>
        public ProjectVersionCollection BuildVersions(Solution MainSolution)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var versions = new ProjectVersionCollection();

            var projs = FindProjects(MainSolution);

            try
            {
                foreach (Project proj in projs)
                {
                    if (!String.IsNullOrEmpty(proj.FileName) &&
                        proj.ProjectItems != null)
                    {
                        bool hasCocoa   = false;
                        bool hasAndroid = false;

                        var         projectTypeGuids = GetProjectTypeGuids(proj);
                        ProjectItem projectItem      = null;

                        if (projectTypeGuids != null)
                        {
                            var ignorableTypes = new List <string>()
                            {
                                "{54435603-DBB4-11D2-8724-00A0C9A8B90C}", "{930C7802-8A8C-48F9-8165-68863BCCD9DD}"
                            };

                            //if the type of the project is on the ignore list then skip
                            if (ignorableTypes.Contains(projectTypeGuids.First().ToUpper()))
                            {
                                continue;
                            }

                            var iOSTypes = new List <String> {
                                "{FEACFBD2-3405-455C-9665-78FE426C6842}", "{EE2C853D-36AF-4FDB-B1AD-8E90477E2198}"
                            };
                            var androidTypes = new List <String> {
                                "{EFBA0AD7-5A72-4C68-AF49-83D382785DCF}", "{10368E6C-D01B-4462-8E8B-01FC667A7035}"
                            };
                            var macTypes = new List <String> {
                                "{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1}", "{EE2C853D-36AF-4FDB-B1AD-8E90477E2198}"
                            };

                            if (iOSTypes.Contains(projectTypeGuids.First()) || macTypes.Contains(projectTypeGuids.First()))
                            {
                                hasCocoa = true;
                            }
                            else if (androidTypes.Contains(projectTypeGuids.First()))
                            {
                                hasAndroid = true;
                            }

                            projectItem = FindAssemblyInfoProjectItem(proj.ProjectItems);
                        }
                        else
                        {
                            projectItem = FindAssemblyInfoProjectItem(proj.ProjectItems);
                        }

                        var newVersion = LoadVersionNumber(proj, projectItem, hasCocoa, hasAndroid);

                        if (newVersion != null)
                        {
                            versions.Add(newVersion);

                            if (hasCocoa == true)
                            {
                                versions.HasIosMac = true;
                            }

                            if (hasAndroid == true)
                            {
                                versions.HasAndroid = true;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(versions);
        }
Esempio n. 2
0
        /// <summary>
        /// Builds the versions from the projects
        /// </summary>
        /// <param name="MainSolution">The main solution.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception"></exception>
        public ProjectVersionCollection BuildVersions(Solution MainSolution)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var versions = new ProjectVersionCollection();

            var projs = FindProjects(MainSolution);

            OnLoadedProjects(this, projs.Count);



            try
            {
                var loopPosition = 0;

                foreach (Project proj in projs)
                {
                    loopPosition++;

                    OnStartingProject.Invoke(this, new Tuple <int, string>(loopPosition, proj.Name));

                    if (!string.IsNullOrEmpty(proj.FileName) &&
                        proj.ProjectItems != null)
                    {
                        bool hasCocoa   = false;
                        bool hasAndroid = false;
                        bool isSdk      = false;
                        bool hasUwp     = false;

                        var         projectTypeGuids = GetProjectTypeGuids(proj);
                        ProjectItem projectItem      = null;

                        if (projectTypeGuids != null)
                        {
                            var ignorableTypes = new List <string>()
                            {
                                "{54435603-DBB4-11D2-8724-00A0C9A8B90C}"
                                , "{930C7802-8A8C-48F9-8165-68863BCCD9DD}"
                                , "{7CF6DF6D-3B04-46F8-A40B-537D21BCA0B4}" // Sandcast Help File Builder project
                            };

                            var firstTypeId = projectTypeGuids.First().ToUpper();

                            //if the type of the project is on the ignore list then skip
                            if (ignorableTypes.Contains(firstTypeId))
                            {
                                continue;
                            }

                            var iOSTypes = new List <string> {
                                "{FEACFBD2-3405-455C-9665-78FE426C6842}", "{EE2C853D-36AF-4FDB-B1AD-8E90477E2198}"
                            };
                            var androidTypes = new List <string> {
                                "{EFBA0AD7-5A72-4C68-AF49-83D382785DCF}", "{10368E6C-D01B-4462-8E8B-01FC667A7035}"
                            };
                            var macTypes = new List <string> {
                                "{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1}", "{EE2C853D-36AF-4FDB-B1AD-8E90477E2198}"
                            };
                            var uwpTypes = new List <string> {
                                "{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A}"
                            };

                            if (iOSTypes.Contains(projectTypeGuids.First()) || macTypes.Contains(projectTypeGuids.First()))
                            {
                                hasCocoa = true;
                            }
                            else if (androidTypes.Contains(projectTypeGuids.First()))
                            {
                                hasAndroid = true;
                            }
                            else if (uwpTypes.Contains(projectTypeGuids.First()))
                            {
                                hasUwp = true;
                            }

                            projectItem = FindAssemblyInfoProjectItem(proj.ProjectItems);

                            if (projectItem == null)
                            {
                                var newFailedProject = new FailedProject()
                                {
                                    Name   = proj.Name,
                                    Reason = Enum.FailureReason.MissingAssemblyInfo,
                                };

                                FailedProjects.Add(newFailedProject);

                                continue;
                            }
                        }
                        else
                        {
                            projectItem = FindAssemblyInfoProjectItem(proj.ProjectItems);

                            isSdk = true;
                        }

                        var newVersion = LoadVersionNumber(proj, projectItem, hasCocoa, hasAndroid, hasUwp, isSdk);

                        if (newVersion != null)
                        {
                            versions.Add(newVersion);

                            if (hasCocoa == true)
                            {
                                versions.HasIosMac = true;
                            }

                            if (hasAndroid == true)
                            {
                                versions.HasAndroid = true;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(versions);
        }