コード例 #1
0
ファイル: MainForm.cs プロジェクト: PaddyWilson/HaloMods
        private void btnForge_Click(object sender, EventArgs e)
        {
            btnForge.Enabled = false;

            if (!CheckInstallMCCLocation())
            {
                Logger.LogLine("Can't file \"MCC-WindowsNoEditor.pak\", is the MCC install location correct.");
                btnForge.Enabled = true;
                return;
            }

            Logger.LogLine("Creating Backup of \"MCC-WindowsNoEditor.pak\"");
            if (!ForgeFileSwap.MoveOriginalFile())
            {
                Logger.LogLine("Can't backup \"MCC-WindowsNoEditor.pak\", if the game is running close it.");
                btnForge.Enabled = true;
                return;
            }
            //File.Move(ForgeFileSwap.VanillaFilePath, ModsLocation + "\\Vanilla\\MCC-WindowsNoEditor.pak");

            Logger.LogLine("Creating copy to mod");
            File.Copy(ForgeFileSwap.NewFilePath, ForgeFileSwap.ModdedFilePath);

            Logger.LogLine("Modding copy");
            List <HexEditData> enableForge = new List <HexEditData>()
            {
                new HexEditData()
                {
                    Position = 0x2FFC72D0, Bytes = 0x27
                },
                new HexEditData()
                {
                    Position = 0x2FFD4110, Bytes = 0x27
                }
            };

            //mod the copy to enable forge
            FileUtil.HexEdit(ForgeFileSwap.ModdedFilePath, enableForge);

            //FileUtil.CreateHardLink(MCCLocation + OriginalMCCpakFile, ModsLocation + "\\Vanilla\\MCC-WindowsNoEditor.pak");

            Logger.LogLine("Forge can now be enabled by pressing the \"Modded\" button.");
            //btnForge.Enabled = true;
        }