示例#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);
 }
示例#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);
 }
示例#3
0
 public ProcessArgumentBuilder BuildLinuxArguments(ProcessArgumentBuilder args)
 {
     args.Append("--quiet"); // equivalent to /Y for some reason
     if (Pattern.IsDefined())
     {
         args.AppendSwitchQuoted("--include", Pattern);
     }
     if (DestinationKey.IsDefined())
     {
         args.AppendSwitchQuotedSecret("--dest-key", DestinationKey);
     }
     if (DestinationSAS.IsDefined())
     {
         args.AppendSwitchQuotedSecret("--dest-sas", DestinationSAS);
     }
     if (SourceKey.IsDefined())
     {
         args.AppendSwitchQuotedSecret("--source-key", SourceKey);
     }
     if (SourceSAS.IsDefined())
     {
         args.AppendSwitchQuotedSecret("--source-sas", SourceSAS);
     }
     if (Recursive)
     {
         args.Append("--recursive");
     }
     if (BlobType != null)
     {
         args.AppendSwitch("--blob-type", BlobType.ToString().ToLower());
     }
     if (UseChecksum)
     {
         args.Append("--check-md5");
     }
     if (ParameterFiles.Any())
     {
         foreach (var file in ParameterFiles)
         {
             args.AppendSwitchQuoted("--config-file", file.FullPath);
         }
     }
     if (FileHandlingBehaviour != null)
     {
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ExcludeNewerSource))
         {
             args.Append("--exclude-newer");
         }
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ExcludeOlderSource))
         {
             args.Append("--exclude-older");
         }
         if (FileHandlingBehaviour.Value.HasFlag(FileHandling.UpdateLastModified))
         {
             args.Append("--preserve-last-modified-time");
         }
     }
     if (Delimiter != null)
     {
         args.AppendSwitchQuoted("--delimiter", Delimiter.ToString());
     }
     if (ConcurrentOperations != 0)
     {
         args.AppendSwitchQuoted("--parallel-level", ConcurrentOperations.ToString());
     }
     if (TargetContentType.IsDefined())
     {
         args.AppendSwitchQuoted("--set-content-type", TargetContentType);
     }
     return(args);
 }
示例#4
0
        public ProcessArgumentBuilder BuildLinuxArguments(ProcessArgumentBuilder args)
        {
            args.Append("--quiet"); // equivalent to /Y for some reason
            if (Pattern.IsDefined())
            {
                args.AppendSwitchQuoted("--include", Pattern);
            }
            if (DestinationKey.IsDefined())
            {
                args.AppendSwitchQuotedSecret("--dest-key", DestinationKey);
            }
            if (DestinationSAS.IsDefined())
            {
                args.AppendSwitchQuotedSecret("--dest-sas", DestinationSAS);
            }
            if (SourceKey.IsDefined())
            {
                args.AppendSwitchQuotedSecret("--source-key", SourceKey);
            }
            if (SourceSAS.IsDefined())
            {
                args.AppendSwitchQuotedSecret("--source-sas", SourceSAS);
            }
            if (Recursive)
            {
                args.Append("--recursive");
            }
            if (BlobType != null)
            {
                args.AppendSwitch("--blob-type", BlobType.ToString().ToLower());
            }
            if (UseChecksum)
            {
                args.Append("--check-md5");
            }
            if (ParameterFiles.Any())
            {
                foreach (var file in ParameterFiles)
                {
                    args.AppendSwitchQuoted("--config-file", file.FullPath);
                }
            }
            if (FileHandlingBehaviour != null)
            {
                if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ExcludeNewerSource))
                {
                    args.Append("--exclude-newer");
                }
                if (FileHandlingBehaviour.Value.HasFlag(FileHandling.ExcludeOlderSource))
                {
                    args.Append("--exclude-older");
                }
                if (FileHandlingBehaviour.Value.HasFlag(FileHandling.UpdateLastModified))
                {
                    args.Append("--preserve-last-modified-time");
                }
            }
            if (Delimiter != null)
            {
                args.AppendSwitchQuoted("--delimiter", Delimiter.ToString());
            }
            if (ConcurrentOperations != 0)
            {
                args.AppendSwitchQuoted("--parallel-level", 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("--set-content-type", String.Empty);
                }
                else
                {
                    args.AppendSwitchQuoted("--set-content-type", TargetContentType);
                }
            }

            return(args);
        }