예제 #1
0
        private void CalcRating()
        {
            string text = null, output;

            isCalculating = true;

            try
            {
#if DEBUG
                var sw = new Stopwatch();
                sw.Start();
#endif
                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    text = PathText.Text;
                }));

                var map          = new BeatmapInfo(text);
                var jack         = new PatternAnalyzer(map.Notes, map.LNs, map.Data.Keys, map.Data.Bpms, map.Data.SpecialStyle);
                var specialStyle = map.Data.SpecialStyle ||
                                   (map.Data.Keys == 8 && PatternAnalyzer.IsSpecialStyle(map.Notes, map.LNs));
                var maxBpm = Math.Round(map.Data.Bpms.Select(cur => cur.Item1).Max(), 2);
                var minBpm = Math.Round(map.Data.Bpms.Select(cur => cur.Item1).Min(), 2);

                output = map.Data.Artist + " - " + map.Data.Title + " [" + map.Data.Diff + "]\nMade by " + map.Data.Creator
                         + "\nBPM: " + (Math.Abs(maxBpm - minBpm) < 0.001 ? $"{maxBpm}" : $"{minBpm} - {maxBpm}\t")
                         + "\tOD: " + map.Data.Od + "\tHP: " + map.Data.Hp
                         + "\tKeys: " + (map.Data.Keys == 8 || specialStyle ? Convert.ToString(map.Data.Keys - 1) + "+1" : Convert.ToString(map.Data.Keys))
#if DEBUG
                         + "\nJack Score: " + Math.Round(RatingCalculator.CalcJackScore(jack), 2) + "    "
                         + "\tVibro Ratio: " + Math.Round(jack.GetVibroRatio() * 100, 2) + "%"
                         + "\tSpam Ratio: " + Math.Round(jack.GetSpamRatio() * 100, 2) + "%"
                         + "\nDensity Score: " + Math.Round(map.JenksDensity, 2)
                         + "\tSpeed Score: " + Math.Round(map.JenksSpeed, 2)
#endif
                         + "\nRating: " + Math.Round(RatingCalculator.CalcRating(map, jack), 2);
#if DEBUG
                sw.Stop();

                output += "\nElapsed Time: " + sw.ElapsedMilliseconds;
#endif
            }
            catch (Exception ex)
            {
                output = ex.Message;
            }

            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                StateBlock.Text = output;
            }));

            isCalculating = false;
        }
예제 #2
0
        private void CalcRating()
        {
            string text = null, output;

            isCalculating = true;

            try
            {
                var sw = new Stopwatch();
                sw.Start();

                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    text = PathText.Text;
                }));

                var map          = new BeatmapInfo(text);
                var jack         = new PatternAnalyzer(map.Notes, map.LNs, map.Data.Keys, map.Data.SpecialStyle);
                var specialStyle = map.Data.SpecialStyle ||
                                   (map.Data.Keys == 8 && (double)(jack.Notes[0].Count + jack.LNs[0].Count) / jack.Count < 0.06);

                output = map.Data.Artist + " - " + map.Data.Title + " [" + map.Data.Diff + "]\nMade by " + map.Data.Creator
                         + "\nBPM: " + (Math.Abs(map.Data.MaxBpm - map.Data.MinBpm) < 0.001
                                    ? Convert.ToString(map.Data.MaxBpm, CultureInfo.CurrentCulture)
                                    : map.Data.MinBpm + " - " + map.Data.MaxBpm + "\t")
                         + "\tOD: " + map.Data.Od + "\tHP: " + map.Data.Hp
                         + "\tKeys: " + (specialStyle ? Convert.ToString(map.Data.Keys - 1) + "+1" : Convert.ToString(map.Data.Keys))
                         + "\nMax Density: " + Math.Round(map.MaxDen, 2) + "\tAverage Density: " + Math.Round(map.AvgDen, 2)
                         + "\tJack Ratio: " + Math.Round(jack.GetJackRatio() * 100, 2) + "%"
#if DEBUG
                         + "\nSpam Ratio: " + Math.Round(jack.GetSpamRatio() * 100, 2) + "%"
                         + "\nCorrected Max Density: " + Math.Round(map.CorMaxDen, 2)
                         + "\tCorrected Average Density: " + Math.Round(map.CorAvgDen, 2)
#endif
                         + "\nRating: " + Math.Round(RatingCalculator.CalcRating(map), 2);

                sw.Stop();
#if DEBUG
                output += "\nElapsed Time: " + sw.ElapsedMilliseconds;
#endif
            }
            catch (Exception ex)
            {
                output = ex.Message;
            }

            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                StateBlock.Text = output;
            }));

            isCalculating = false;
        }