Esempio n. 1
0
        private ExtensionInstalledChecker(IVsExtensionRepository repository, IVsExtensionManager manager)
        {
            _repository = repository;
            _manager    = manager;

            SolutionHandler.ExtensionFileFound += ExtensionFileFound;
        }
        public VSIXPackageInformation GetCurrentVSIXPackageInformation()
        {
            VSIXPackageInformation outInfo = null;

            try
            {
                outInfo = new VSIXPackageInformation();

                // get ExtensionManager
                IVsExtensionManager manager = GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;
                // get your extension by Product Id
                IInstalledExtension myExtension = manager.GetInstalledExtension("FASTBuildMonitorVSIX.44bf85a5-7635-4a2e-86d7-7b7f3bf757a8");
                // get current version
                outInfo._version     = myExtension.Header.Version;
                outInfo._authors     = myExtension.Header.Author;
                outInfo._packageName = myExtension.Header.Name;
                outInfo._moreInfoURL = myExtension.Header.MoreInfoUrl.OriginalString;
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Exception: " + ex.ToString());
            }

            return(outInfo);
        }
        public void Uninstall(string id, bool removeDependencies, IEnumerable <string> dependencies, Action <LoggingLevel, string> logger)
        {
            if (id != ExtensionId)
            {
                return;
            }

            IVsExtensionManager vsExtensionManager = _vsExtensionManager.CanBeNull;

            if (vsExtensionManager == null)
            {
                return;
            }

            IInstalledExtension thisExtension;

            if (!vsExtensionManager.TryGetInstalledExtension(VsIntegrationExtensionId, out thisExtension))
            {
                return;
            }

            try {
                vsExtensionManager.Uninstall(thisExtension);
            }
            catch (Exception ex) {
                logger(LoggingLevel.WARN, "Could not uninstall EnhancedTooltip VS integration: {0}".FormatEx(ex));
            }
        }
Esempio n. 4
0
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            if (s_underlineClassification == null)
            {
                s_underlineClassification = ClassificationRegistry.GetClassificationType("UnderlineClassificationProPack");
            }

            if (textView.TextBuffer != buffer)
            {
                return(null);
            }

            IVsExtensionManager manager = _serviceProvider.GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;

            if (manager == null)
            {
                return(null);
            }

            IInstalledExtension extension;

            manager.TryGetInstalledExtension("GoToDef", out extension);
            if (extension != null)
            {
                return(null);
            }

            return(GetClassifierForView(textView) as ITagger <T>);
        }
 public Commands(IVsExtensionRepository repo, IVsExtensionManager manager, OleMenuCommandService mcs, IVsOutputWindowPane outputPane)
 {
     _repository = repo;
     _manager = manager;
     _mcs = mcs;
     _outputPane = outputPane;
 }
Esempio n. 6
0
        public bool Uninstall(string id, bool skipGlobal)
        {
            if (!extensionManager.TryGetInstalledExtension(id, out var _))
            {
                return(false);
            }

            while (extensionManager.TryGetInstalledExtension(id, out var installedExtension))
            {
                if (skipGlobal && installedExtension.InstalledPerMachine)
                {
                    return(false);
                }

                Console.WriteLine($"Uninstalling {NameVer(installedExtension)}");
                extensionManager.Uninstall(installedExtension);

                DirectoryUtil.DeleteHard(installedExtension.InstallPath, true);
                ExtensionManagerUtil.RemovePendingExtensionDeletion(externalSettingsManager, installedExtension.Header);

                // Reset extension manager cache
                ExtensionManagerService.Dispose();
                extensionManager = ExtensionManagerService.Create(externalSettingsManager);
            }

            return(true);
        }
        public static async Task RunAsync()
        {
            bool hasUpdates = await Installer.CheckForUpdatesAsync();

            if (!hasUpdates)
            {
                return;
            }
            _hasShownProgress = false;

            // Waits for MEF to initialize before the extension manager is ready to use
            await _package.GetServiceAsync(typeof(SComponentModel));

            IVsExtensionRepository repository = await _package.GetServiceAsync(typeof(SVsExtensionRepository)) as IVsExtensionRepository;

            IVsExtensionManager manager = await _package.GetServiceAsync(typeof(SVsExtensionManager)) as IVsExtensionManager;

            Version vsVersion = VsHelpers.GetVisualStudioVersion();

            _handler = await SetupTaskStatusCenter();

            Task task = Installer.RunAsync(vsVersion, repository, manager, _handler.UserCancellation);

            _handler.RegisterTask(task);
        }
