public static void ReplaceText(this IFileSystem fileSystem, AbsoluteFilePath path, string text, int attempts) { RetryLoop.Try(attempts, () => { fileSystem.ReplaceText(path, text); return(Unit.Default); }); }
/// <exception cref="AggregateException"></exception> public static byte[] ReadAllBytes(this IFileSystem fileSystem, AbsoluteFilePath path, int maxAttempts) { return(RetryLoop.Try( maxAttempts, () => { using (var stream = fileSystem.OpenRead(path)) return stream.ReadAllBytes(); })); }
public static Stream Read(this IFileSystem fileSystem, AbsoluteFilePath path, int maxAttempts) { return(RetryLoop.Try( maxAttempts, () => fileSystem.OpenRead(path))); }