private void Add2015AndOlder(IDirectoryNameSearch search, IApplicationCollection applications) { IEnumerable <IDirectory> directories = search.FindDirectories(TextSearch.CreatePrefixed("Microsoft Visual Studio")); foreach (IDirectory directory in directories) { TryAdd(applications, directory); } }
private void Add2017AndNewer(IDirectoryNameSearch search, IApplicationCollection applications) { IDirectory root = search .FindDirectories(TextSearch.CreateMatched("Microsoft Visual Studio")) .FirstOrDefault(); if (root == null) { return; } foreach (IDirectory version in root.WithDirectoryEnumerator()) { if (version.Name.Length == 4) { foreach (IDirectory edition in version.WithDirectoryEnumerator()) { TryAdd(applications, edition); } } } }