public static string[] GetFiles(string path) { if (path.Length < MAX_PATH) { return(System.IO.Directory.GetFiles(path)); } else { return(LongPathDirectory.EnumerateFiles(path).ToArray()); } }
public override IEnumerable <string> EnumerateFiles(string path, string searchPattern = "*", bool recursive = false) { foreach (string file in LongPathDirectory.EnumerateFiles(path, searchPattern)) { yield return(file); } if (recursive) { foreach (string directory in EnumerateDirectories(path, searchPattern, recursive: false)) { foreach (string file in EnumerateFiles(directory, searchPattern, recursive: true)) { yield return(file); } } } }
private void DeleteAllFolder(String parentDirectory) { if (parentDirectory == null) { return; } foreach (String file in LongPathDirectory.EnumerateFiles(parentDirectory)) { LongPathFile.Delete(file); } foreach (String info in LongPathDirectory.EnumerateDirectories(parentDirectory)) { this.DeleteAllFolder(info); } Microsoft.Experimental.IO.LongPathDirectory.Delete(parentDirectory); }
private static void LoadConfigurations(string path) { if (string.IsNullOrEmpty(path)) { path = LongPath.Combine(AssemblyExtensions.ApplicationDirectory, "WebServiceLibraries"); } try { var allFiles = LongPathDirectory.EnumerateFiles(path, "*.config", System.IO.SearchOption.AllDirectories); foreach (var file in allFiles) { try { var info = WebServiceRegistrationInfo.LoadFromFile(file); var gllName = LongPath.ChangeExtension(file, ".gll"); if (info.RegisteredVIs != null) { foreach (var item in info.RegisteredVIs) { if (item.Type == WebServiceType.HttpGetMethod) { var registeredExecutable = new RegisteredHttpGetVI( _connectionManager, _httpServer, gllName, item.VIComponentName, item.UrlPath); _connectionManager.AddConnectionType(registeredExecutable); } } } } catch (Exception e) { Log.LogError(0, e, $"Failed to load configuration: {file}"); } } } catch (Exception enumerateException) { Log.LogError(0, enumerateException, "Failed to enumerate configuration files"); } }
public IEnumerable <File> Files() { return(LongPathDirectory.EnumerateFiles(Path).Select(_localFileSystem.GetFile)); }