Exemple #1
0
        /// <summary>
        /// Reverts the method patch using the specified <paramref name="patcher"/> Has no effect if no patches have been
        /// applied previously.
        /// </summary>
        /// <param name="patcher">The patcher object that can perform the patching.</param>
        /// <exception cref="ArgumentNullException">Thrown when the argument is null.</exception>
        void IPatch.RevertPatch(IPatcher patcher)
        {
            if (patcher == null)
            {
                throw new ArgumentNullException(nameof(patcher));
            }

            if (method != null)
            {
                patcher.RevertPatch(method);
                method = null;
            }
        }
Exemple #2
0
        /// <summary>
        /// Reverts the method patch using the specified <paramref name="patcher"/> Has no effect if no patches have been
        /// applied previously.
        /// </summary>
        /// <param name="patcher">The patcher object that can perform the patching.</param>
        /// <exception cref="ArgumentNullException">Thrown when the argument is null.</exception>
        public void RevertPatch(IPatcher patcher)
        {
            if (patcher == null)
            {
                throw new ArgumentNullException(nameof(patcher));
            }

            MethodInfo patchedMethod = method ?? GetMethod();

            if (patchedMethod != null)
            {
                patcher.RevertPatch(patchedMethod);
                method = null;
            }
        }