private void RtppOnStatusChanged(OsuStatus last, OsuStatus cur)
        {
            _status = cur;
            if ((cur == OsuStatus.Rank && last == OsuStatus.Playing))
            {
                var cal = _tmpLastPpCalculator ?? _ppCalculator;

                var    beatmap = cal.Beatmap.OrtdpBeatmap;
                var    mods    = cal.Mods;
                string songs   = $"{beatmap.Artist} - {beatmap.Title}[{beatmap.Difficulty}]";
                string acc     = $"{cal.Accuracy:F2}%";
                string modsStr = $"{(mods != ModsInfo.Mods.None ? "+" + mods.ShortName : "")}";
                string pp      = $"{cal.GetPerformance().RealTimePP:F2}pp";
                string msg     = $"[RTPPD]{songs} {modsStr} | {acc} => {pp}";

                CurrentIO.Write($"[RTPPD]{songs}{acc}{modsStr} -> {pp}");
                if (SyncHost.Instance.ClientWrapper.Client.CurrentStatus == SourceStatus.CONNECTED_WORKING &&
                    Setting.RankingSendPerformanceToChat)
                {
                    if (beatmap.BeatmapID != 0)
                    {
                        string dlUrl = beatmap.DownloadLink;
                        SyncHost.Instance.ClientWrapper.Client.SendMessage(new IRCMessage(SyncHost.Instance.ClientWrapper.Client.NickName, $"[RTPPD][{dlUrl} {songs}] {modsStr} | {acc} => {pp}"));
                    }
                    else
                    {
                        SyncHost.Instance.ClientWrapper.Client.SendMessage(new IRCMessage(SyncHost.Instance.ClientWrapper.Client.NickName, msg));
                    }
                }
            }

            if (cur != OsuStatus.Rank)
            {
                _tmpLastPpCalculator = null;
            }

            if (OsuStatusHelper.IsListening(cur) || cur == OsuStatus.Editing)//Clear Output and reset
            {
                _combo    = 0;
                _maxCombo = 0;
                _n100     = 0;
                _n50      = 0;
                _nmiss    = 0;
                foreach (var p in _displayers)
                {
                    p.Value.Clear();
                }
            }

            _ppCalculator.ClearCache();
        }
        public override void OnStatusChange(OsuStatus last_status, OsuStatus status)
        {
            current_status = status;

            if (last_status == status)
            {
                return;
            }
            if ((status != OsuStatus.Playing) && (status != OsuStatus.Rank))
            {
                if (OsuStatusHelper.IsListening(status))
                {
                    TrigListen();
                }
                else
                {
                    RefPanelPlugin.OnBeatmapChanged(null);
                }
            }
            else
            {
                if (current_mod.Mod != ModsInfo.Mods.Unknown || current_mod.Mod != ModsInfo.Mods.None)
                {
                    //fix for https://puu.sh/zelua/d60b98d496.jpg
                    return;
                }

                BeatmapEntry beatmap = new BeatmapEntry()
                {
                    OutputType   = CurrentOutputType = OutputType.Listen,
                    BeatmapId    = beatmapID,
                    BeatmapSetId = beatmapSetID,
                    OsuFilePath  = OsuFilePath,
                    ExtraParam   = new System.Collections.Generic.Dictionary <string, object> {
                        { "ortdp_beatmap", current_beatmap },
                        { "mode", RefPlugin.ListenerManager.GetCurrentData(OsuRTDataProvider.Listen.ProvideDataMask.GameMode).PlayMode }
                    }
                };

                RefPanelPlugin.OnBeatmapChanged(new BeatmapChangedParameter()
                {
                    beatmap = beatmap
                });
            }
        }
        public void OnCurrentBeatmapChange(Beatmap beatmap)
        {
            if (beatmap == Beatmap.Empty || string.IsNullOrWhiteSpace(beatmap?.FilenameFull))
            {
                //fix empty beatmap
                return;
            }

            beatmapID       = beatmap.BeatmapID;
            beatmapSetID    = beatmap.BeatmapSetID;
            OsuFilePath     = beatmap.FilenameFull;
            current_beatmap = beatmap;

            if (OsuStatusHelper.IsListening(current_status))
            {
                TrigListen();
            }
        }
        private void RtppOnStatusChanged(OsuStatus last, OsuStatus cur)
        {
            if (cur == OsuStatus.Playing)
            {
                _playStatusLocker.WaitOne();
            }

            if (OsuStatusHelper.IsListening(cur) ||
                cur == OsuStatus.NoFoundProcess)
            {
                try
                {
                    _playStatusLocker.ReleaseMutex();
                }
                catch (ApplicationException)
                {}
            }

            var cal = GetCalculator(_mode);

            if ((cur == OsuStatus.Rank && last == OsuStatus.Playing))
            {
                var    beatmap = cal.Beatmap.OrtdpBeatmap;
                var    mods    = cal.Mods;
                string songs   = $"{beatmap.Artist} - {beatmap.Title}[{beatmap.Difficulty}]";
                if (Setting.UseUnicodePerformanceInformation)
                {
                    if (!string.IsNullOrEmpty(beatmap.ArtistUnicode) && !string.IsNullOrEmpty(beatmap.TitleUnicode))
                    {
                        songs = $"{beatmap.ArtistUnicode} - {beatmap.TitleUnicode}[{beatmap.Difficulty}]";
                    }
                }
                string acc = $"{cal.Accuracy:F2}%";

                ModsInfo m       = mods.ToModsInfo();
                string   modsStr = $"{(m != ModsInfo.Mods.None ? "+" + m.ShortName : "")}";
                string   pp      = $"{cal.GetPerformance().RealTimePP:F2}pp";
                string   msg     = $"[RTPPD]{songs} {modsStr} | {acc} => {pp} ({_mode})";

                CurrentIO.Write(msg);
                if (SyncHost.Instance.ClientWrapper.Client.CurrentStatus == SourceStatus.CONNECTED_WORKING &&
                    Setting.RankingSendPerformanceToChat)
                {
                    if (beatmap.BeatmapID != 0)
                    {
                        string dlUrl = beatmap.DownloadLink;
                        SyncHost.Instance.ClientWrapper.Client.SendMessage(new IRCMessage(SyncHost.Instance.ClientWrapper.Client.NickName, $"[RTPPD][{dlUrl} {songs}] {modsStr} | {acc} => {pp} ({_mode})"));
                    }
                    else
                    {
                        SyncHost.Instance.ClientWrapper.Client.SendMessage(new IRCMessage(SyncHost.Instance.ClientWrapper.Client.NickName, msg));
                    }
                }
            }

            cal.ClearCache();

            if (OsuStatusHelper.IsListening(cur) || cur == OsuStatus.Editing)//Clear output and reset
            {
                _combo    = 0;
                _maxCombo = 0;
                _n100     = 0;
                _n50      = 0;
                _nmiss    = 0;
                foreach (var p in Displayers)
                {
                    p.Value?.Clear();
                }
            }

            _status = cur;
        }