Imperious123

Untitled

Jul 18th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. using System;
  2. using System.Runtime.InteropServices;
  3.  
  4. namespace DiscordRpcDemo
  5. {
  6. public class DiscordRpc
  7. {
  8. public DiscordRpc()
  9. {
  10. }
  11.  
  12. [DllImport("discord-rpc-w32.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.None, EntryPoint="Discord_Initialize", ExactSpelling=false)]
  13. public static extern void Initialize(string applicationId, ref DiscordRpc.EventHandlers handlers, bool autoRegister, string optionalSteamId);
  14.  
  15. [DllImport("discord-rpc-w32.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.None, EntryPoint="Discord_RunCallbacks", ExactSpelling=false)]
  16. public static extern void RunCallbacks();
  17.  
  18. [DllImport("discord-rpc-w32.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.None, EntryPoint="Discord_Shutdown", ExactSpelling=false)]
  19. public static extern void Shutdown();
  20.  
  21. [DllImport("discord-rpc-w32.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.None, EntryPoint="Discord_UpdatePresence", ExactSpelling=false)]
  22. public static extern void UpdatePresence(ref DiscordRpc.RichPresence presence);
  23.  
  24. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  25. public delegate void DisconnectedCallback(int errorCode, string message);
  26.  
  27. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  28. public delegate void ErrorCallback(int errorCode, string message);
  29.  
  30. public struct EventHandlers
  31. {
  32. public DiscordRpc.ReadyCallback readyCallback;
  33.  
  34. public DiscordRpc.DisconnectedCallback disconnectedCallback;
  35.  
  36. public DiscordRpc.ErrorCallback errorCallback;
  37. }
  38.  
  39. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  40. public delegate void ReadyCallback();
  41.  
  42. [Serializable]
  43. public struct RichPresence
  44. {
  45.  
  46. public string state;
  47.  
  48. public string details;
  49.  
  50. public long startTimestamp;
  51.  
  52. public long endTimestamp;
  53.  
  54. public string largeImageKey;
  55.  
  56. public string largeImageText;
  57.  
  58. public string smallImageKey;
  59.  
  60. public string smallImageText;
  61.  
  62. public string partyId;
  63.  
  64. public int partySize;
  65.  
  66. public int partyMax;
  67.  
  68. public string matchSecret;
  69.  
  70. public string joinSecret;
  71.  
  72. public string spectateSecret;
  73.  
  74. public bool instance;
  75.  
  76. }
  77. }
  78. }
Add Comment
Please, Sign In to add comment