コード例 #1
0
        //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();

                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();

                Updates.InstallPendingUpdates();

                LibLoader.SetupAssemblyFilenames(true);

                GameVersionEarly.Load();

                HarmonyProtector.Protect();

                pluginAsyncLoadTask = PluginLoader.LoadTask();
                permissionFixTask   = PermissionFix.FixPermissions(new DirectoryInfo(Environment.CurrentDirectory));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #2
0
        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.
            _ = args;
            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.ReadCommandLine(Environment.GetCommandLineArgs());
                SelfConfig.Load();
                DisabledConfig.Load();

                if (AntiPiracy.IsInvalid(Environment.CurrentDirectory))
                {
                    log.Error("Invalid installation; please buy the game to run BSIPA.");

                    return;
                }

                CriticalSection.Configure();

                injector.Debug("Prepping bootstrapper");

                // updates backup
                InstallBootstrapPatch();

                GameVersionEarly.Load();

                AntiMalwareEngine.Initialize();

                Updates.InstallPendingUpdates();

                LibLoader.SetupAssemblyFilenames(true);

                pluginAsyncLoadTask = PluginLoader.LoadTask();
                permissionFixTask   = PermissionFix.FixPermissions(new DirectoryInfo(Environment.CurrentDirectory));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }