Esempio n. 1
0
        private void OnOSUStatusChange(StatusChangeEvent @event)
        {
            osuStat = @event.CurrentStatus;
#if (DEBUG)
            Sync.Tools.IO.CurrentIO.WriteColor(osuStat.Status + " " + osuStat.Artist + " - " + osuStat.Title, ConsoleColor.DarkCyan);
#endif
        }
Esempio n. 2
0
        private void OnOsuStatusAdvanceChange(StatusChangeEvent stat)
        {
            if (!TryGetOsuSongFolder())
            {
                return;
            }

            var currentOsuStat = stat.CurrentStatus;

            sw.Reset();
            sw.Start();

            string osu_file_path = string.Empty;

            if (!(/*osuStat.status != "Playing"*/ string.IsNullOrWhiteSpace(currentOsuStat.Diff)))
            {
                osu_file_path = GetOsuFilePath(currentOsuStat.Diff, currentOsuStat.Artist, currentOsuStat.Title);
            }

            BeatmapEntry temp_beatmap = null;

            if (!string.IsNullOrWhiteSpace(osu_file_path))
            {
                try
                {
                    temp_beatmap = OsuFileParser.ParseText(File.ReadAllText(osu_file_path));

                    //Set path as extra data
                    temp_beatmap.OsuFilePath = osu_file_path;
                }
                catch
                {
                    temp_beatmap = null;
                }
            }
            else
            {
                temp_beatmap = null;
            }

            lock (locker)
            {
                if (temp_beatmap?.OsuFilePath != CurrentPlayingBeatmap?.OsuFilePath)
                {
                    NowPlayingEvents.Instance.RaiseEvent(new CurrentPlayingBeatmapChangedEvent(temp_beatmap));

                    if (temp_beatmap != null)
                    {
                        IO.CurrentIO.WriteColor(string.Format(Languages.CONSOLE_OUTPUT_RESULT, osu_file_path, sw.ElapsedMilliseconds, temp_beatmap.DiffHP, temp_beatmap.DiffCS, temp_beatmap.DiffAR, temp_beatmap.DiffOD), ConsoleColor.Green);
                    }

                    CurrentPlayingBeatmap = temp_beatmap;
                }
            }

            sw.Stop();

            return;
        }