Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of REPOKorean v1.2.0
BepInEx/plugins/REPOKorean.dll
Decompiled 3 days agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.TextCore; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("bpforest")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.4.0")] [assembly: AssemblyInformationalVersion("1.1.4")] [assembly: AssemblyProduct("REPOKorean")] [assembly: AssemblyTitle("REPOKorean")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOKorean { internal static class FontManager { internal static TMP_FontAsset Font; private static AssetBundle? _bundle; internal static void Initialize(REPOKorean plugin) { LoadBundle(plugin); if ((Object)(object)Font != (Object)null) { ((MonoBehaviour)plugin).StartCoroutine(SetupFallback()); } } private static void LoadBundle(REPOKorean plugin) { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)plugin).Info.Location); string text = Path.Combine(directoryName, "rkofont"); _bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_bundle == (Object)null) { REPOKorean.Logger.LogError((object)"Failed to load AssetBundle."); return; } Font = _bundle.LoadAsset<TMP_FontAsset>("Assets/RKOFont.asset"); if ((Object)(object)Font == (Object)null) { REPOKorean.Logger.LogError((object)"Failed to load TMP_FontAsset."); } else { REPOKorean.Logger.LogInfo((object)("Loaded font: " + ((Object)Font).name)); } } private static IEnumerator SetupFallback() { yield return null; FaceInfo face = Font.faceInfo; FaceInfo tekoFace = face; TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset font in array) { if (((Object)font).name.StartsWith("Teko")) { if (!font.fallbackFontAssetTable.Contains(Font)) { font.fallbackFontAssetTable.Insert(0, Font); REPOKorean.Logger.LogDebug((object)("Added fallback to " + ((Object)font).name)); } tekoFace = font.faceInfo; break; } } face.m_PointSize = tekoFace.m_PointSize; face.m_Scale = tekoFace.m_Scale; face.m_LineHeight = tekoFace.m_LineHeight; face.m_AscentLine = tekoFace.m_AscentLine; face.m_DescentLine = tekoFace.m_DescentLine; Font.faceInfo = face; Font.ReadFontAssetDefinition(); REPOKorean.Logger.LogDebug((object)"FaceInfo synchronized."); } } internal static class LocalizationManager { private const string Folder = "Localizations"; internal static void Install() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)REPOKorean.Instance).Info.Location); string text = Path.Combine(directoryName, "Localizations"); if (!Directory.Exists(text)) { REPOKorean.Logger.LogWarning((object)"Localization folder not found."); return; } string destination = Path.Combine(Application.streamingAssetsPath, "Localizations"); CopyDirectory(text, destination); REPOKorean.Logger.LogInfo((object)"Localization installed."); } internal static void Restore() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)REPOKorean.Instance).Info.Location); string text = Path.Combine(directoryName, "Localizations"); if (!Directory.Exists(text)) { return; } string text2 = Path.Combine(Application.streamingAssetsPath, "Localizations"); string[] files = Directory.GetFiles(text, "*", SearchOption.AllDirectories); foreach (string path in files) { string relativePath = Path.GetRelativePath(text, path); string path2 = Path.Combine(text2, relativePath); if (File.Exists(path2)) { File.Delete(path2); } DeleteEmptyParents(Path.GetDirectoryName(path2), text2); } REPOKorean.Logger.LogInfo((object)"Localization restored."); } private static void CopyDirectory(string source, string destination) { Directory.CreateDirectory(destination); string[] files = Directory.GetFiles(source, "*", SearchOption.AllDirectories); foreach (string text in files) { string relativePath = Path.GetRelativePath(source, text); string text2 = Path.Combine(destination, relativePath); Directory.CreateDirectory(Path.GetDirectoryName(text2)); File.Copy(text, text2, overwrite: true); } } private static void DeleteEmptyParents(string dir, string stopAt) { while (dir.StartsWith(stopAt) && Directory.Exists(dir) && Directory.GetFiles(dir).Length == 0 && Directory.GetDirectories(dir).Length == 0) { Directory.Delete(dir); dir = Path.GetDirectoryName(dir); } } } [BepInPlugin("bpforest.repo.REPOKorean", "REPOKorean", "1.1.4")] public class REPOKorean : BaseUnityPlugin { private Harmony? _harmony; internal static REPOKorean Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown Instance = this; ((Component)this).transform.parent = null; ((Object)this).hideFlags = (HideFlags)61; FontManager.Initialize(this); LocalizationManager.Install(); _harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); _harmony.PatchAll(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.Name} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded."); } private void OnApplicationQuit() { LocalizationManager.Restore(); } private void OnDestroy() { LocalizationManager.Restore(); Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } }