BasicLogInfo.cs 762 B

1234567891011121314151617181920212223242526
  1. using System.Diagnostics;
  2. using BepInEx.Logging;
  3. namespace BepInEx.Preloader.Core.Logging
  4. {
  5. public static class BasicLogInfo
  6. {
  7. public static void PrintLogInfo(ManualLogSource log)
  8. {
  9. string consoleTile = $"BepInEx {typeof(Paths).Assembly.GetName().Version} - {Process.GetCurrentProcess().ProcessName}";
  10. log.LogMessage(consoleTile);
  11. if (ConsoleManager.ConsoleActive)
  12. ConsoleManager.SetConsoleTitle(consoleTile);
  13. //See BuildInfoAttribute for more information about this section.
  14. object[] attributes = typeof(BuildInfoAttribute).Assembly.GetCustomAttributes(typeof(BuildInfoAttribute), false);
  15. if (attributes.Length > 0)
  16. {
  17. var attribute = (BuildInfoAttribute)attributes[0];
  18. log.LogMessage(attribute.Info);
  19. }
  20. }
  21. }
  22. }