示例#1
0
        public void InjectionSanity()
        {
            ReadOnlyCollection <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(BuilderTool_HandleInput_Patch.TARGET_METHOD);
            IEnumerable <CodeInstruction>        result             = BuilderTool_HandleInput_Patch.Transpiler(BuilderTool_HandleInput_Patch.TARGET_METHOD, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < result.Count());
        }
示例#2
0
        public void InjectionSanity()
        {
            ReadOnlyCollection <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(Equipment_RemoveItem_Patch.TARGET_METHOD);
            IEnumerable <CodeInstruction>        result             = Equipment_RemoveItem_Patch.Transpiler(Equipment_RemoveItem_Patch.TARGET_METHOD, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < result.Count());
        }
示例#3
0
        public void InjectionSanity()
        {
            List <CodeInstruction>        beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(BaseGhost_Finish_Patch.TARGET_METHOD);
            IEnumerable <CodeInstruction> result             = BaseGhost_Finish_Patch.Transpiler(BaseGhost_Finish_Patch.TARGET_METHOD, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < result.Count());
        }
示例#4
0
        public void InjectionSanity()
        {
            ReadOnlyCollection <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(ConstructorInput_OnCraftingBegin_Patch.TARGET_METHOD);
            IEnumerable <CodeInstruction>        result             = ConstructorInput_OnCraftingBegin_Patch.Transpiler(ConstructorInput_OnCraftingBegin_Patch.TARGET_METHOD, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < result.Count());
        }
示例#5
0
    public void InjectionSanity()
    {
        ReadOnlyCollection <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(CyclopsSonarButton_Update_Patch.TARGET_METHOD);
        IEnumerable <CodeInstruction>        result             = CyclopsSonarButton_Update_Patch.Transpiler(CyclopsSonarButton_Update_Patch.TARGET_METHOD, beforeInstructions);

        Assert.IsTrue(beforeInstructions.Count < result.Count());
    }
        public void InjectionSanity()
        {
            IEnumerable <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(CrashedShipExploder_Update_Patch.TARGET_METHOD);
            IEnumerable <CodeInstruction> result             = CrashedShipExploder_Update_Patch.Transpiler(CrashedShipExploder_Update_Patch.TARGET_METHOD, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count() <= result.Count());
        }
示例#7
0
        public void InjectionSanity()
        {
            IEnumerable <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(ConstructableBase_SetState_Patch.TARGET_METHOD);
            IEnumerable <CodeInstruction> result             = ConstructableBase_SetState_Patch.Transpiler(ConstructableBase_SetState_Patch.TARGET_METHOD, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count() < result.Count());
        }
        public void InjectionSanity()
        {
            List <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(ClipMapManager_ShowEntities_Patch.TARGET_METHOD);

            IEnumerable <CodeInstruction> result = ClipMapManager_ShowEntities_Patch.Transpiler(ClipMapManager_ShowEntities_Patch.TARGET_METHOD, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < result.Count());
        }
示例#9
0
    public void InjectionSanity()
    {
        IEnumerable <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(IngameMenu_QuitGameAsync_Patch.targetMethod);
        IEnumerable <CodeInstruction> result             = IngameMenu_QuitGameAsync_Patch.Transpiler(beforeInstructions);

        Assert.IsTrue(beforeInstructions.Count() == result.Count()); // The ifs in the target method are all false in the testing environment
                                                                     // so we are left with the same code instructions.
    }
示例#10
0
        public void InjectionSanity()
        {
            DynamicMethod          targetMethod       = (DynamicMethod)AccessTools.Method(typeof(Builder), "TryPlace");
            List <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(targetMethod);

            IEnumerable <CodeInstruction> result = Builder_TryPlace_Patch.Transpiler(targetMethod, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < result.Count());
        }
示例#11
0
        public void InjectionSanity()
        {
            MethodInfo             targetMethod       = AccessTools.Method(typeof(Constructable), "Construct");
            List <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(targetMethod);

            IEnumerable <CodeInstruction> result = Constructable_Construct_Patch.Transpiler(targetMethod, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < PatchTestHelper.GetInstructionCount(result));
        }
示例#12
0
        public void InjectionSanity()
        {
            MethodInfo targetMethod = Reflect.Method(() => Builder.TryPlace());
            ReadOnlyCollection <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(targetMethod);

            IEnumerable <CodeInstruction> result = Builder_TryPlace_Patch.Transpiler(targetMethod, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < result.Count());
        }
        public void InjectionSanity()
        {
            List <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(Pickupable_Drop_Patch.TARGET_METHOD);

            IEnumerable <CodeInstruction> result = Pickupable_Drop_Patch.Transpiler(Pickupable_Drop_Patch.TARGET_METHOD, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < result.Count());
            Assert.AreEqual(beforeInstructions.Count + 7, result.Count());
        }
        public void InjectionSanity()
        {
            List <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(ClipMapManager_HideEntities_Patch.TARGET_METHOD);

            IEnumerable <CodeInstruction> result = ClipMapManager_HideEntities_Patch.Transpiler(ClipMapManager_HideEntities_Patch.TARGET_METHOD, beforeInstructions);

            Assert.IsTrue(beforeInstructions.Count < result.Count());
            // 3 instructions are added for every ret, currently there are two.
            Assert.AreEqual(beforeInstructions.Count + 6, result.Count());
        }
示例#15
0
    public void CheckMethodValidity()
    {
        ReadOnlyCollection <CodeInstruction> instructions = PatchTestHelper.GetInstructionsFromMethod(CyclopsSonarButton_Update_Patch.TARGET_METHOD);

        for (int i = 0; i < instructions.Count; i++)
        {
            CodeInstruction instruction = instructions[i];
            if (instruction.opcode.Equals(CyclopsSonarButton_Update_Patch.INJECTION_OPCODE) && instruction.operand.Equals(CyclopsSonarButton_Update_Patch.INJECTION_OPERAND))
            {
                CodeInstruction nextBr = instructions[i + 2];
                Assert.IsTrue(nextBr.opcode.Equals(OpCodes.Brtrue), "Looks like subnautica code has changed. Update jump offset!");
            }
        }
    }