internal static async Task Delete() { await Task.Run(async delegate { FileHelper.Delete(FilePath); bool exists = true; int t = 0; while (exists && (t < 10)) { await Task.Delay(1000); exists = !FileHelper.Delete(FilePath); t++; } }); }
private static void deleteSource(string path) { Task.Run(async delegate { FileHelper.Delete(path); bool exists = true; int t = 0; while (exists && (t < 10)) { await Task.Delay(200); exists = !FileHelper.Delete(path); t++; } }); }
/*internal static string Up(string path) * { * if (!path.NullEmpty()) * { * if (path == myPC) return Home; * * try { return (new DirectoryInfo(path).Parent).FullName; } * catch (Exception exp) { ExceptionHelper.Log(exp); } * } * * return string.Empty; * }*/ internal static async void Delete(SmartItem[] items) { await Task.Run(() => { for (int i = 0; i < items.Length; i++) { if (items[i].IsFile) { FileHelper.Delete(items[i].FullName, true); } else { DirectoryHelper.Delete(items[i].FullName); } } }); }
internal static bool Start() { if (lastPath != null) { FileHelper.Delete(lastPath + @"\" + Source); } if (hasTmpFile() && canWatch()) { for (int i = 0; i < watchList.Count; i++) { watchList[i].EnableRaisingEvents = true; } return(true); } return(false); }