예제 #1
0
        public static void Replicate
        (
            [Required] string sourcefileStorageName,
            [Required] string destinationfileStorageName
        )
        {
            try
            {
                Console.WriteLine(string.Format("[Source {0}]", sourcefileStorageName));
                Console.WriteLine(string.Format("[Destination {0}]", destinationfileStorageName));
                Console.WriteLine();
                Console.WriteLine("Press enter to replicate ... ");
                Console.ReadLine();

                var progressNotifierPhase1 = new ProgressNotifier("Reading indexes");
                var progressNotifierPhase2 = new ProgressNotifier("Writing");

                var startDateTime = DateTime.Now;
                FileStorageFacade.Replicate(sourcefileStorageName, destinationfileStorageName, ReplicateBehaviour.ReplicateToNewStorage, AddFileBehaviour.ThrowExceptionWhenAlreadyExists, new FileStorageHandler.ExposeProgressDelegate(progressNotifierPhase1.ShowProgress), new FileStorageHandler.ExposeProgressDelegate(progressNotifierPhase2.ShowProgress));

                var timeSpan = DateTime.Now - startDateTime;
                Console.WriteLine(string.Format("This operation took {0} msecs", (Int64)timeSpan.TotalMilliseconds));
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("An error occured; {0}", e.Message));
            }
        }