public static async Task <bool> ExistsAsync(string path) { return(await EmcTask <bool> .Run(() => { return Exists(path); }).ConfigureAwait(false)); }
public static async Task <IEnumerable <string> > EnumerateDirectoriesAsync(string path, string searchPattern, SearchOption searchOption) { return(await EmcTask <string[]> .Run(() => { return EnumerateDirectories(path, searchPattern, searchOption); }).ConfigureAwait(false)); }
public static async Task <IEnumerable <string> > EnumerateFilesAsync(string path, string searchPattern) { return(await EmcTask <IEnumerable <string> > .Run(() => { return EnumerateFiles(path, searchPattern); }).ConfigureAwait(false)); }
public static async Task <IEnumerable <string> > EnumerateDirectoriesAsync(string path) { return(await EmcTask <IEnumerable <string> > .Run(() => { return EnumerateDirectories(path); }).ConfigureAwait(false)); }
public static async Task WriteJsonAsync(string filename, object value, bool formatting = false) { await EmcTask.Run(() => { WriteJson(filename, value, formatting); }).ConfigureAwait(false); }
public static async Task CopyAsync(string sourcePath, string destinationPath, bool overwrite) { await EmcTask.Run(() => { Copy(sourcePath, destinationPath, overwrite); }).ConfigureAwait(false); }
public static bool Ping(string ipAddress, int timeout = 2000, int retries = 5) { var task = EmcTask <bool> .Run(async() => { using (var pingSender = new Ping()) { var options = new PingOptions { DontFragment = true }; string data = "12345678901234567890123456789012"; byte[] buffer = Encoding.ASCII.GetBytes(data); try { for (int retry = 0; retry < retries; retry++) { if ((await pingSender.SendPingAsync(ipAddress, timeout, buffer, options).ConfigureAwait(false)).Status == IPStatus.Success) { return(true); } } } catch { } return(false); } }); task.Wait(); return(task.Result); }
public static async Task DeleteAsync(string path, bool recursive) { await EmcTask.Run(() => { Delete(path, recursive); }).ConfigureAwait(false); }
public static async Task <string> ReadAllTextAsync(string fileName) { return(await EmcTask.Run <string>(() => { return ReadAllText(fileName); }).ConfigureAwait(false)); }
public static async Task AppendAllTextAsync(string fileName, string text) { await EmcTask.Run(() => { AppendAllText(fileName, text); }).ConfigureAwait(false); }
public static async Task CopyAsync(string sourceFileName, string destinationFileName, bool overwrite = false) { await EmcTask.Run(() => { Copy(sourceFileName, destinationFileName, overwrite); }).ConfigureAwait(false); }
public static async Task EnsureExistDeleteAsync(string fileName) { await EmcTask.Run(() => { EnsureExistDelete(fileName); }).ConfigureAwait(false); }
public static async Task <bool> ExistAsync(string fileName) { return(await EmcTask <bool> .Run(() => { return Exist(fileName); }).ConfigureAwait(false)); }
public static async Task CreateDirectoryAsync(string path) { await EmcTask.Run(() => { CreateDirectory(path); }).ConfigureAwait(false); }
public static async Task <bool> PingAsync(string ipAddress, int timeout = 2000, int retries = 5) { return(await EmcTask <bool> .Run(() => { return Ping(ipAddress, timeout, retries); }).ConfigureAwait(false)); }
public static async Task ClearAsync(string path) { await EmcTask.Run(() => { Clear(path); }).ConfigureAwait(false); }
public static async Task <string> EnsureDirectoryExistsAsync(string path) { return(await EmcTask <string> .Run(() => { return EnsureDirectoryExists(path); }).ConfigureAwait(false)); }
public static async Task <T> ReadJsonAsync <T>(string filename) { return(await EmcTask.Run <T>(() => { return ReadJson <T>(filename); }).ConfigureAwait(false)); }
public static async Task <bool> CheckPortUsageAsync(int port) { return(await EmcTask <bool> .Run(() => CheckPortUsage(port)).ConfigureAwait(false)); }