Esempio n. 8
0
        private IEnumerable <ExtensionEntry> GetMissingExtensions(IVsExtensionManager manager)
        {
            IEnumerable <IInstalledExtension> installed    = manager.GetInstalledExtensions();
            IEnumerable <ExtensionEntry>      notInstalled = LiveFeed.Extensions.Where(ext => !installed.Any(ins => ins.Header.Identifier == ext.Id));

            return(notInstalled.Where(ext => !Store.HasBeenInstalled(ext.Id)));
        }
Esempio n. 9
0
        public static string GetContentLocation(string contentName)
        {
            IVsExtensionManager extensionManagerService = Package.GetGlobalService(typeof(SVsExtensionManager)) as IVsExtensionManager;

            if (extensionManagerService == null)
            {
                Logging.Log(Logging.Severity.Error, "Unable to obtain extension manager service");
                return(null);
            }

            IInstalledExtension lufaExt = null;

            if (extensionManagerService.TryGetInstalledExtension(GuidList.guidLUFAVSIXManifestString, out lufaExt) == false)
            {
                Logging.Log(Logging.Severity.Error, "Unable to obtain LUFA extension information");
                return(null);
            }

            string contentPath = null;

            try
            {
                string contentRelativePath = lufaExt.Content.Where(c => c.ContentTypeName == contentName).First().RelativePath;
                contentPath = Path.Combine(lufaExt.InstallPath, contentRelativePath);
            }
            catch (Exception e)
            {
                Logging.Log(Logging.Severity.Error, "Could not get content location: {0}", e.Message);
            }

            return(contentPath);
        }
Esempio n. 10
0
 internal CommandRunner(string appPath, Version version, string rootSuffix, IVsExtensionManager extensionManager)
 {
     _appPath          = appPath;
     _version          = version;
     _rootSuffix       = rootSuffix;
     _extensionManager = extensionManager;
 }
