コード例 #1
0
        /// <summary>Create a new hook chaining the given hooks together.</summary>
        /// <remarks>Create a new hook chaining the given hooks together.</remarks>
        /// <param name="hooks">hooks to execute, in order.</param>
        /// <returns>a new hook chain of the given hooks.</returns>
        public static PreUploadHook NewChain <_T0>(IList <_T0> hooks) where _T0 : PreUploadHook
        {
            PreUploadHook[] newHooks = new PreUploadHook[hooks.Count];
            int             i        = 0;

            foreach (PreUploadHook hook in hooks)
            {
                if (hook != PreUploadHook.NULL)
                {
                    newHooks[i++] = hook;
                }
            }
            if (i == 0)
            {
                return(PreUploadHook.NULL);
            }
            else
            {
                if (i == 1)
                {
                    return(newHooks[0]);
                }
                else
                {
                    return(new NGit.Transport.PreUploadHookChain(newHooks, i));
                }
            }
        }
コード例 #2
0
 /// <summary>Set the hook that controls how this instance will behave.</summary>
 /// <remarks>Set the hook that controls how this instance will behave.</remarks>
 /// <param name="hook">the hook; if null no special actions are taken.</param>
 public virtual void SetPreUploadHook(PreUploadHook hook)
 {
     preUploadHook = hook != null ? hook : PreUploadHook.NULL;
 }