Beispiel #1
0
        private void OnInstallNugetPackageCommandInvoked(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (vs != null && vs.TryGetSelectedProject(out EnvDTE.Project project))
            {
                IComponentModel             componentModel = (IComponentModel)GetGlobalService(typeof(SComponentModel));
                IVsPackageInstallerServices nuget          = componentModel.GetService <IVsPackageInstallerServices>();
                IVsPackageInstaller         installer      = componentModel.GetService <IVsPackageInstaller>();
                EnvDTE.StatusBar            status         = vs.StatusBar;

                if (!nuget.IsPackageInstalled(project, nameof(Sassin)))
                {
                    try
                    {
                        status.Text = $"{Metadata.ProductName} installing {nameof(Sassin)}...";
                        status.Animate(true, EnvDTE.vsStatusAnimation.vsStatusAnimationBuild);

                        installer.InstallPackage(null, project, nameof(Sassin), Convert.ToString(null), false);
                    }
                    catch { status.Text = $"{Metadata.ProductName} failed to install {nameof(Sassin)}."; }
                    finally { status.Animate(false, EnvDTE.vsStatusAnimation.vsStatusAnimationBuild); }
                }
            }
        }
Beispiel #2
0
        private void OnConfigureCompileOnBuildCommandInvoked(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (vs != null && vs.TryGetSelectedProject(out EnvDTE.Project project))
            {
                IComponentModel             componentModel = (IComponentModel)GetGlobalService(typeof(SComponentModel));
                IVsPackageInstallerServices nuget          = componentModel.GetService <IVsPackageInstallerServices>();
                IVsPackageInstaller         installer      = componentModel.GetService <IVsPackageInstaller>();
                EnvDTE.StatusBar            status         = vs.StatusBar;

                if (!nuget.IsPackageInstalled(project, nameof(TSBuild)))
                {
                    try
                    {
                        status.Text = $"{Symbol.Name}: installing {nameof(TSBuild)} package...";
                        status.Animate(true, EnvDTE.vsStatusAnimation.vsStatusAnimationBuild);

                        installer.InstallPackage(null, project, nameof(TSBuild), Symbol.Version, false);
                    }
                    catch { status.Text = $"{Symbol.Name}: failed to install {nameof(TSBuild)}."; }
                    finally { status.Animate(false, EnvDTE.vsStatusAnimation.vsStatusAnimationBuild); }
                }
            }
        }
Beispiel #3
0
        public void Start(string assembly, string nspace, string type, string method,
                          EnvDTE.OutputWindowPane output, EnvDTE.StatusBar status)
        {
            if (!IsRunning)
            {
                _assembly  = assembly;
                _namespace = nspace;
                _type      = type;
                _method    = method;
                _output    = output;
                _status    = status;

                _thread      = new System.Threading.Thread(new ThreadStart(Run));
                _thread.Name = ThreadName;
                _thread.Start();
            }
        }
        static public void GeneratorFromSolution()
        {
            IEnumerable <string> files = Common.Instance.SolutionWatcher.Files.Select(file => file.Path);

            EnvDTE.StatusBar  sbar           = Common.Instance.DTE2.StatusBar;
            Action <int, int> progressAction = (current, total) =>
            {
                if ((current % 5) == 0)
                {
                    sbar.Progress(true, "QuickNavigation Scan solution " + current + "/" + total, current, total);
                }
            };

            sbar.Progress(true, "QuickNavigation Scan solution ...", 0, 0);
            GeneratorFromFiles(files, progressAction).ToArray();
            sbar.Progress(false);
        }
Beispiel #5
0
        void RefreshSymbolDatabase()
        {
            if (null == mFiles || !mFiles.Any())
            {
                return;
            }

            ReadSymbolDatabase();

            List <string> lToGenerate = new List <string>();

            foreach (FileData fileData in mFiles.Values)
            {
                if (fileData.LastSymbolsGeneration == DateTime.MinValue ||
                    fileData.LastSymbolsGeneration < System.IO.File.GetLastWriteTime(fileData.Path)
                    )
                {
                    lToGenerate.Add(fileData.Path);
                }
            }

            EnvDTE.StatusBar  sbar           = Common.Instance.DTE2.StatusBar;
            Action <int, int> progressAction = (current, total) =>
            {
                if ((current % 5) == 0)
                {
                    sbar.Progress(true, "QuickNavigation Scan solution " + current + "/" + total, current, total);
                }
            };
            IEnumerable <SymbolData> symbols = CTagsGenerator.GeneratorFromFiles(lToGenerate, progressAction);


            sbar.Progress(false, "QuickNavigation Analysing solution ...", 0, 0);

            //Associate symbols to DileData
            symbols
            .AsParallel()
            .GroupBy(symbol => symbol.AssociatedFile)
            .ForAll(pair => pair.Key.SetSymbols(pair));

            sbar.Progress(false);

            WriteSymbolDatabase();
        }