Esempio n. 11
0
        private void InstallExtension(IVsExtensionRepository repository, IVsExtensionManager manager, KeyValuePair <string, string> product)
        {
#if DEBUG
            System.Threading.Thread.Sleep(1000);
            return;
#endif

            try
            {
                GalleryEntry entry = repository.CreateQuery <GalleryEntry>(includeTypeInQuery: false, includeSkuInQuery: true, searchSource: "ExtensionManagerUpdate")
                                     .Where(e => e.VsixID == product.Key)
                                     .AsEnumerable()
                                     .FirstOrDefault();

                if (entry != null)
                {
                    IInstallableExtension installable = repository.Download(entry);
                    manager.Install(installable, false);

                    Telemetry.TrackEvent(installable.Header.Name);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
Esempio n. 12
0
            public static string GetVersion(out ReleaseTypes versionType)
            {
                versionType = ReleaseTypes.Unknown;

                IVsExtensionManager extensionManagerService = Package.GetGlobalService(typeof(SVsExtensionManager)) as IVsExtensionManager;

                if (extensionManagerService == null)
                {
                    return(null);
                }

                IInstalledExtension lufaExt = null;

                if (extensionManagerService.TryGetInstalledExtension(GuidList.guidLUFAVSIXManifestString, out lufaExt) == false)
                {
                    return(null);
                }

                string[] lufaVersionSegments = lufaExt.Header.Version.ToString().Split('.');

                if (lufaVersionSegments.First().Equals("0"))
                {
                    versionType = ReleaseTypes.Test;
                    return(lufaVersionSegments[1]);
                }
                else
                {
                    versionType = ReleaseTypes.Normal;
                    return(lufaVersionSegments.Last());
                }
            }
Esempio n. 13
0
        public IMouseProcessor GetAssociatedProcessor(IWpfTextView view)
        {
            var buffer = view.TextBuffer;

            IOleCommandTarget shellCommandDispatcher = GetShellCommandDispatcher(view);

            if (shellCommandDispatcher == null)
            {
                return(null);
            }

            ITelemetrySession   telemetrySession = TelemetrySessionForPPT.Create(typeof(GoToDefMouseHandler).Assembly);
            IVsExtensionManager manager          = _globalServiceProvider.GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;

            if (manager == null)
            {
                return(null);
            }

            IInstalledExtension extension;

            manager.TryGetInstalledExtension("GoToDef", out extension);
            if (extension != null)
            {
                return(null);
            }

            return(new GoToDefMouseHandler(view,
                                           shellCommandDispatcher,
                                           telemetrySession,
                                           _aggregatorFactory.GetClassifier(buffer),
                                           _navigatorService.GetTextStructureNavigator(buffer),
                                           CtrlKeyState.GetStateForView(view)));
        }
Esempio n. 14
0
        private void InstallExtension(IVsExtensionRepository repository, IVsExtensionManager manager, KeyValuePair<string, string> product, DataStore store)
        {
#if DEBUG
            System.Threading.Thread.Sleep(1000);
            return;
#endif

            try
            {
                GalleryEntry entry = repository.CreateQuery<GalleryEntry>(includeTypeInQuery: false, includeSkuInQuery: true, searchSource: "ExtensionManagerUpdate")
                                                                                 .Where(e => e.VsixID == product.Key)
                                                                                 .AsEnumerable()
                                                                                 .FirstOrDefault();

                if (entry != null)
                {
                    IInstallableExtension installable = repository.Download(entry);
                    manager.Install(installable, false);
                    store.PreviouslyInstalledExtensions.Add(entry.VsixID);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
Esempio n. 15
0
 public Commands(IVsExtensionRepository repo, IVsExtensionManager manager, OleMenuCommandService mcs, IVsOutputWindowPane outputPane)
 {
     _repository = repo;
     _manager    = manager;
     _mcs        = mcs;
     _outputPane = outputPane;
 }
Esempio n. 16
0
 private async Task InstallAsync(IEnumerable <ExtensionEntry> extensions,
                                 IVsExtensionRepository repository,
                                 IVsExtensionManager manager,
                                 CancellationToken token)
 {
     if (!extensions.Any() || token.IsCancellationRequested)
     {
         return;
     }
     await Task.Run(() =>
     {
         try
         {
             foreach (ExtensionEntry extension in extensions)
             {
                 if (token.IsCancellationRequested)
                 {
                     return;
                 }
                 InstallExtension(extension, repository, manager);
             }
         }
         catch (Exception ex)
         {
             Debug.Write(ex);
         }
         finally
         {
             Store.Save();
         }
     }).ConfigureAwait(false);
 }
        private static string GetContentLocation(string contentName)
        {
            IVsExtensionManager extensionManagerService = Package.GetGlobalService(typeof(SVsExtensionManager)) as IVsExtensionManager;

            if (extensionManagerService == null)
            {
                return(null);
            }

            IInstalledExtension dsExt = null;

            if (extensionManagerService.TryGetInstalledExtension(GuidList.guidVizMapPkgString, out dsExt) == false)
            {
                return(null);
            }

            string contentPath = null;

            try
            {
                string contentRelativePath = dsExt.Content.Where(c => c.ContentTypeName == contentName).First().RelativePath;
                contentPath = Path.Combine(dsExt.InstallPath, contentRelativePath);
            }
            catch { }

            return(contentPath);
        }
        private ExtensionInstalledChecker(IVsExtensionRepository repository, IVsExtensionManager manager)
        {
            _repository = repository;
            _manager = manager;

            SolutionHandler.ExtensionFileFound += ExtensionFileFound;
        }
Esempio n. 19
0
        private void InstallExtension(IVsExtensionRepository repository, IVsExtensionManager manager, KeyValuePair <string, string> product, DataStore store)
        {
#if DEBUG
            System.Threading.Thread.Sleep(1000);
            return;
#endif

            GalleryEntry entry = null;

            try
            {
                entry = repository.CreateQuery <GalleryEntry>(includeTypeInQuery: false, includeSkuInQuery: true, searchSource: "ExtensionManagerUpdate")
                        .Where(e => e.VsixID == product.Key)
                        .AsEnumerable()
                        .FirstOrDefault();

                if (entry != null)
                {
                    var installable = repository.Download(entry);
                    manager.Install(installable, false);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
            finally
            {
                if (entry != null)
                {
                    store.PreviouslyInstalledExtensions.Add(entry.VsixID);
                }
            }
        }
        private ExtensionInstalledChecker(IServiceProvider serviceProvider, IVsExtensionRepository repository, IVsExtensionManager manager)
        {
            _serviceProvider = serviceProvider;
            _repository      = repository;
            _manager         = manager;

            SolutionHandler.ExtensionFileFound += ExtensionFileFound;
        }
        private static bool TryGetRootAndShellFolder(IVsExtensionManager extensionManager, out string shellFolder, out string rootFolder)
        {
            // use reflection to get this information. currently there is no other way to get this information
            shellFolder = GetProperty(extensionManager, "ShellFolder");
            rootFolder = GetProperty(extensionManager, "RootFolder");

            return !string.IsNullOrEmpty(rootFolder) && !string.IsNullOrEmpty(shellFolder);
        }
Esempio n. 22
0
 internal CommandRunner(IConsoleContext consoleContext, IVsExtensionManager extensionManager,
                        InstalledVersion installedVersion, string rootSuffix)
 {
     Console           = consoleContext;
     _extensionManager = extensionManager;
     _installedVersion = installedVersion;
     _rootSuffix       = rootSuffix;
 }
Esempio n. 23
0
        private static bool TryGetRootAndShellFolder(IVsExtensionManager extensionManager, out string shellFolder, out string rootFolder)
        {
            // use reflection to get this information. currently there is no other way to get this information
            shellFolder = GetProperty(extensionManager, "ShellFolder");
            rootFolder  = GetProperty(extensionManager, "RootFolder");

            return(!string.IsNullOrEmpty(rootFolder) && !string.IsNullOrEmpty(shellFolder));
        }
Esempio n. 24
0
        private IEnumerable <KeyValuePair <string, string> > GetMissingExtensions(IVsExtensionManager manager, DataStore store)
        {
            var installed    = manager.GetInstalledExtensions();
            var products     = ExtensionList.Products();
            var notInstalled = products.Where(product => !installed.Any(ins => ins.Header.Identifier == product.Key)).ToArray();

            return(notInstalled.Where(ext => !store.HasBeenInstalled(ext.Key)));
        }
        private ExtensionInstalledChecker(IServiceProvider serviceProvider, IVsExtensionRepository repository, IVsExtensionManager manager)
        {
            _serviceProvider = serviceProvider;
            _repository = repository;
            _manager = manager;

            SolutionHandler.ExtensionFileFound += ExtensionFileFound;
        }
    //I have been calling this from the VSPackage's Initilize, passing in the component model
    public bool CheckForUpdates(IComponentModel componentModel)
    {
        _extensionRepository = (IVsExtensionRepository)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsExtensionRepository));
        _extensionManager    = (IVsExtensionManager)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsExtensionManager));
        //Find the extension you're after.
        var extension = _extensionManager.GetInstalledExtensions().Where(n => n.Header.Name == "Code Connect Alpha").SingleOrDefault();

        return(CheckAndInstallNewVersion(extension));
    }
Esempio n. 27
0
        public ExtensionManagerService(IVsExtensionManager obj)
        {
            if (obj.GetType() != GetRealType())
            {
                throw new InvalidCastException();
            }

            Obj = obj;
        }
Esempio n. 28
0
        private void GetExtensionManagerIncludeFolders(List <string> includeFolders)
        {
            IVsExtensionManager service = this.serviceProvider.GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;

            if (service != null)
            {
                includeFolders.AddRange(service.GetEnabledExtensionContentLocations("Microsoft.T4.Include"));
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async Task InitializeAsync(AsyncPackage package, IVsExtensionManager extenService)
        {
            // Switch to the main thread - the call to AddCommand in DisableCommand's constructor requires
            // the UI thread.
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            Instance = new DisableCommand(package, commandService, extenService);
        }
Esempio n. 30
0
        public void CheckForUpdates(IVsExtensionManager extensionManager, IVsExtensionRepository repoManager)
        {
            var plugin = collectionPluginToPluginMapper.MapFrom(GetCollection().plugin);
            var updatedExtension = extensionManager.GetInstalledExtensions().FirstOrDefault(x => GlobalConstants.PackageName == x.Header.Name && x.Header.Version < plugin.Version);

            if (updatedExtension.IsNotNull())
            {
                var dialogParameters = dialogMessageEventFactory.GetInstance(packageUpdateManager, updatedExtension, extensionManager, repoManager);
                dialogMessagesEvents.OnDialogMessageRequested(this, dialogParameters);
            }
        }
Esempio n. 31
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DisableCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        /// <param name="commandService">Command service to add command to, not null.</param>
        private DisableCommand(AsyncPackage package, OleMenuCommandService commandService, IVsExtensionManager extenService)
        {
            this.package   = package ?? throw new ArgumentNullException(nameof(package));
            _extManager    = extenService;
            commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));

            var menuCommandID = new CommandID(CommandSet, CommandId);
            var menuItem      = new MenuCommand(this.Execute, menuCommandID);

            commandService.AddCommand(menuItem);
        }
Esempio n. 32
0
 private void Initialize()
 {
     if (extensionManager == null || Extension == null)
     {
         extensionManager = serviceProvider.Get <IVsExtensionManager>();
         var checkoutAndBuild2Package = serviceProvider.Get <CheckoutAndBuild2Package>();
         CurrentVersion = checkoutAndBuild2Package.GetType().Assembly.GetName().Version;
         Extension      = GetExtension();
         ShowVSExtensionManagerCommand = new DelegateCommand <object>(ShowVSExtensionManager);
     }
 }
Esempio n. 33
0
 private static string GetProperty(IVsExtensionManager extensionManager, string propertyName)
 {
     try
     {
         return((string)extensionManager.GetType().GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(extensionManager));
     }
     catch
     {
         return(null);
     }
 }
Esempio n. 34
0
        /// <summary>
        /// Converts the given collection of extension properties and their identifiers to full paths.
        /// </summary>
        internal static Dictionary<string, string> GetInstalledExtensionPaths(IVsExtensionManager extensionManager, IDictionary<string, string> extensionIds)
        {
            // Update installed Extensions
            var installedExtensionPaths = new Dictionary<string, string>();
            extensionIds.ToList().ForEach(ie =>
            {
                installedExtensionPaths.Add(ie.Key, GetInstalledExtensionPath(extensionManager, ie.Value));
            });

            return installedExtensionPaths;
        }
Esempio n. 35
0
        public void Install(IVsExtensionManager manager, IInstalledExtension currentExtention, IInstallableExtension updatedExtension)
        {
            manager.Disable(currentExtention);
            manager.Uninstall(currentExtention);
            manager.Install(updatedExtension, false);

            var newlyInstalledVersion = manager.GetInstalledExtension(updatedExtension.Header.Identifier);
            if (newlyInstalledVersion.IsNotNull())
            {
                manager.Enable(newlyInstalledVersion);
            }
        }
Esempio n. 36
0
        /// <summary>
        /// Converts the given collection of extension properties and their identifiers to full paths.
        /// </summary>
        internal static Dictionary <string, string> GetInstalledExtensionPaths(IVsExtensionManager extensionManager, IDictionary <string, string> extensionIds)
        {
            // Update installed Extensions
            var installedExtensionPaths = new Dictionary <string, string>();

            extensionIds.ToList().ForEach(ie =>
            {
                installedExtensionPaths.Add(ie.Key, GetInstalledExtensionPath(extensionManager, ie.Value));
            });

            return(installedExtensionPaths);
        }
Esempio n. 37
0
        private static string GetInstalledExtensionPath(IVsExtensionManager extensionManager, string extensionId)
        {
            if (extensionManager != null)
            {
                IInstalledExtension extension;
                if (extensionManager.TryGetInstalledExtension(extensionId, out extension))
                {
                    return(NormalizePathForMsBuild(extension.InstallPath));
                }
            }

            return(null);
        }
Esempio n. 38
0
        private static string GetInstalledExtensionPath(IVsExtensionManager extensionManager, string extensionId)
        {
            if (extensionManager != null)
            {
                IInstalledExtension extension;
                if (extensionManager.TryGetInstalledExtension(extensionId, out extension))
                {
                    return NormalizePathForMsBuild(extension.InstallPath);
                }
            }

            return null;
        }
Esempio n. 39
0
 public Version GetCurrentVersion()
 {
     try
     {
         // get ExtensionManager
         IVsExtensionManager manager = GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;
         // get your extension by Product Id
         IInstalledExtension myExtension = manager.GetInstalledExtension("Disasmo.39513ef5-c3ee-4547-b7be-f29c752b591d");
         // get current version
         Version currentVersion = myExtension.Header.Version;
         return(currentVersion);
     }
     catch { return(new Version(0, 0)); }
 }
        private ShowSuggestionsCommand(Package package, IVsExtensionRepository repository, IVsExtensionManager manager)
        {
            _package = package;
            _repository = repository;
            _manager = manager;

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (commandService != null)
            {
                var menuCommandID = new CommandID(PackageGuids.guidExtensionCmdSet, PackageIds.cmdShowSuggestions);
                var button = new OleMenuCommand(async (s, e) => await ShowSuggestions(s, e), menuCommandID);
                commandService.AddCommand(button);
            }
        }
        // internal for testing purpose
        internal static ImmutableArray<HostDiagnosticAnalyzerPackage> GetHostAnalyzerPackages(IVsExtensionManager extensionManager)
        {
            var references = ImmutableArray.CreateBuilder<string>();
            foreach (var reference in extensionManager.GetEnabledExtensionContentLocations(AnalyzerContentTypeName))
            {
                if (string.IsNullOrEmpty(reference))
                {
                    continue;
                }

                references.Add(reference);
            }

            return ImmutableArray.Create(new HostDiagnosticAnalyzerPackage(name: null, assemblies: references.ToImmutable()));
        }
Esempio n. 42
0
        public ProductUpdateService(
            IVsExtensionRepository extensionRepository,
            IVsExtensionManager extensionManager,
            IVsUIShell vsUIShell,
            IProductUpdateSettings productUpdateSettings)
        {
            if (productUpdateSettings == null) {
                throw new ArgumentNullException("productUpdateSettings");
            }

            _vsUIShell = vsUIShell;
            _extensionRepository = extensionRepository;
            _extensionManager = extensionManager;
            _productUpdateSettings = productUpdateSettings;
        }
Esempio n. 43
0
        public VS2010UpdateWorker(IVsExtensionRepository extensionRepository, IVsExtensionManager extensionManager)
        {
            if (extensionManager == null)
            {
                throw new ArgumentNullException("extensionManager");
            }

            if (extensionRepository == null)
            {
                throw new ArgumentNullException("extensionRepository");
            }

            _extensionManager = extensionManager;
            _extensionRepository = extensionRepository;
        }
        // internal for testing purpose
        internal static ImmutableArray<HostDiagnosticAnalyzerPackage> GetHostAnalyzerPackagesWithName(IVsExtensionManager extensionManager, string rootFolder, string shellFolder)
        {
            var builder = ImmutableArray.CreateBuilder<HostDiagnosticAnalyzerPackage>();
            foreach (var extension in extensionManager.GetEnabledExtensions(AnalyzerContentTypeName))
            {
                var name = extension.Header.LocalizedName;
                var assemblies = extension.Content.Where(ShouldInclude)
                                                  .Select(c => GetContentLocation(shellFolder, rootFolder, extension.InstallPath, c.RelativePath))
                                                  .WhereNotNull();

                builder.Add(new HostDiagnosticAnalyzerPackage(name, assemblies.ToImmutableArray()));
            }

            return builder.ToImmutable();
        }
 public static void TraceStatisticsHeader(this ITracer traceSource, EnvDTE.DTE dte, IVsExtensionManager extensionManager)
 {
     traceSource.TraceStatistics("========================= NServiceBusStudio General Information =========================");
     traceSource.TraceStatistics("Operating System: {0}", StatisticsInformation.GetOperatingSystemVersion());
     traceSource.TraceStatistics("Machine Name: {0}", Environment.MachineName);
     traceSource.TraceStatistics("UserName: {0}", Environment.UserName);
     traceSource.TraceStatistics("VisualStudio Version: {0}", StatisticsInformation.GetVisualStudioVersion(dte));
     traceSource.TraceStatistics("NuPattern Version: {0}", typeof(NuPattern.Guard).AssemblyQualifiedName);
     traceSource.TraceStatistics("NServiceBusStudio Version: {0}", typeof(StatisticsInformation).Assembly.FullName);
     traceSource.TraceStatistics("Installation Directory: {0}", typeof(StatisticsInformation).Assembly.Location);
     traceSource.TraceStatistics("Other Extensions: {0}", String.Join (";", extensionManager.GetEnabledExtensions().Select (x => String.Format ("{0} ({1})", x.Header.Name, x.Header.Version.ToString()))));
     traceSource.TraceStatistics("=========================================================================================");
 }
 private static string GetProperty(IVsExtensionManager extensionManager, string propertyName)
 {
     try
     {
         return (string)extensionManager.GetType().GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(extensionManager);
     }
     catch
     {
         return null;
     }
 }
Esempio n. 47
0
        private void InstallExtension(IVsExtensionRepository repository, IVsExtensionManager manager, KeyValuePair<string, string> product)
        {
            try
            {
                GalleryEntry entry = repository.CreateQuery<GalleryEntry>(includeTypeInQuery: false, includeSkuInQuery: true, searchSource: "ExtensionManagerUpdate")
                                                                                 .Where(e => e.VsixID == product.Key)
                                                                                 .AsEnumerable()
                                                                                 .FirstOrDefault();

                if (entry != null)
                {
                    IInstallableExtension installable = repository.Download(entry);
                    manager.Install(installable, false);

                    Telemetry.TrackEvent(installable.Header.Name);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
Esempio n. 48
0
 public Updater(IVsExtensionRepository extensionRepository, IVsExtensionManager extensionManager)
 {
     _manager = extensionManager;
     _repository = extensionRepository;
     _checker = new UpdateChecker(extensionRepository, extensionManager);
 }
Esempio n. 49
0
 public static void Initialize(IServiceProvider serviceProvider, IVsExtensionRepository repository, IVsExtensionManager manager)
 {
     Instance = new InfoBarService(serviceProvider, repository, manager);
 }
 public ExtensionInstaller(IVsExtensionRepository repository, IVsExtensionManager manager)
 {
     _repository = repository;
     _manager = manager;
 }
 public static void Initialize(Package package, IVsExtensionRepository repository, IVsExtensionManager manager)
 {
     Instance = new ShowSuggestionsCommand(package, repository, manager);
 }
 public static void Initialize(IVsExtensionRepository repository, IVsExtensionManager manager)
 {
     Instance = new ExtensionInstalledChecker(repository, manager);
 }
Esempio n. 53
0
 internal CommandRunner(Version version, string rootSuffix, IVsExtensionManager extensionManager)
 {
     _version = version;
     _rootSuffix = rootSuffix;
     _extensionManager = extensionManager;
 }
Esempio n. 54
0
 public static IEnumerable<IInstalledExtension> GetExtensions(IVsExtensionManager manager)
 {
     return from e in manager.GetInstalledExtensions()
            where !e.Header.SystemComponent && !e.Header.AllUsers && !e.Header.InstalledByMsi && e.State == EnabledState.Enabled
            select e;
 }
 public ExtensionManagerFacade(IVsExtensionManager visualStudioExtensionManager,
     IVsExtensionRepository visualStudioExtensionRepository)
 {
     ExtensionManager = visualStudioExtensionManager;
     ExtensionRepository = visualStudioExtensionRepository;
 }
 public ExtensionInstaller(IServiceProvider serviceProvider, IVsExtensionRepository repository, IVsExtensionManager manager)
 {
     _serviceProvider = serviceProvider;
     _repository = repository;
     _manager = manager;
 }
Esempio n. 57
0
 public Commands(IVsExtensionRepository repo, IVsExtensionManager manager, OleMenuCommandService mcs)
 {
     _repository = repo;
     _manager = manager;
     _mcs = mcs;
 }
Esempio n. 58
0
        private IEnumerable<KeyValuePair<string, string>> GetMissingExtensions(IVsExtensionManager manager, DataStore store)
        {
            var installed = manager.GetInstalledExtensions();
            var products = ExtensionList.Products();
            var notInstalled = products.Where(product => !installed.Any(ins => ins.Header.Identifier == product.Key)).ToArray();

            return notInstalled.Where(ext => !store.HasBeenInstalled(ext.Key));

        }
 public static void Initialize(IServiceProvider serviceProvider, IVsExtensionRepository repository, IVsExtensionManager manager)
 {
     Instance = new ExtensionInstalledChecker(serviceProvider, repository, manager);
 }
Esempio n. 60
0
 private InfoBarService(IServiceProvider serviceProvider, IVsExtensionRepository repository, IVsExtensionManager manager)
 {
     _serviceProvider = serviceProvider;
     _repository = repository;
     _manager = manager;
 }