Please disclose if your mod was created primarily 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 ChangelogEditor v1.0.9
ChangelogEditor.dll
Decompiled a year agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ChangelogEditor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Azumatt")] [assembly: AssemblyProduct("ChangelogEditor")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: AssemblyFileVersion("1.0.9")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.9.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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; } } } namespace ChangelogEditor { [HarmonyPatch(typeof(ChangeLog), "Start")] internal static class ChangeLogStartPatch { private static bool Prefix(ChangeLog __instance) { ChangelogEditorPlugin.ChangelogGameObject = ((Component)__instance).gameObject; ChangelogEditorPlugin.UpdateChangelogWidth(null, null); if (ChangelogEditorPlugin.overrideText.Value == ChangelogEditorPlugin.Toggle.On) { __instance.m_textField.text = ChangelogEditorPlugin.customFileText; return false; } if (ChangelogEditorPlugin.shouldChangeText.Value != ChangelogEditorPlugin.Toggle.On) { return true; } __instance.m_textField.text = ChangelogEditorPlugin.customFileText + __instance.m_changeLog.text; return false; } private static void Postfix(ChangeLog __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) ChangeLogExtension.topicTmp = ((Component)Utils.FindChild(((Component)__instance).transform, "Topic", (IterativeSearchType)0)).GetComponent<TextMeshProUGUI>(); RectTransform rectTransform = ((TMP_Text)ChangeLogExtension.topicTmp).rectTransform; rectTransform.anchoredPosition += new Vector2(0f, 20f); __instance.UpdateChangelog(); } } [HarmonyPatch(typeof(ChangeLog), "LateUpdate")] internal static class ChangeLogLateUpdatePatch { private static void Postfix(ChangeLog __instance) { ChangeLogExtension.UpdateTopicText(__instance); } } public static class ChangeLogExtension { internal static TextMeshProUGUI topicTmp; public static void UpdateChangelog(this ChangeLog __instance) { __instance.m_hasSetScroll = false; UpdateTopicText(__instance); if (ChangelogEditorPlugin.overrideText.Value == ChangelogEditorPlugin.Toggle.On) { __instance.m_textField.text = GeneralExtensions.ToLiteral(ChangelogEditorPlugin.customFileText, "\""); } else if (ChangelogEditorPlugin.shouldChangeText.Value == ChangelogEditorPlugin.Toggle.On) { __instance.m_textField.text = GeneralExtensions.ToLiteral(ChangelogEditorPlugin.customFileText, "\"") + __instance.m_changeLog.text; } else { __instance.m_textField.text = __instance.m_changeLog.text; } ((Component)__instance).gameObject.SetActive(ChangelogEditorPlugin.shouldShowChangelog.Value == ChangelogEditorPlugin.Toggle.On); } public static void UpdateTopicText(ChangeLog clog) { ((TMP_Text)topicTmp).text = ChangelogEditorPlugin.topicText.Value; } } [BepInPlugin("Azumatt.ChangelogEditor", "ChangelogEditor", "1.0.9")] public class ChangelogEditorPlugin : BaseUnityPlugin { public enum Toggle { On = 1, Off = 0 } private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] public string Category; [UsedImplicitly] public Action<ConfigEntryBase>? CustomDrawer; } private class AcceptableShortcuts : AcceptableValueBase { public AcceptableShortcuts() : base(typeof(KeyboardShortcut)) { } public override object Clamp(object value) { return value; } public override bool IsValid(object value) { return true; } public override string ToDescriptionString() { return "# Acceptable values: " + string.Join(", ", UnityInput.Current.SupportedKeyCodes); } } internal const string ModName = "ChangelogEditor"; internal const string ModVersion = "1.0.9"; internal const string Author = "Azumatt"; private const string ModGUID = "Azumatt.ChangelogEditor"; private static string ConfigFileName = "Azumatt.ChangelogEditor.cfg"; private static string ContentFile = "Azumatt.ChangelogEditor.txt"; private static string ConfigFileFullPath; private static string ContentFileFullPath; internal static string ConnectionError; internal static string customFileText; internal static GameObject ChangelogGameObject; private readonly Harmony _harmony = new Harmony("Azumatt.ChangelogEditor"); public static readonly ManualLogSource ChangelogEditorLogger; internal static ConfigEntry<Toggle> shouldShowChangelog; internal static ConfigEntry<Toggle> shouldChangeText; internal static ConfigEntry<Toggle> overrideText; internal static ConfigEntry<string> topicText; internal static ConfigEntry<float> changelogWidth; public void Awake() { shouldShowChangelog = config("1 - Changelog", "Should Show Changelog", Toggle.On, "If on, the changelog will be shown in the main menu. If off, it will not be shown."); shouldChangeText = config("1 - Changelog", "Should Change Text", Toggle.On, "If on, your configuration file's text will be added to the changelog. (at the top). This pulls from the " + ContentFile + " found in your config folder."); overrideText = config("1 - Changelog", "Override Changelog Text", Toggle.Off, "If on, only your custom text that is set will show in the changlog. This deletes the default changelog text."); topicText = TextEntryConfig("1 - Changelog", "Title Text", "Changelog", "Change the title text of the changelog. This is the text that shows up in the top of the changelog."); changelogWidth = config("1 - Changelog", "Width", 445f, "Width of the changelog window."); changelogWidth.SettingChanged += UpdateChangelogWidth; if (!File.Exists(ContentFileFullPath)) { File.WriteAllText(ContentFileFullPath, "This is the content file for ChangelogEditor. You can edit this file to change the changelog text." + Environment.NewLine + "This file can be found currently at: " + ContentFileFullPath + Environment.NewLine + Environment.NewLine); } else { customFileText = File.ReadAllText(ContentFileFullPath, Encoding.UTF8); } Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); SetupWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); changelogWidth.SettingChanged -= UpdateChangelogWidth; } internal static void UpdateChangelogWidth(object sender, EventArgs e) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ChangelogGameObject == (Object)null)) { RectTransform val = (RectTransform)ChangelogGameObject.transform; RectTransform val2 = (RectTransform)ChangelogGameObject.transform.Find("ScrollPanel"); RectTransform val3 = (RectTransform)ChangelogGameObject.transform.Find("PatchlogScroll"); Vector2 sizeDelta = val2.sizeDelta; val.sizeDelta = new Vector2(changelogWidth.Value, sizeDelta.y); ((Vector2)(ref sizeDelta))..ctor(changelogWidth.Value, sizeDelta.y); val2.sizeDelta = sizeDelta; Vector2 anchoredPosition = val2.anchoredPosition; val3.anchoredPosition = new Vector2(anchoredPosition.x, anchoredPosition.y); val3.anchorMin = new Vector2(0f, 0f); val3.anchorMax = new Vector2(0f, 1f); val3.pivot = new Vector2(0f, 0.5f); val3.anchoredPosition = new Vector2(0f, 0f); } } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; FileSystemWatcher fileSystemWatcher2 = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher2.Changed += ReadContent; fileSystemWatcher2.Created += ReadContent; fileSystemWatcher2.Renamed += ReadContent; fileSystemWatcher2.IncludeSubdirectories = true; fileSystemWatcher2.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher2.EnableRaisingEvents = true; FileSystemWatcher fileSystemWatcher3 = new FileSystemWatcher(Paths.ConfigPath, ContentFile); fileSystemWatcher3.Changed += ReadContent; fileSystemWatcher3.Created += ReadContent; fileSystemWatcher3.Renamed += ReadContent; fileSystemWatcher3.IncludeSubdirectories = true; fileSystemWatcher3.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher3.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { ChangelogEditorLogger.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { ChangelogEditorLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); ChangelogEditorLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private void ReadContent(object sender, FileSystemEventArgs e) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!File.Exists(ContentFileFullPath)) { return; } try { customFileText = File.ReadAllText(ContentFileFullPath, Encoding.UTF8); Scene activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name == "main") && !((Object)(object)ChangelogGameObject.gameObject == (Object)null) && Object.op_Implicit((Object)(object)ChangelogGameObject.GetComponent<ChangeLog>())) { ChangelogGameObject.GetComponent<ChangeLog>().UpdateChangelog(); } } catch { ChangelogEditorLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); ChangelogEditorLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description) { return ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, description); } private ConfigEntry<T> config<T>(string group, string name, T value, string description) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>())); } internal ConfigEntry<T> TextEntryConfig<T>(string group, string name, T value, string desc) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { CustomDrawer = TextAreaDrawer }; return config(group, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); } internal static void TextAreaDrawer(ConfigEntryBase entry) { GUILayout.ExpandHeight(true); GUILayout.ExpandWidth(true); entry.BoxedValue = GUILayout.TextArea((string)entry.BoxedValue, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); } static ChangelogEditorPlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; string configPath2 = Paths.ConfigPath; directorySeparatorChar = Path.DirectorySeparatorChar; ContentFileFullPath = configPath2 + directorySeparatorChar + ContentFile; ConnectionError = ""; customFileText = ""; ChangelogGameObject = null; ChangelogEditorLogger = Logger.CreateLogSource("ChangelogEditor"); shouldShowChangelog = null; shouldChangeText = null; overrideText = null; topicText = null; changelogWidth = null; } } }