Beispiel #1
0
        public static Option <Directories> TryCreateDestinationIn(IAuditor auditor, DirectoryInfo destination, DirectoryInfo source)
        {
            int repeats   = 10;
            int pauseMsec = 100;

            while (repeats > 0)
            {
                try
                {
                    if (TryCreate(destination) is Some <DirectoryInfo> created)
                    {
                        Empty(created);
                        return(new Directories(source, created));
                    }
                    repeats -= 1;
                    Thread.Sleep(pauseMsec);
                }
                catch (Exception ex)
                {
                    auditor.FailedToCreateDestination(ex.Message);
                    return(None.Value);
                }
            }

            return(None.Value);
        }