You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0 KiB

  1. using IllusionInjector.Logging;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using UnityEngine;
  7. namespace IllusionInjector
  8. {
  9. class Bootstrapper : MonoBehaviour
  10. {
  11. public event Action Destroyed = delegate {};
  12. void Awake()
  13. {
  14. //if (Environment.CommandLine.Contains("--verbose"))
  15. //{
  16. Windows.GuiConsole.CreateConsole();
  17. //}
  18. Application.logMessageReceived += delegate (string condition, string stackTrace, LogType type)
  19. {
  20. var level = UnityLogInterceptor.LogTypeToLevel(type);
  21. UnityLogInterceptor.Unitylogger.Log(level, $"{condition.Trim()}");
  22. UnityLogInterceptor.Unitylogger.Log(level, $"{stackTrace.Trim()}");
  23. };
  24. }
  25. void Start()
  26. {
  27. Destroy(gameObject);
  28. }
  29. void OnDestroy()
  30. {
  31. Destroyed();
  32. }
  33. }
  34. }