Example #1
0
        /// <summary>
        /// Discord Rich Presenceの更新をします。
        /// </summary>
        /// <param name="details">現在の説明。</param>
        /// <param name="state">現在の状態。</param>
        /// <param name="startTimeStamp">開始時間(Unix時間)</param>
        /// <param name="endTimeStamp">終了時間(Unix時間)</param>
        /// <param name="smallImageKey">小さなアイコン用キー。</param>
        /// <param name="smallImageText">小さなアイコンのツールチップに表示するテキスト。</param>
        public static void UpdatePresence(string details, string state, long startTimeStamp = 0, long endTimeStamp = 0, string smallImageKey = null, string smallImageText = null)
        {
            var presence = new DiscordRpc.RichPresence();

            presence.details = StrToPtr(details);
            presence.state   = StrToPtr(state);

            if (startTimeStamp != 0)
            {
                presence.startTimestamp = startTimeStamp;
            }
            if (endTimeStamp != 0)
            {
                presence.endTimestamp = endTimeStamp;
            }
            presence.largeImageKey  = StrToPtr("tjaplayer3-f");
            presence.largeImageText = StrToPtr("Ver." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            if (!string.IsNullOrEmpty(smallImageKey))
            {
                presence.smallImageKey = StrToPtr(smallImageKey);
            }
            if (!string.IsNullOrEmpty(smallImageText))
            {
                presence.smallImageText = StrToPtr(smallImageText);
            }

            DiscordRpc.UpdatePresence(ref presence);
            FreeMem();
        }
Example #2
0
        /// <summary>
        /// Discord Rich Presenceの更新をします。
        /// </summary>
        /// <param name="details">現在の説明。</param>
        /// <param name="state">現在の状態。</param>
        /// <param name="startTimeStamp">開始時間(Unix時間)</param>
        /// <param name="endTimeStamp">終了時間(Unix時間)</param>
        /// <param name="smallImageKey">小さなアイコン用キー。</param>
        /// <param name="smallImageText">小さなアイコンのツールチップに表示するテキスト。</param>
        public static void UpdatePresence(string details, string state, long startTimeStamp = 0, long endTimeStamp = 0, string smallImageKey = null, string smallImageText = null)
        {
            var presence = new DiscordRpc.RichPresence();

            presence.details = StrToPtr(details);
            presence.state   = StrToPtr(state);

            if (startTimeStamp != 0)
            {
                presence.startTimestamp = startTimeStamp;
            }
            if (endTimeStamp != 0)
            {
                presence.endTimestamp = endTimeStamp;
            }
            presence.largeImageKey  = StrToPtr(TJAPlayer3.AppDisplayName.ToLowerInvariant());
            presence.largeImageText = StrToPtr(TJAPlayer3.AppDisplayThreePartVersion);
            if (!string.IsNullOrEmpty(smallImageKey))
            {
                presence.smallImageKey = StrToPtr(smallImageKey);
            }
            if (!string.IsNullOrEmpty(smallImageText))
            {
                presence.smallImageText = StrToPtr(smallImageText);
            }

            DiscordRpc.UpdatePresence(ref presence);
            FreeMem();
        }
Example #3
0
        /// <summary>
        /// Discord Rich Presenceの更新をします。
        /// </summary>
        /// <param name="details">現在の説明。</param>
        /// <param name="state">現在の状態。</param>
        /// <param name="startTimeStamp">開始時間(Unix時間)</param>
        /// <param name="endTimeStamp">終了時間(Unix時間)</param>
        /// <param name="smallImageKey">小さなアイコン用キー。</param>
        /// <param name="smallImageText">小さなアイコンのツールチップに表示するテキスト。</param>
        public static void UpdatePresence(string details, string state, long startTimeStamp = 0, long endTimeStamp = 0, string smallImageKey = null, string smallImageText = null)
        {
            var presence = new DiscordRpc.RichPresence();

            presence.details = StrToPtr(details);
            presence.state   = StrToPtr(state);

            if (startTimeStamp != 0)
            {
                presence.startTimestamp = startTimeStamp;
            }
            if (endTimeStamp != 0)
            {
                presence.endTimestamp = endTimeStamp;
            }
            presence.largeImageKey  = StrToPtr("tjaplayer3");
            presence.largeImageText = StrToPtr("Ver." + TJAPlayer3.VERSION);
            if (!string.IsNullOrEmpty(smallImageKey))
            {
                presence.smallImageKey = StrToPtr(smallImageKey);
            }
            if (!string.IsNullOrEmpty(smallImageText))
            {
                presence.smallImageText = StrToPtr(smallImageText);
            }

            DiscordRpc.UpdatePresence(ref presence);
            FreeMem();
        }