Ejemplo n.º 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);
     });
 }
Ejemplo n.º 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();
     }));
 }
Ejemplo n.º 3
0
 public static Stream Read(this IFileSystem fileSystem, AbsoluteFilePath path, int maxAttempts)
 {
     return(RetryLoop.Try(
                maxAttempts,
                () => fileSystem.OpenRead(path)));
 }