public static string[] DirectoryGetFilesWithWildcards(string path) { if (!IsPathWithWildcards(path)) { throw new ArgumentException("Path doesn't contains wildcard"); } var currentFolderList = new Strings(); int firstWildcardIndex = path.IndexOfAny(Util.WildcardCharacters); int firstSeparatorIndex = path.LastIndexOfAny(Util._pathSeparators, firstWildcardIndex); string[] wildcardsPart = path.Substring(firstSeparatorIndex + 1).Split(Util._pathSeparators, StringSplitOptions.RemoveEmptyEntries); currentFolderList.Add(firstSeparatorIndex == -1 ? "." : path.Substring(0, firstSeparatorIndex)); // Iterate over folders' part for (int i = 0; i < wildcardsPart.Length - 1; ++i) { currentFolderList = ListFileSystemItemWithWildcardInFolderList(wildcardsPart[i], currentFolderList, DirectoryGetDirectories, DirectoryExists); } // Handle last item of the wildcard part, that is a file var result = ListFileSystemItemWithWildcardInFolderList(wildcardsPart.Last(), currentFolderList, DirectoryGetFiles, FileExists); // Cleanup path var cleanResult = new Strings(); cleanResult.AddRange(result.Select(SimplifyPath)); return(cleanResult.ToArray()); }
public static string[] GetDurangoUsingDirectories(this DevEnv visualVersion) { Strings usingDirectories = new Strings(); usingDirectories.Add(Path.Combine(Durango.Util.GetDurangoExtensionXDK(), "References", "CommonConfiguration", "Neutral")); string durangoXDKPath = GlobalSettings.DurangoXDK; switch (visualVersion) { case DevEnv.vs2012: { if (Durango.Util.IsDurangoSideBySideXDK()) { usingDirectories.Add(Path.Combine(durangoXDKPath, GlobalSettings.XdkEditionTarget, @"Compilers\dev11.1\crt\platform\amd64")); } else { usingDirectories.Add(Path.Combine(durangoXDKPath, @"xdk\crt\platform\amd64")); } } break; case DevEnv.vs2015: { string trailingPath = @"xdk\VS2015\vc\platform\amd64"; if (Durango.Util.IsDurangoSideBySideXDK()) { usingDirectories.Add(Path.Combine(durangoXDKPath, GlobalSettings.XdkEditionTarget, trailingPath)); } else { usingDirectories.Add(Path.Combine(durangoXDKPath, trailingPath)); } } break; case DevEnv.vs2017: { string trailingPath = (GlobalSettings.EnableLegacyXdkHeaders) ? @"xdk\VS2015\vc\platform\amd64" : @"xdk\VS2017\vc\platform\amd64"; if (Durango.Util.IsDurangoSideBySideXDK()) { usingDirectories.Add(Path.Combine(durangoXDKPath, GlobalSettings.XdkEditionTarget, trailingPath)); } else { usingDirectories.Add(Path.Combine(durangoXDKPath, trailingPath)); } } break; default: throw new NotImplementedException("No DurangoUsingDirectories associated with " + visualVersion); } return(usingDirectories.ToArray()); }