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.

32 lines
1.3 KiB

6 years ago
6 years ago
6 years ago
6 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace IPA.Utilities
  7. {
  8. /// <summary>
  9. /// Provides a utility to test if this is a Steam build of Beat Saber.
  10. /// </summary>
  11. public static class SteamCheck
  12. {
  13. private static Type SteamVRCamera;
  14. private static Type SteamVRExternalCamera;
  15. private static Type SteamVRFade;
  16. /// <summary>
  17. /// Returns <see langword="true"/> when called on a Steam installation.
  18. /// </summary>
  19. public static bool IsAvailable => FindSteamVRAsset();
  20. private static bool FindSteamVRAsset()
  21. {
  22. // these require assembly qualified names....
  23. SteamVRCamera = Type.GetType("SteamVR_Camera, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false);
  24. SteamVRExternalCamera = Type.GetType("SteamVR_ExternalCamera, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false);
  25. SteamVRFade = Type.GetType("SteamVR_Fade, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false);
  26. return SteamVRCamera != null && SteamVRExternalCamera != null && SteamVRFade != null;
  27. }
  28. }
  29. }