using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.NET.Common; using BepInExResoniteShim; using Elements.Assets; using Elements.Core; using FrooxEngine; using HarmonyLib; using Renderite.Shared; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(/*Could not decode attribute arguments.*/)] [assembly: TargetFramework(".NETCoreApp,Version=v10.0", FrameworkDisplayName = ".NET 10.0")] [assembly: AssemblyCompany("art0007i")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+a8f102d4939efd88db267d9641ff06928600f3e3")] [assembly: AssemblyProduct("BrandingEditor")] [assembly: AssemblyTitle("BrandingEditor")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/art0007i/BrandingEditor")] [assembly: AssemblyVersion("1.0.2.0")] [module: RefSafetyRules(11)] namespace BrandingEditor; [ResonitePlugin("art0007i.BrandingEditor", "BrandingEditor", "1.0.2", "art0007i", "https://github.com/art0007i/BrandingEditor")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { [HarmonyPatch(typeof(Engine), "Initialize")] public class LaunchOptionsPatch { public static void Prefix(LaunchOptions options) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) try { string text = ProcessPath(IconPath.Value); bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val; if (File.Exists(text)) { options.OverrideRendererIcon = IconDescriptor.FromFile(text); } else { ManualLogSource log = Log; val = new BepInExWarningLogInterpolatedStringHandler(64, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not find icon file at "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("! Taskbar icon will not be adjusted."); } log.LogWarning(val); } string text2 = ProcessPath(SplashPath.Value); if (File.Exists(text2)) { options.OverrideSplashScreen = SplashScreenDescriptor.FromFile(text2, (float2?)LoadingBarOffset.Value, (float?)RelativeSize.Value); return; } ManualLogSource log2 = Log; val = new BepInExWarningLogInterpolatedStringHandler(67, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not find splash file at "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("! Splash screen will not be adjusted."); } log2.LogWarning(val); } catch (global::System.Exception ex) { Log.LogError((object)("Failed to change splash screen / icon! Error: " + (object)ex)); } } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static EventHandler <>9__8_0; internal void b__8_0(object? _, EventArgs _) { UpdateIcon(); } } internal static ManualLogSource Log; private static ConfigEntry IconPath; private static ConfigEntry SplashPath; private static ConfigEntry RelativeSize; private static ConfigEntry LoadingBarOffset; private const string PathSuffix = "\nRelative paths are relative to the mod's dll loaction."; private const string ConfigSuffix = "\n\nChanging this option will require a game restart to apply."; private static string? OurPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); public override void Load() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0058: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown IconPath = ((BasePlugin)this).Config.Bind("General", "IconPath", "./Resources/icon.png", "The path to the icon which will be seen on the taskbar.\nRelative paths are relative to the mod's dll loaction."); ((BasePlugin)this).Config.Bind("General", "ReloadIcon", default(dummy), new ConfigDescription("Click this button to reload the icon manually.", (AcceptableValueBase)null, new object[1] { (object)new Action(UpdateIcon) })); SplashPath = ((BasePlugin)this).Config.Bind("General", "SplashPath", "./Resources/splash.png", "The path to the splash image which can be seen while Resonite is loading.\nRelative paths are relative to the mod's dll loaction.\n\nChanging this option will require a game restart to apply."); RelativeSize = ((BasePlugin)this).Config.Bind("General", "RelativeSize", 0.3f, "The height of the splash image relative to the window height (0.5 = half window height).\n\nChanging this option will require a game restart to apply."); LoadingBarOffset = ((BasePlugin)this).Config.Bind("General", "LoadingBarOffset", new float2(0f, -0.4f), "The position offset of the loading bar on the splash screen relative to the window height.\n\nChanging this option will require a game restart to apply."); ConfigEntry iconPath = IconPath; object obj = <>c.<>9__8_0; if (obj == null) { EventHandler val = delegate { UpdateIcon(); }; <>c.<>9__8_0 = val; obj = (object)val; } iconPath.SettingChanged += (EventHandler)obj; Log = ((BasePlugin)this).Log; ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted("art0007i.BrandingEditor"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" is loaded!"); } log.LogInfo(val2); ((BasePlugin)this).HarmonyInstance.PatchAll(); } private static void UpdateIcon() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (Engine.Current == null) { return; } string text = ProcessPath(IconPath.Value); if (File.Exists(text)) { Bitmap2D val = Bitmap2D.Load(text, (bool?)false, (AlphaHandling)0, 2147483647, 1f); bool2 val2 = ((Bitmap2DBase)val).Size != 128; if (((bool2)(ref val2)).Any()) { val = val.GetRescaled(128, 128, (bool?)null, false, (Filtering)1); } Engine.Current.RenderSystem.SetWindowIcon(val, (Action)null); } } private static string? ProcessPath(string path) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown try { if (OurPath != null && !Path.IsPathRooted(path)) { path = Path.Combine(OurPath, path); } return Path.GetFullPath(Environment.ExpandEnvironmentVariables(path)); } catch (global::System.Exception ex) { ManualLogSource log = Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(25, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not process path "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(path); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogWarning(val); return null; } } } public static class PluginMetadata { public const string GUID = "art0007i.BrandingEditor"; public const string NAME = "BrandingEditor"; public const string VERSION = "1.0.2"; public const string AUTHORS = "art0007i"; public const string REPOSITORY_URL = "https://github.com/art0007i/BrandingEditor"; }