Beispiel #1
0
 public static void ReplaceText(this IFileSystem fileSystem, AbsoluteFilePath path, string text, int attempts)
 {
     RetryLoop.Try(attempts,
                   () =>
     {
         fileSystem.ReplaceText(path, text);
         return(Unit.Default);
     });
 }
Beispiel #2
0
 /// <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();
     }));
 }
Beispiel #3
0
 public static Stream Read(this IFileSystem fileSystem, AbsoluteFilePath path, int maxAttempts)
 {
     return(RetryLoop.Try(
                maxAttempts,
                () => fileSystem.OpenRead(path)));
 }