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.

33 lines
1.4 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. [Obsolete("Use BeatSaber.ReleaseType == BeatSaber.Release.Steam")]
  12. internal static class SteamCheck
  13. {
  14. private static Type SteamVRCamera;
  15. private static Type SteamVRExternalCamera;
  16. private static Type SteamVRFade;
  17. /// <summary>
  18. /// Returns <see langword="true"/> when called on a Steam installation.
  19. /// </summary>
  20. public static bool IsAvailable => FindSteamVRAsset();
  21. private static bool FindSteamVRAsset()
  22. {
  23. // these require assembly qualified names....
  24. SteamVRCamera = Type.GetType("SteamVR_Camera, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false);
  25. SteamVRExternalCamera = Type.GetType("SteamVR_ExternalCamera, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false);
  26. SteamVRFade = Type.GetType("SteamVR_Fade, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false);
  27. return SteamVRCamera != null && SteamVRExternalCamera != null && SteamVRFade != null;
  28. }
  29. }
  30. }