Example #1
0
        /// <summary>
        /// Patches the VerifyItems routine in the item instance
        /// </summary>
        /// <param name="Item">The item of which to patch</param>
        private static void InitializeStripItem(ToolStripMenuItem Item)
        {
            // Patch out the VerifyItems check...
            var VerifyPatch = Item.GetMemberFunction("VerifyItems");
            var VerifyNop   = typeof(PaintMenuStrip).GetMethod("VerifyItemsNop", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            // Patch if we found it
            if (VerifyPatch != null)
            {
                Global.HookingInstance.Hook((MethodInfo)VerifyPatch, (MethodInfo)VerifyNop);
            }
        }