public IApplicationBuilder Add(string name, string path, string arguments, ImageSource icon, Key hotKey, bool isMain)
        {
            if (isMain && settings.GetHiddenMainApplications().Contains(path))
            {
                return(new EmptyAplicationBuilder());
            }

            return(applications.Add(name, path, arguments, icon, hotKey, isMain));
        }
        public IApplicationBuilder Add(string name, string path, string emptyArguments, string fileArguments, bool isAdministratorRequired, ImageSource icon, Key hotKey, bool isMain)
        {
            if (isMain && settings.HiddenMainApplications.Contains(path))
            {
                return(new EmptyAplicationBuilder());
            }

            return(applications.Add(name, path, emptyArguments, fileArguments, isAdministratorRequired, icon, hotKey, isMain));
        }
Beispiel #3
0
        public void Add(IApplicationCollection applications)
        {
            foreach (AdditionalApplicationModel model in settings.AdditionalApplications)
            {
                IApplicationBuilder builder = applications.Add(
                    model.Name,
                    model.Path,
                    null,
                    model.Arguments,
                    model.IsAdministratorRequired,
                    IconExtractor.Get(model.Path),
                    model.HotKey,
                    false
                    );

                foreach (AdditionalApplicationModel commandModel in model.Commands)
                {
                    builder.AddCommand(
                        commandModel.Name,
                        commandModel.Path,
                        null,
                        commandModel.Arguments,
                        commandModel.IsAdministratorRequired,
                        commandModel.HotKey
                        );
                }
            }
        }
        public void Add(IApplicationCollection applications)
        {
            string rawValue = Settings.Default.AdditionalApplications;
            if (!String.IsNullOrEmpty(rawValue))
            {
                AdditionalApplicationCollection collection = Converts
                    .To<string, AdditionalApplicationCollection>(rawValue);

                foreach (AdditionalApplicationModel model in collection.Items)
                    applications.Add(model.Name, model.Path, model.Arguments, IconExtractor.Get(model.Path), false);
            }
        }
Beispiel #5
0
        private void TryAdd(IApplicationCollection applications, string filePath)
        {
            if (File.Exists(filePath))
            {
                FileVersionInfo version = FileVersionInfo.GetVersionInfo(filePath);

                applications.Add(
                    String.Format("Visual Studio {0}.{1}", version.FileMajorPart, version.FileMinorPart),
                    new Version(version.FileMajorPart, version.FileMinorPart),
                    filePath,
                    null,
                    IconExtractor.Get(filePath),
                    Key.None,
                    true
                    );
            }
        }
        public void Add(IApplicationCollection applications)
        {
            string rawValue = Settings.Default.AdditionalApplications;

            if (!String.IsNullOrEmpty(rawValue))
            {
                AdditionalApplicationCollection collection = Converts
                                                             .To <string, AdditionalApplicationCollection>(rawValue);

                foreach (AdditionalApplicationModel model in collection.Items)
                {
                    IApplicationBuilder builder = applications.Add(model.Name, model.Path, model.Arguments, IconExtractor.Get(model.Path), model.HotKey, false);
                    foreach (AdditionalApplicationModel commandModel in model.Commands)
                    {
                        builder.AddCommand(commandModel.Name, commandModel.Path, commandModel.Arguments, commandModel.HotKey);
                    }
                }
            }
        }
        public void Add(IApplicationCollection applications)
        {
            IDirectoryNameSearch search = new LocalSearchProvider(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86));

            IDirectory directory = search
                                   .FindDirectories(TextSearch.CreateMatched("Microsoft VS Code"))
                                   .FirstOrDefault();

            if (directory == null)
            {
                return;
            }

            //IFile file = directory
            //    .WithFileNameSearch()
            //    .FindFiles(TextSearch.CreateMatched("Code", false), TextSearch.CreateMatched(".exe"))
            //    .FirstOrDefault();

            IFile file = directory
                         .WithFileEnumerator()
                         .FirstOrDefault(f => f.Name == "Code" && f.Extension == "exe");

            if (file == null)
            {
                return;
            }

            string          filePath = file.WithAbsolutePath().AbsolutePath;
            FileVersionInfo version  = FileVersionInfo.GetVersionInfo(filePath);

            applications.Add(
                String.Format("VS Code {0}.{1}.{2}", version.FileMajorPart, version.FileMinorPart, version.FileBuildPart),
                new Version(version.FileMajorPart, version.FileMinorPart),
                filePath,
                "{DirectoryPath}",
                IconExtractor.Get(filePath),
                Key.None,
                true
                );
        }
        private void TryAdd(IApplicationCollection applications, string filePath)
        {
            if (File.Exists(filePath))
            {
                FileVersionInfo version = FileVersionInfo.GetVersionInfo(filePath);

                IApplicationBuilder builder = applications.Add(
                    String.Format("Visual Studio {0}", VersionFormatter.Format(version)),
                    new Version(version.FileMajorPart, version.FileMinorPart, version.FileBuildPart),
                    filePath,
                    null,
                    null,
                    false,
                    IconExtractor.Get(filePath),
                    Key.None,
                    true
                    );

                AddAdministratorCommand(builder, filePath);
                AddExperimentalCommand(builder, filePath);
            }
        }
        public void Add(IApplicationCollection applications)
        {
            IDirectoryNameSearch search = new LocalSearchProvider(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86));
            IEnumerable<IDirectory> directories = search.FindDirectories(TextSearch.CreatePrefixed("Microsoft Visual Studio"));

            foreach (IDirectory directory in directories)
            {
                string filePath = Path.Combine(directory.WithAbsolutePath().AbsolutePath, @"Common7\IDE\devenv.exe");
                if (File.Exists(filePath))
                {
                    FileVersionInfo version = FileVersionInfo.GetVersionInfo(filePath);

                    applications.Add(
                        String.Format("Visual Studio {0}.{1}", version.FileMajorPart, version.FileMinorPart),
                        new Version(version.FileMajorPart, version.FileMinorPart),
                        filePath,
                        null,
                        IconExtractor.Get(filePath),
                        true
                    );
                }
            }
        }
