Example #1
0
 public ProcessArgumentBuilder BuildWindowsArguments(ProcessArgumentBuilder args)
 {
     //var args = new ProcessArgumentBuilder();
     args.Append("/Y");
     if (Pattern.IsDefined())
     {
         args.AppendSwitchQuoted("/Pattern", ":", Pattern);
     }
     if (DestinationKey.IsDefined())
     {
         args.AppendSwitchQuotedSecret("/DestKey", ":", DestinationKey);
     }
     if (DestinationSAS.IsDefined())
     {
         args.AppendSwitchQuotedSecret("/DestSAS", ":", DestinationSAS);
     }
     if (SourceKey.IsDefined())
     {
         args.AppendSwitchQuotedSecret("/SourceKey", ":", SourceKey);
     }
     if (SourceSAS.IsDefined())
     {
         args.AppendSwitchQuotedSecret("/SourceSAS", ":", SourceSAS);
     }
     if (Recursive)
     {
         args.Append("/S");
     }
     if (BlobType != null)
     {
         args.AppendSwitchQuoted("/BlobType", ":", BlobType.ToString());
     }
     if (UseChecksum)
     {
         args.Append("/CheckMD5");
     }
     if (LogFile != null)
     {
         args.AppendSwitchQuoted("/V", ":", LogFile.FullPath);
     }
     if (ParameterFiles.Any())
     {
         foreach (var file in ParameterFiles)
         {
             args.AppendSwitchQuoted("@", ":", file.FullPath);
         }
     }
     if (FileHandlingBehaviour != null)
     {
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ArchiveOnly))
         {
             args.Append("/A");
         }
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ExcludeNewerSource))
         {
             args.Append("/XN");
         }
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ExcludeOlderSource))
         {
             args.Append("/XO");
         }
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.UpdateLastModified))
         {
             args.Append("/MT");
         }
     }
     if (Delimiter != null)
     {
         args.AppendSwitchQuoted("/Delimiter", ":", Delimiter.ToString());
     }
     if (ConcurrentOperations != 0)
     {
         args.AppendSwitchQuoted("/NC", ":", ConcurrentOperations.ToString());
     }
     if (TargetContentType.IsDefined())
     {
         args.AppendSwitchQuoted("/SetContentType", ":", TargetContentType);
     }
     if (PayloadFormat != PayloadFormat.Default)
     {
         args.AppendSwitchQuoted("/PayloadFormat", ":", PayloadFormat.ToString());
     }
     return(args);
 }
Example #2
0
 public ProcessArgumentBuilder BuildWindowsArguments(ProcessArgumentBuilder args)
 {
     //var args = new ProcessArgumentBuilder();
     args.Append("/Y");
     if (Pattern.IsDefined())
     {
         args.AppendSwitchQuoted("/Pattern", ":", Pattern);
     }
     if (DestinationKey.IsDefined())
     {
         args.AppendSwitchQuotedSecret("/DestKey", ":", DestinationKey);
     }
     if (DestinationSAS.IsDefined())
     {
         args.AppendSwitchQuotedSecret("/DestSAS", ":", DestinationSAS);
     }
     if (SourceKey.IsDefined())
     {
         args.AppendSwitchQuotedSecret("/SourceKey", ":", SourceKey);
     }
     if (SourceSAS.IsDefined())
     {
         args.AppendSwitchQuotedSecret("/SourceSAS", ":", SourceSAS);
     }
     if (Recursive)
     {
         args.Append("/S");
     }
     if (BlobType != null)
     {
         args.AppendSwitchQuoted("/BlobType", ":", BlobType.ToString());
     }
     if (UseChecksum)
     {
         args.Append("/CheckMD5");
     }
     if (LogFile != null)
     {
         args.AppendSwitchQuoted("/V", ":", LogFile.FullPath);
     }
     if (ParameterFiles.Any())
     {
         foreach (var file in ParameterFiles)
         {
             args.AppendSwitchQuoted("@", ":", file.FullPath);
         }
     }
     if (FileHandlingBehaviour != null)
     {
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ArchiveOnly))
         {
             args.Append("/A");
         }
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ExcludeNewerSource))
         {
             args.Append("/XN");
         }
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ExcludeOlderSource))
         {
             args.Append("/XO");
         }
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.UpdateLastModified))
         {
             args.Append("/MT");
         }
     }
     if (Delimiter != null)
     {
         args.AppendSwitchQuoted("/Delimiter", ":", Delimiter.ToString());
     }
     if (ConcurrentOperations != 0)
     {
         args.AppendSwitchQuoted("/NC", ":", ConcurrentOperations.ToString());
     }
     if (TargetContentType != null)
     {
         // Could be present but empty
         if (TargetContentType.Equals(String.Empty))
         {
             // If you specify this option without a value, then AzCopy sets each blob or file's content type according to its file extension.
             // https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy#setcontenttypecontent-type
             args.AppendSwitchQuoted("/SetContentType", String.Empty);
         }
         else
         {
             args.AppendSwitchQuoted("/SetContentType", ":", TargetContentType);
         }
     }
     if (PayloadFormat != PayloadFormat.Default)
     {
         args.AppendSwitchQuoted("/PayloadFormat", ":", PayloadFormat.ToString());
     }
     return(args);
 }