private void UpdateDiscordPresence(MiSTerPresenceData data)
 {
     try {
         if (data.Rom != LastRom || data.Core != LastCore)
         {
             Console.WriteLine($"Sending new presence: Playing {data.Rom} on {data.Core}");
             GetDiscordClient().SetPresence(data.GetPresence());
             LastRom  = data.Rom;
             LastCore = data.Core;
         }
     } catch (Exception e) {
         Console.WriteLine($"Failed to set presence\nError: {e.Message}");
         return;
     }
 }
Exemplo n.º 2
0
        public MiSTerPresenceData GetMiSTerPresenceData()
        {
            var data      = new MiSTerPresenceData();
            var processes = GetCoreProcesses();

            if (string.IsNullOrEmpty(processes))
            {
                return(null);
            }
            data.Core = GetCoreName(processes);
            if (data.Core != "menu")
            {
                data.Rom = GetLatestRomName(processes);
            }
            else
            {
                data.Rom = string.Empty;
            }
            return(data);
        }