// ReSharper disable once UnusedParameter.Global internal static void Main(string[] args) { // entry point for doorstop // At this point, literally nothing but mscorlib is loaded, // and since this class doesn't have any static fields that // aren't defined in mscorlib, we can control exactly what // gets loaded. try { if (Environment.GetCommandLineArgs().Contains("--verbose")) { WinConsole.Initialize(); } SetupLibraryLoading(); EnsureDirectories(); // this is weird, but it prevents Mono from having issues loading the type. // IMPORTANT: NO CALLS TO ANY LOGGER CAN HAPPEN BEFORE THIS var unused = StandardLogger.PrintFilter; #region // Above hack explaination /* * Due to an unknown bug in the version of Mono that Unity uses, if the first access to StandardLogger * is a call to a constructor, then Mono fails to load the type correctly. However, if the first access is to * the above static property (or maybe any, but I don't really know) it behaves as expected and works fine. */ #endregion log.Debug("Initializing logger"); SelfConfig.Load(); DisabledConfig.Load(); loader.Debug("Prepping bootstrapper"); InstallBootstrapPatch(); Updates.InstallPendingUpdates(); LibLoader.SetupAssemblyFilenames(true); pluginAsyncLoadTask = PluginLoader.LoadTask(); permissionFixTask = PermissionFix.FixPermissions(new DirectoryInfo(Environment.CurrentDirectory)); } catch (Exception e) { Console.WriteLine(e); } }
//private static string otherNewtonsoftJson = null; // ReSharper disable once UnusedParameter.Global internal static void Main(string[] args) { // entry point for doorstop // At this point, literally nothing but mscorlib is loaded, // and since this class doesn't have any static fields that // aren't defined in mscorlib, we can control exactly what // gets loaded. try { if (Environment.GetCommandLineArgs().Contains("--verbose")) { WinConsole.Initialize(); } SetupLibraryLoading(); /*var otherNewtonsoft = Path.Combine( * Directory.EnumerateDirectories(Environment.CurrentDirectory, "*_Data").First(), * "Managed", * "Newtonsoft.Json.dll"); * if (File.Exists(otherNewtonsoft)) * { // this game ships its own Newtonsoft; force load ours and flag loading theirs * LibLoader.LoadLibrary(new AssemblyName("Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed")); * otherNewtonsoftJson = otherNewtonsoft; * }*/ EnsureDirectories(); // this is weird, but it prevents Mono from having issues loading the type. // IMPORTANT: NO CALLS TO ANY LOGGER CAN HAPPEN BEFORE THIS var unused = StandardLogger.PrintFilter; #region // Above hack explaination /* * Due to an unknown bug in the version of Mono that Unity uses, if the first access to StandardLogger * is a call to a constructor, then Mono fails to load the type correctly. However, if the first access is to * the above static property (or maybe any, but I don't really know) it behaves as expected and works fine. */ #endregion log.Debug("Initializing logger"); SelfConfig.ReadCommandLine(Environment.GetCommandLineArgs()); SelfConfig.Load(); DisabledConfig.Load(); /* Removing this crap just in case. * if (AntiPiracy.IsInvalid(Environment.CurrentDirectory)) * { * loader.Error("Invalid installation; please buy the game to run BSIPA."); * * return; * } */ CriticalSection.Configure(); loader.Debug("Prepping bootstrapper"); // updates backup InstallBootstrapPatch(); LibLoader.SetupAssemblyFilenames(true); GameVersionEarly.Load(); Updates.InstallPendingUpdates(); //HarmonyProtector.Protect(); pluginAsyncLoadTask = PluginLoader.LoadTask(); permissionFixTask = PermissionFix.FixPermissions(new DirectoryInfo(Environment.CurrentDirectory)); } catch (Exception e) { Console.WriteLine(e); } }