Exemplo n.º 1
0
 /// <summary>
 /// The copy task executed by BackgroundWorker.
 /// </summary>
 private void doWork(object sender, DoWorkEventArgs e)
 {
     result = ResultType.Error;
     try
     {
         using (StructureCopier copier = new StructureCopier(destinationPath, browseZipArchives, flattenPaths, resources))
         {
             copier.ProgressChanged += new EventHandler <CopyProgressChangedEventArgs>(workerProgressChanged);
             copier.CopyDirectoryStructure(sourceDir, () => backgroundWorker.CancellationPending);
             result = backgroundWorker.CancellationPending ? ResultType.Canceled : ResultType.Success;
         }
     }
     catch (Exception)
     {
         result = ResultType.Error;
     }
 }
Exemplo n.º 2
0
 private static void runCommandLineVersion(Arguments arguments, ResourceManager resources)
 {
     using (ConsoleWriter consoleWriter = new ConsoleWriter())
         using (var copier = new StructureCopier(arguments.DestinationArchive, arguments.Zip, arguments.Flatten, resources))
         {
             try
             {
                 consoleWriter.WriteLine();
                 consoleWriter.WriteLine(String.Format(resources.GetString("startedProcessing"), arguments.SourceDirectory));
                 copier.CopyDirectoryStructure(new DirectoryInfo(arguments.SourceDirectory), () => false);
                 consoleWriter.WriteLine(String.Format(resources.GetString("finishedProcessing"), arguments.DestinationArchive));
             }
             catch (Exception e)
             {
                 consoleWriter.WriteLine(String.Format(resources.GetString("commandLineError") + ":\n{0}\n", e.Message));
             }
         }
 }