/// <summary>
        /// Instruct the verify command to also verify the contents of the large files repository.
        /// </summary>
        /// <param name="command">
        /// The <see cref="VerifyCommand"/> to modify.
        /// </param>
        /// <param name="revision">
        /// The revision to verify.
        /// Defaults to <see cref="LargeFilesRevisions.Current"/>.
        /// </param>
        /// <param name="verify">
        /// What to verify.
        /// Defaults to <see cref="LargeFilesVerification.Existance"/>.
        /// </param>
        /// <returns>
        /// The <see cref="VerifyCommand"/>, for a fluent interface.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="command"/> is <c>null</c>.
        /// </exception>
        public static VerifyCommand WithVerifyLargeFiles(this VerifyCommand command, LargeFilesRevisions revision = LargeFilesRevisions.Current, LargeFilesVerification verify = LargeFilesVerification.Existance)
        {
            if (command == null)
                throw new ArgumentNullException("command");

            command.AddArgument("--large");

            switch (revision)
            {
                case LargeFilesRevisions.Current:
                    break;

                case LargeFilesRevisions.AllRevisions:
                    command.AddArgument("--lfa");
                    break;
            }

            switch (verify)
            {
                case LargeFilesVerification.Existance:
                    break;

                case LargeFilesVerification.Content:
                    command.AddArgument("--lfc");
                    break;
            }

            return command;
        }
        /// <summary>
        /// Specify that the files that are added should be added as large files if they're above a specific
        /// size, in megabytes, otherwise they should be added as normal files.
        /// </summary>
        /// <param name="command">
        /// The <see cref="AddCommand"/> to modify.
        /// </param>
        /// <param name="size">
        /// The size threshold, in megabytes, of which files above this size should be added as large files.
        /// </param>
        /// <returns>
        /// The <see cref="AddCommand"/>, for a fluent interface.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="command"/> is <c>null</c>.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <paramref name="size"/> is less than 1.
        /// </exception>
        public static AddCommand WithAddAllFilesAboveSizeAsLargeFiles(this AddCommand command, int size)
        {
            if (command == null)
                throw new ArgumentNullException("command");
            if (size < 1)
                throw new ArgumentOutOfRangeException("size", size, "size must be 1 or higher");

            command.AddArgument("--lfsize");
            command.AddArgument(size.ToString(CultureInfo.InvariantCulture));
            return command;
        }
        /// <summary>
        /// Specify that the files that are added should be added as normal files (ie. not as "large files".)
        /// </summary>
        /// <param name="command">
        /// The <see cref="AddCommand"/> to modify.
        /// </param>
        /// <returns>
        /// The <see cref="AddCommand"/>, for a fluent interface.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="command"/> is <c>null</c>.
        /// </exception>
        public static AddCommand WithAddAsNormalFile(this AddCommand command)
        {
            if (command == null)
                throw new ArgumentNullException("command");

            command.AddArgument("--normal");
            return command;
        }
        /// <summary>
        /// Do not check filenames for Windows incompatibilities.
        /// </summary>
        /// <param name="command">
        /// The <see cref="AddCommand"/> to modify.
        /// </param>
        /// <returns>
        /// The specified <see cref="AddCommand"/> <paramref name="command"/> object, for the
        /// fluent interface.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="command"/> is <c>null</c>.</para>
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// The CaseGuard extension is not installed and active.
        /// </exception>
        public static AddCommand WithoutWindowsFileNameChecks(this AddCommand command)
        {
            if (command == null)
                throw new ArgumentNullException("command");
            if (!CaseGuardExtension.IsInstalled)
                throw new InvalidOperationException("The caseguard extension is not installed and active");

            command.AddArgument("--nowincheck");
            return command;
        }
        /// <summary>
        /// Add files regardless of possible case-collision problems.
        /// </summary>
        /// <param name="command">
        /// The <see cref="AddCommand"/> to modify.
        /// </param>
        /// <returns>
        /// The specified <see cref="AddCommand"/> <paramref name="command"/> object, for the
        /// fluent interface.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="command"/> is <c>null</c>.</para>
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// The CaseGuard extension is not installed and active.
        /// </exception>
        public static AddCommand WithOverrideCaseCollision(this AddCommand command)
        {
            if (command == null)
                throw new ArgumentNullException("command");
            if (!CaseGuardExtension.IsInstalled)
                throw new InvalidOperationException("The caseguard extension is not installed and active");

            command.AddArgument("--override");
            return command;
        }
コード例 #6
0
        public static void AddArgument(this CodeAttributeDeclaration attribute, string name, string value)
        {
            if (value == null)
                throw new ArgumentNullException("value");

            CodeExpression expression;
            // Use convention that if string starts with $ its a const
            if (value.StartsWith(SnippetIndicator.ToString()))
            {
                expression = new CodeSnippetExpression(value.TrimStart(SnippetIndicator));
            }
            else
            {
                expression = new CodePrimitiveExpression(value);
            }
            attribute.AddArgument(name, expression);
        }
コード例 #7
0
 public static void AddArgument(this CodeAttributeDeclaration attribute, string name, object value)
 {
     attribute.AddArgument(name, new CodePrimitiveExpression(value));
 }
コード例 #8
0
 /// <summary>
 /// Adds and binds and argument in one step
 /// </summary>
 /// <param name="metadata">
 /// The activity metadata 
 /// </param>
 /// <param name="binding">
 /// The argument to bind 
 /// </param>
 /// <param name="argument">
 /// The runtime argument 
 /// </param>
 public static void AddAndBindArgument(
     this CodeActivityMetadata metadata, Argument binding, RuntimeArgument argument)
 {
     metadata.Bind(binding, argument);
     metadata.AddArgument(argument);
 }