Пример #1
0
        public List <UnityInstallationInfo> GetPossibleInstallationInfos()
        {
            var installations = GetPossibleApplicationPaths();

            return(installations.Select(path =>
            {
                Version version = null;
                switch (PlatformUtil.RuntimePlatform)
                {
                case PlatformUtil.Platform.Windows:
                    version = UnityVersion.ReadUnityVersionFromExe(path);
                    break;

                case PlatformUtil.Platform.MacOsX:
                    var infoPlistPath = path.Combine("Contents/Info.plist");
                    version = UnityVersion.GetVersionFromInfoPlist(infoPlistPath);
                    break;

                case PlatformUtil.Platform.Linux:
                    version = UnityVersion.Parse(path.FullPath);     // parse from path
                    break;
                }

                return new UnityInstallationInfo(version, path);
            }).ToList());
        }
        public List <UnityInstallationInfo> GetPossibleInstallationInfos()
        {
            var installations = GetPossibleApplicationPaths();

            return(installations.Select(a =>
            {
                var version = UnityVersion.Parse(a.FullPath);

                if (PlatformUtil.RuntimePlatform == PlatformUtil.Platform.Windows)
                {
                    version = new Version(new Version(FileVersionInfo.GetVersionInfo(a.FullPath).FileVersion).ToString(3));
                }
                else if (PlatformUtil.RuntimePlatform == PlatformUtil.Platform.MacOsX)
                {
                    var infoPlistPath = a.Combine("Contents/Info.plist");
                    var fullVersion = UnityVersion.GetVersionFromInfoPlist(infoPlistPath);
                    version = UnityVersion.Parse(fullVersion);
                }

                return new UnityInstallationInfo(version, a);
            }).ToList());
        }