Unofficial CardLife revival project, pronounced like "celery"
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.

57 lines
1.5KB

  1. using System.Diagnostics;
  2. using System.Linq;
  3. using System.Reflection;
  4. using HarmonyLib;
  5. namespace CLre.Fixes
  6. {
  7. public class StartupSpeedup
  8. {
  9. }
  10. [HarmonyPatch(typeof(FrontEnd.FrontEndContextRoot), "WaitForFrameworkInitialization")]
  11. //[HarmonyPatch]
  12. class Speedup_Benchmark3
  13. {
  14. internal static Stopwatch test = null;
  15. public static void Prefix()
  16. {
  17. test = Stopwatch.StartNew();
  18. }
  19. }
  20. [HarmonyPatch(typeof(FrontEnd.MainFrontEnd), "RequestPlayerId")]
  21. //[HarmonyPatch]
  22. class Speedup_Benchmark
  23. {
  24. internal static Stopwatch test = null;
  25. public static void Prefix()
  26. {
  27. test.Stop();
  28. long elapsed = test.ElapsedMilliseconds;
  29. API.Utility.Logging.Log($"OnContextInitialized completed in ~{elapsed}ms");
  30. }
  31. }
  32. [HarmonyPatch(typeof(FrontEnd.MainFrontEnd), "RegisterCustomHtmlElementTypes")]
  33. class Speedup_Benchmark2
  34. {
  35. public static void Prefix()
  36. {
  37. if (Speedup_Benchmark3.test != null)
  38. {
  39. Speedup_Benchmark3.test.Stop();
  40. long elapsed = Speedup_Benchmark3.test.ElapsedMilliseconds;
  41. API.App.Client.LogInitComplete += (_, __) =>
  42. {
  43. API.Utility.Logging.Log($"Scene loaded in ~{elapsed}ms");
  44. };
  45. }
  46. Speedup_Benchmark.test = Stopwatch.StartNew();
  47. }
  48. }
  49. }