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 Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Mugsy33")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Ship-in-Release infrastructure shared by ASKA BepInEx mods (config GUID migration).")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AskaShared")] [assembly: AssemblyTitle("AskaShared")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 AskaShared { public static class ConfigMigration { private const string NewPrefix = "mugsy33."; private const string OldPrefix = "smithio.aska."; public static void Run(ConfigFile config, ManualLogSource log) { //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown bool flag = false; string text = null; bool flag2 = default(bool); try { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(config.ConfigFilePath); if (!fileNameWithoutExtension.StartsWith("mugsy33.", StringComparison.Ordinal)) { return; } string text2 = "smithio.aska." + fileNameWithoutExtension.Substring("mugsy33.".Length); text = Path.Combine(Paths.ConfigPath, fileNameWithoutExtension + ".cfg"); string text3 = Path.Combine(Paths.ConfigPath, text2 + ".cfg"); string text4 = Path.Combine(Paths.ConfigPath, text2 + ".cfg.migrated"); if (File.Exists(text)) { if (File.Exists(text4)) { File.Delete(text4); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Deleted migrated legacy configuration: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text4); } log.LogInfo(val); } else if (File.Exists(text3)) { File.Move(text3, text4, overwrite: true); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Legacy configuration renamed to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text4); } log.LogInfo(val); } } else if (File.Exists(text3)) { BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(31, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Legacy configuration detected: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text3); } log.LogInfo(val); string text5 = text + ".tmp"; File.Copy(text3, text5, overwrite: true); File.Move(text5, text, overwrite: true); flag = true; val = new BepInExInfoLogInterpolatedStringHandler(33, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Migrated legacy configuration to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); } log.LogInfo(val); config.Reload(); File.Move(text3, text4, overwrite: true); val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Legacy configuration renamed to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text4); } log.LogInfo(val); } } catch (Exception ex) { BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(62, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Configuration migration failed; using existing configuration. "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log.LogWarning(val2); if (flag && text != null) { try { File.Delete(text); return; } catch { return; } } } } } }