コード例 #1
0
        // ReSharper disable once UnusedParameter.Global
        public 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("--no-console"))
                {
                    WinConsole.Initialize();
                }

                SetupLibraryLoading();

                loader.Debug("Prepping bootstrapper");

                InstallBootstrapPatch();

                Updates.InstallPendingUpdates();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #2
0
 public static void Inject()
 {
     if (!_injected)
     {
         _injected = true;
         WinConsole.Initialize();
         SetupLibraryLoading();
         var bootstrapper = new GameObject("Bootstrapper").AddComponent <Bootstrapper>();
         bootstrapper.Destroyed += Bootstrapper_Destroyed;
     }
 }
コード例 #3
0
        // 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);
            }
        }
コード例 #4
0
        private static void CreateBootstrapper()
        {
            if (bootstrapped)
            {
                return;
            }
            bootstrapped = true;

            Application.logMessageReceived += delegate(string condition, string stackTrace, LogType type)
            {
                var level = UnityLogRedirector.LogTypeToLevel(type);
                UnityLogProvider.UnityLogger.Log(level, $"{condition.Trim()}");
                UnityLogProvider.UnityLogger.Log(level, $"{stackTrace.Trim()}");
            };

            // need to reinit streams singe Unity seems to redirect stdout
            WinConsole.InitializeStreams();

            var bootstrapper = new GameObject("NonDestructiveBootstrapper").AddComponent <Bootstrapper>();

            bootstrapper.Destroyed += Bootstrapper_Destroyed;
        }
コード例 #5
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();

                /* 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);
            }
        }