Ejemplo n.º 1
0
        private void BindToInstallationSettingChange()
        {
            var entry = myBoundSettingsStore.Schema.GetScalarEntry((UnrealLinkSettings s) => s.InstallRiderLinkPlugin);

            myBoundSettingsStore.GetValueProperty <bool>(myLifetime, entry, null).Change.Advise_When(myLifetime, newValue => newValue, args =>
            {
                myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnrealPluginInstaller.CheckAllProjectsIfAutoInstallEnabled",
                                                      InstallPluginIfInfoAvailable);
            });
        }
Ejemplo n.º 2
0
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            NotificationsModel notifications,
            ISettingsStore settingsStore,
            PluginPathsProvider pluginPathsProvider,
            UnityVersion unityVersion,
            UnityHost unityHost,
            UnitySolutionTracker unitySolutionTracker,
            UnityRefresher refresher)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime             = lifetime;
            myLogger               = logger;
            mySolution             = solution;
            myShellLocks           = shellLocks;
            myDetector             = detector;
            myNotifications        = notifications;
            myPluginPathsProvider  = pluginPathsProvider;
            myUnityVersion         = unityVersion;
            myUnitySolutionTracker = unitySolutionTracker;
            myRefresher            = refresher;

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myQueue = new ProcessingQueue(myShellLocks, myLifetime);

            unityHost.PerformModelAction(rdUnityModel =>
            {
                rdUnityModel.InstallEditorPlugin.AdviseNotNull(lifetime, x =>
                {
                    myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnityPluginInstaller.InstallEditorPlugin", () =>
                    {
                        var installationInfo = myDetector.GetInstallationInfo(myCurrentVersion);
                        QueueInstall(installationInfo, true);
                    });
                });
            });

            unitySolutionTracker.IsUnityProjectFolder.AdviseOnce(lifetime, args =>
            {
                if (!args)
                {
                    return;
                }
                myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "IsAbleToEstablishProtocolConnectionWithUnity", InstallPluginIfRequired);
                BindToInstallationSettingChange();
            });
        }
Ejemplo n.º 3
0
        public UnityCacheUpdater(Lifetime lifetime, ISolution solution, UnityYamlSupport unityYamlSupport, IShellLocks locks, ChangeManager changeManager, UnityExternalFilesModuleFactory factory)
        {
            var module = factory.PsiModule;

            if (module != null)
            {
                unityYamlSupport.IsUnityYamlParsingEnabled.Change.Advise_NoAcknowledgement(lifetime, (handler) =>
                {
                    if (handler.HasNew && handler.HasOld && handler.New == handler.Old)
                    {
                        return;
                    }

                    locks.ExecuteOrQueueReadLockEx(lifetime, "YamlParsingStateChange", () =>
                    {
                        var psiSourceFiles = module.SourceFiles.ToList();
                        if (psiSourceFiles.Any())
                        {
                            locks.ExecuteWithWriteLock(() => changeManager.ExecuteAfterChange(() =>
                            {
                                var changeBuilder = new PsiModuleChangeBuilder();
                                foreach (var sourceFile in psiSourceFiles)
                                {
                                    if (sourceFile.IsValid())
                                    {
                                        changeBuilder.AddFileChange(sourceFile, PsiModuleChange.ChangeType.Modified);
                                    }
                                }
                                changeManager.OnProviderChanged(solution, changeBuilder.Result, SimpleTaskExecutor.Instance);
                            }));
                        }
                    });
                });
            }
        }
Ejemplo n.º 4
0
        private void CheckAllProjectsIfAutoInstallEnabled(PropertyChangedEventArgs <bool> args)
        {
            if (!args.GetNewOrNull())
            {
                return;
            }

            myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnityPluginInstaller.CheckAllProjectsIfAutoInstallEnabled", () => InstallPluginIfRequired(mySolution.GetAllProjects().Where(p => p.IsUnityProject()).ToList()));
        }
Ejemplo n.º 5
0
        private void BindToInstallationSettingChange()
        {
            var entry = myBoundSettingsStore.Schema.GetScalarEntry((UnitySettings s) => s.InstallUnity3DRiderPlugin);

            myBoundSettingsStore.GetValueProperty <bool>(myLifetime, entry, null).Change.Advise_NoAcknowledgement(myLifetime, args =>
            {
                if (!args.GetNewOrNull())
                {
                    return;
                }
                myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnityPluginInstaller.CheckAllProjectsIfAutoInstallEnabled", InstallPluginIfRequired);
            });
        }
 public ReflectedReferenceProviderValidator(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISettingsStore settingsStore, ISolution solution)
 {
     var providerValidator = this;
     changeManager.Changed2.Advise(lifetime, Handler(solution, providerValidator));
     settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()))
         .GetValueProperty<MvcCustomReferencesSettings, bool>(lifetime, mvcSettings => mvcSettings.Enabled)
         .Change.Advise_NoAcknowledgement(lifetime,
             () =>
             {
                 if (lifetime.IsTerminated)
                     return;
                 shellLocks.ExecuteOrQueueReadLockEx(lifetime, "ReflectedReferenceProviderValidator", () => shellLocks.ExecuteWithWriteLock(providerValidator.FireOnChanged));
             });
 }
Ejemplo n.º 7
0
        public UnrealPluginInstaller(Lifetime lifetime, ILogger logger, UnrealPluginDetector pluginDetector,
                                     PluginPathsProvider pathsProvider, ISolution solution, ISettingsStore settingsStore,
                                     IShellLocks shellLocks, UnrealHost unrealHost)
        {
            myLifetime           = lifetime;
            myLogger             = logger;
            myPathsProvider      = pathsProvider;
            myShellLocks         = shellLocks;
            myUnrealHost         = unrealHost;
            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myPluginDetector     = pluginDetector;

            myPluginDetector.InstallInfoProperty.Change.Advise_NewNotNull(myLifetime, installInfo =>
            {
                myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnrealPluginInstaller.CheckAllProjectsIfAutoInstallEnabled",
                                                      () =>
                {
                    var unrealPluginInstallInfo = installInfo.New;
                    if (unrealPluginInstallInfo.EnginePlugin.IsPluginAvailable)
                    {
                        // TODO: add install plugin to Engine
                    }
                    ;

                    if (!myBoundSettingsStore.GetValue((UnrealLinkSettings s) => s.InstallRiderLinkPlugin))
                    {
                        foreach (var installDescription in unrealPluginInstallInfo.ProjectPlugins)
                        {
                            if (installDescription.IsPluginAvailable == false ||
                                installDescription.PluginVersion != myPathsProvider.CurrentPluginVersion)
                            {
                                myUnrealHost.PerformModelAction(model => model.OnEditorModelOutOfSync());
                            }
                        }

                        return;
                    }

                    InstallPluginIfRequired(unrealPluginInstallInfo);
                });
            });
            BindToInstallationSettingChange();
            BindToNotificationFixAction();
        }
        void UnityReferencesTracker.IHandler.OnSolutionLoaded(UnityProjectsCollection solution)
        {
            myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnityPluginInstaller.OnSolutionLoaded", () => InstallPluginIfRequired(solution.UnityProjectLifetimes.Keys));

            BindToInstallationSettingChange();
        }