private void NotifyFrontend(FrontendBackendHost host, UnityVersion unityVersion, Version version)
        {
            host.Do(rd =>
            {
                // if model is there, then ApplicationPath was already set via UnityEditorProtocol, it would be more
                // correct than any counted value
                if (myBackendUnityHost.BackendUnityModel.Value != null)
                {
                    return;
                }

                var info = UnityInstallationFinder.GetApplicationInfo(version, unityVersion);
                if (info == null)
                {
                    return;
                }

                var contentsPath = UnityInstallationFinder.GetApplicationContentsPath(info.Path);
                rd.UnityApplicationData.SetValue(new UnityApplicationData(info.Path.FullPath,
                                                                          contentsPath.FullPath,
                                                                          UnityVersion.VersionToString(info.Version),
                                                                          null, null, null));
                rd.RequiresRiderPackage.Set(UnityVersion.RequiresRiderPackage(info.Version));
            });
        }
        private void NotifyFrontend(UnityHost host, UnityVersion unityVersion)
        {
            host.PerformModelAction(rd =>
            {
                // if model is there, then ApplicationPath was already set via UnityEditorProtocol, it would be more correct than any counted value
                if (myUnityEditorProtocol.UnityModel.Value != null)
                {
                    return;
                }

                var version = unityVersion.GetActualVersionForSolution();
                var info    = UnityInstallationFinder.GetApplicationInfo(version, unityVersion);
                if (info == null)
                {
                    return;
                }

                var contentsPath = UnityInstallationFinder.GetApplicationContentsPath(info.Path);
                rd.UnityApplicationData.SetValue(new UnityApplicationData(info.Path.FullPath,
                                                                          contentsPath.FullPath,
                                                                          UnityVersion.VersionToString(info.Version),
                                                                          UnityVersion.RequiresRiderPackage(info.Version)
                                                                          ));
            });
        }
Exemple #3
0
        private static void NotifyFrontend(UnityHost host, UnityVersion unityVersion)
        {
            var version = unityVersion.GetActualVersionForSolution();
            var info    = UnityInstallationFinder.GetApplicationInfo(version);

            if (info == null)
            {
                return;
            }

            host.PerformModelAction(rd =>
            {
                // ApplicationPath may be already set via UnityEditorProtocol, which is more accurate
                if (!rd.ApplicationPath.HasValue())
                {
                    rd.ApplicationPath.SetValue(info.Path.FullPath);
                }
                if (!rd.ApplicationContentsPath.HasValue())
                {
                    var contentsPath = UnityInstallationFinder.GetApplicationContentsPath(version);
                    if (contentsPath != null)
                    {
                        rd.ApplicationContentsPath.SetValue(contentsPath.FullPath);
                    }
                }
                if (!rd.ApplicationVersion.HasValue() && info.Version != null)
                {
                    rd.ApplicationVersion.SetValue(UnityVersion.VersionToString(info.Version));
                }
            });
        }
        private static void NotifyFrontend(UnityHost host, UnityVersion unityVersion)
        {
            var version         = unityVersion.GetActualVersionForSolution();
            var applicationPath = unityVersion.GetActualAppPathForSolution();

            if (PlatformUtil.RuntimePlatform == PlatformUtil.Platform.MacOsX && !applicationPath.ExistsDirectory ||
                PlatformUtil.RuntimePlatform != PlatformUtil.Platform.MacOsX && !applicationPath.ExistsFile)
            {
                var info = UnityInstallationFinder.GetApplicationInfo(version);
                if (info == null)
                {
                    return;
                }
                applicationPath = info.Path;
                version         = info.Version;
            }

            host.PerformModelAction(rd =>
            {
                // ApplicationPath may be already set via UnityEditorProtocol, which will obviously be correct
                if (!rd.ApplicationPath.HasValue())
                {
                    rd.ApplicationPath.SetValue(applicationPath.FullPath);
                }

                if (!rd.ApplicationContentsPath.HasValue())
                {
                    var contentsPath = UnityInstallationFinder.GetApplicationContentsPath(applicationPath);
                    if (!contentsPath.IsEmpty)
                    {
                        rd.ApplicationContentsPath.SetValue(contentsPath.FullPath);
                    }
                }
                if (!rd.ApplicationVersion.HasValue() && version != null)
                {
                    rd.ApplicationVersion.SetValue(UnityVersion.VersionToString(version));
                }
            });
        }
Exemple #5
0
        private void NotifyFrontend(UnityHost host, UnityVersion unityVersion)
        {
            var version         = unityVersion.GetActualVersionForSolution();
            var applicationPath = unityVersion.GetActualAppPathForSolution();

            if (PlatformUtil.RuntimePlatform == PlatformUtil.Platform.MacOsX && !applicationPath.ExistsDirectory ||
                PlatformUtil.RuntimePlatform != PlatformUtil.Platform.MacOsX && !applicationPath.ExistsFile)
            {
                var info = UnityInstallationFinder.GetApplicationInfo(version);
                if (info == null)
                {
                    return;
                }
                applicationPath = info.Path;
                version         = info.Version;
            }

            host.PerformModelAction(rd =>
            {
                // if model is there, then ApplicationPath was already set via UnityEditorProtocol, it would be more correct than any counted value
                if (myUnityEditorProtocol.UnityModel.Value != null)
                {
                    return;
                }

                rd.ApplicationPath.SetValue(applicationPath.FullPath);
                var contentsPath = UnityInstallationFinder.GetApplicationContentsPath(applicationPath);
                if (!contentsPath.IsEmpty)
                {
                    rd.ApplicationContentsPath.SetValue(contentsPath.FullPath);
                }
                if (version != null)
                {
                    rd.ApplicationVersion.SetValue(UnityVersion.VersionToString(version));
                }
            });
        }
Exemple #6
0
        public UnityInstallationSynchronizer(Lifetime lifetime, UnitySolutionTracker solutionTracker,
                                             UnityHost host, UnityInstallationFinder finder, UnityVersion unityVersion)
        {
            solutionTracker.IsUnityProjectFolder.AdviseNotNull(lifetime, isUnityProjectFolder =>
            {
                if (!isUnityProjectFolder)
                {
                    return;
                }
                var version = unityVersion.GetActualVersionForSolution();
                var info    = finder.GetApplicationInfo(version);
                if (info == null)
                {
                    return;
                }

                var contentPath = finder.GetApplicationContentsPath(version);

                host.PerformModelAction(rd =>
                {
                    // ApplicationPath may be already set via UnityEditorProtocol, which is more accurate
                    if (!rd.ApplicationPath.HasValue())
                    {
                        rd.ApplicationPath.SetValue(info.Path.FullPath);
                    }
                    if (!rd.ApplicationContentsPath.HasValue())
                    {
                        rd.ApplicationContentsPath.SetValue(contentPath.FullPath);
                    }
                    if (!rd.ApplicationVersion.HasValue())
                    {
                        rd.ApplicationVersion.SetValue(UnityVersion.VersionToString(info.Version));
                    }
                });
            });
        }