Advertisement
raxerz

Untitled

Jan 26th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1.  
  2. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  3. public delegate void ReadyCallback();
  4.  
  5. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  6. public delegate void DisconnectedCallback(int errorCode, string message);
  7.  
  8. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  9. public delegate void ErrorCallback(int errorCode, string message);
  10.  
  11. public struct EventHandlers
  12. {
  13. public ReadyCallback readyCallback;
  14. public DisconnectedCallback disconnectedCallback;
  15. public ErrorCallback errorCallback;
  16. }
  17.  
  18. // Values explanation and example: https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields
  19. [System.Serializable]
  20. public struct RichPresence
  21. {
  22. public string state; /* max 128 bytes */
  23. public string details; /* max 128 bytes */
  24. public long startTimestamp;
  25. public long endTimestamp;
  26. public string largeImageKey; /* max 32 bytes */
  27. public string largeImageText; /* max 128 bytes */
  28. public string smallImageKey; /* max 32 bytes */
  29. public string smallImageText; /* max 128 bytes */
  30. public string partyId; /* max 128 bytes */
  31. public int partySize;
  32. public int partyMax;
  33. public string matchSecret; /* max 128 bytes */
  34. public string joinSecret; /* max 128 bytes */
  35. public string spectateSecret; /* max 128 bytes */
  36. public bool instance;
  37. }
  38.  
  39. [DllImport("discord-rpc-w32.dll", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)]
  40. public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId);
  41.  
  42. [DllImport("discord-rpc-w32.dll", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)]
  43. public static extern void UpdatePresence(ref RichPresence presence);
  44.  
  45. [DllImport("discord-rpc-w32.dll", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)]
  46. public static extern void RunCallbacks();
  47.  
  48. [DllImport("discord-rpc-w32.dll", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)]
  49. public static extern void Shutdown();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement