isteamapplist.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // This file is provided under The MIT License as part of Steamworks.NET.
  2. // Copyright (c) 2013-2019 Riley Labrecque
  3. // Please see the included LICENSE.txt for additional information.
  4. // This file is automatically generated.
  5. // Changes to this file will be reverted when you update Steamworks.NET
  6. #if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH
  7. #define DISABLESTEAMWORKS
  8. #endif
  9. #if !DISABLESTEAMWORKS
  10. using System.Runtime.InteropServices;
  11. using IntPtr = System.IntPtr;
  12. namespace Steamworks {
  13. public static class SteamAppList {
  14. public static uint GetNumInstalledApps() {
  15. InteropHelp.TestIfAvailableClient();
  16. return NativeMethods.ISteamAppList_GetNumInstalledApps(CSteamAPIContext.GetSteamAppList());
  17. }
  18. public static uint GetInstalledApps(AppId_t[] pvecAppID, uint unMaxAppIDs) {
  19. InteropHelp.TestIfAvailableClient();
  20. return NativeMethods.ISteamAppList_GetInstalledApps(CSteamAPIContext.GetSteamAppList(), pvecAppID, unMaxAppIDs);
  21. }
  22. /// <summary>
  23. /// <para> returns -1 if no name was found</para>
  24. /// </summary>
  25. public static int GetAppName(AppId_t nAppID, out string pchName, int cchNameMax) {
  26. InteropHelp.TestIfAvailableClient();
  27. IntPtr pchName2 = Marshal.AllocHGlobal(cchNameMax);
  28. int ret = NativeMethods.ISteamAppList_GetAppName(CSteamAPIContext.GetSteamAppList(), nAppID, pchName2, cchNameMax);
  29. pchName = ret != -1 ? InteropHelp.PtrToStringUTF8(pchName2) : null;
  30. Marshal.FreeHGlobal(pchName2);
  31. return ret;
  32. }
  33. /// <summary>
  34. /// <para> returns -1 if no dir was found</para>
  35. /// </summary>
  36. public static int GetAppInstallDir(AppId_t nAppID, out string pchDirectory, int cchNameMax) {
  37. InteropHelp.TestIfAvailableClient();
  38. IntPtr pchDirectory2 = Marshal.AllocHGlobal(cchNameMax);
  39. int ret = NativeMethods.ISteamAppList_GetAppInstallDir(CSteamAPIContext.GetSteamAppList(), nAppID, pchDirectory2, cchNameMax);
  40. pchDirectory = ret != -1 ? InteropHelp.PtrToStringUTF8(pchDirectory2) : null;
  41. Marshal.FreeHGlobal(pchDirectory2);
  42. return ret;
  43. }
  44. /// <summary>
  45. /// <para> return the buildid of this app, may change at any time based on backend updates to the game</para>
  46. /// </summary>
  47. public static int GetAppBuildId(AppId_t nAppID) {
  48. InteropHelp.TestIfAvailableClient();
  49. return NativeMethods.ISteamAppList_GetAppBuildId(CSteamAPIContext.GetSteamAppList(), nAppID);
  50. }
  51. }
  52. }
  53. #endif // !DISABLESTEAMWORKS