using HybridCLR.Editor.Commands; using Obfuz.Settings; using Obfuz4HybridCLR; using HybridCLR.Editor.Installer; using UnityEditor; using UnityEditor.Build; using UnityEngine; public class KedrExtensionMenu { [MenuItem("HybridCLR/KedrExtension/Settings...")] public static void OpenSettings() => SettingsService.OpenProjectSettings("Project/KedrExtension"); [MenuItem("HybridCLR/KedrExtension/GenerateAll")] public static void GenerateAll() { var installer = new InstallerController(); if (!installer.HasInstalledHybridCLR()) { throw new BuildFailedException("You have not initialized HybridCLR, please install it via menu 'HybridCLR/Installer'"); } var target = EditorUserBuildSettings.activeBuildTarget; CompileDllCommand.CompileDll(target); Il2CppDefGeneratorCommand.GenerateIl2CppDef(); if (ObfuzSettings.Instance.polymorphicDllSettings.enable) { PrebuildCommandExt.GeneratePolymorphicCodes(); } else { Debug.LogWarning("Polymorphic code generation is disabled."); } // New OpCodeShuffleCommand.GenerateOpCodes(); LinkGeneratorCommand.GenerateLinkXml(target); StripAOTDllCommand.GenerateStripedAOTDlls(target); var obfuscatedHotUpdateDllPath = PrebuildCommandExt.GetObfuscatedHotUpdateAssemblyOutputPath(target); ObfuscateUtil.ObfuscateHotUpdateAssemblies(target, obfuscatedHotUpdateDllPath); PrebuildCommandExt.GenerateMethodBridgeAndReversePInvokeWrapper(target, obfuscatedHotUpdateDllPath); PrebuildCommandExt.GenerateAOTGenericReference(target, obfuscatedHotUpdateDllPath); } }