Exemplo n.º 1
0
        public void TestActivePatch()
        {
            HotPatchEditor.Active(new[] { "ToBePatched.dll" }, (name) => name + ".mod.dll", processSymbols: true);
            var patched = Assembly.LoadFile(
                Path.Combine(
                    Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                    "ToBePatched.dll.mod.dll"));

            MethodsToBePatchedType = patched.GetType("ToBePatched.MethodsToBePatched");
            ClassToBePatchedType   = patched.GetType("ToBePatched.ClassToBePatched");

            var stub = patched.GetType("ToBePatched.PatchStub");

            stub.InvokeMember("Apply", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public, null, null, new object[] { });
        }
        public void ProcessDll(string[] args)
        {
            Log("Start HotPatchEnabler ... ");
            HotPatchEditor.Log = Log;
            var dllFileNames = new List <string>();

            for (var i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "-a":
                    // eg: -a ./Client/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll
                    i += 1;
                    dllFileNames.Add(args[i]);
                    break;
                }
            }
            if (dllFileNames.Count > 0)
            {
                HotPatchEditor.Active(dllFileNames.ToArray());
            }
        }