Beispiel #10
0
        public void Add(IApplicationCollection applications)
        {
            foreach (var(name, filePath, version) in Enumerate())
            {
                IApplicationBuilder builder = applications.Add(
                    String.Format(
                        "{0} {1}",
                        name,
                        VersionFormatter.Format(version)
                        ),
                    version,
                    filePath,
                    null,
                    null,
                    false,
                    IconExtractor.Get(filePath),
                    Key.None,
                    true
                    );

                VsVersionLoader.AddAdministratorCommand(builder, filePath);
                VsVersionLoader.AddExperimentalCommand(builder, filePath);
            }
        }
Beispiel #11
0
        public void Add(IApplicationCollection applications)
        {
            List <(string suffix, IFile file)> files = new List <(string suffix, IFile file)>();

            foreach (var search in EnumerateProgramFolders())
            {
                IDirectory directory = search
                                       .directory
                                       .FindDirectories(TextSearch.CreateMatched("Microsoft VS Code"))
                                       .FirstOrDefault();

                if (directory == null)
                {
                    continue;
                }

                IFile file = directory
                             .WithFileEnumerator()
                             .FirstOrDefault(f => f.Name == "Code" && f.Extension == "exe");

                if (file == null)
                {
                    continue;
                }

                files.Add((search.suffix, file));
            }

            if (files.Count == 0)
            {
                return;
            }

            foreach (var search in files)
            {
                string          filePath = search.file.WithAbsolutePath().AbsolutePath;
                FileVersionInfo version  = FileVersionInfo.GetVersionInfo(filePath);

                IApplicationBuilder builder = applications.Add(
                    String.Format(
                        "VS Code{0} {1}",
                        files.Count == 1
                            ? String.Empty
                            : " " + search.suffix,
                        VersionFormatter.Format(version)
                        ),
                    new Version(version.FileMajorPart, version.FileMinorPart),
                    filePath,
                    null,
                    "{DirectoryPath}",
                    false,
                    IconExtractor.Get(filePath),
                    Key.None,
                    true
                    );

                builder.AddCommand(
                    "Run as Administrator",
                    filePath,
                    null,
                    null,
                    true,
                    Key.A
                    );
            }
        }