Esempio n. 1
0
        public PPCalc(int maxCombo, int amount300, int amount100, int amountKatu, int amount50, int amountMiss, Modifiers mods, Beatmap map)
        {
            this.maxCombo = maxCombo;
            this.amount300 = amount300;
            this.amount100 = amount100;
            this.amountKatu = amountKatu;
            this.amount50 = amount50;
            this.amountMiss = amountMiss;
            this.mods = mods;
            this.map = map;

            this.difficulty = new DiffCalc(map);

            ComputeTotalValue();
        }
Esempio n. 2
0
        public void WriteDebug(DiffCalc[] songs)
        {
            if(printdebug)
            {
                Console.WriteLine("Writing Debug...");
                
                int donecount = 0;
                Console.Write("0%\r");
                Directory.CreateDirectory("debug");
                
                foreach(DiffCalc calc in songs)
                {
                    HitPoint[] notes = calc.GetNoteDifficulty();
                    List<HitPoint> sortednotes = new List<HitPoint>(notes);
                    
                    if(issortdifficulty)
                        sortednotes.Sort(HitPoint.CompareDifficulty);
                    else
                        sortednotes.Sort(HitPoint.CompareTime);
                    
                    //Make sure files don't have invalid characters in the name
                    string filepath = Dewlib.MakeValidFilename(calc.GetBeatmapTitle() + ".txt");
                    
                    filepath = "debug//" + filepath;
                    StreamWriter debugfile = new StreamWriter(filepath);

                    //Write the header
                    debugfile.WriteLine("[Difficulty]".PadRight(21) + "[Time]".PadRight(9) + "[Index]");
                    foreach(HitPoint notepoint in sortednotes)
                    {
                        string difficulty = notepoint.HitDifficulty.ToString();
                        string time = notepoint.HitTime.ToString();
                        debugfile.WriteLine(difficulty.PadRight(21) + time.PadRight(9) + notepoint.HitID);
                    }
                    
                    debugfile.Close();
                    donecount++;
                    Console.Write(Math.Round((double)donecount * 100 / songs.Length) + "%\r");
                }
            }
        }
Esempio n. 3
0
    public static void Main(string[] args)
    {
        Directory.SetCurrentDirectory(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
        
        DebugController debugger = new DebugController();
        
        //Load in custom beatmaps if specified
        args = debugger.LoadCustom(args);
        
        //Display a message if no files are specified
        if(args.Length == 0)
        {
            Console.WriteLine("CTB Difficulty Analyzer");
            Console.WriteLine("Just drag your beatmap (.osu file) onto this program to measure difficulty");
            Console.WriteLine("Press any key to exit...");
        }
        //Otherwise try to run the program, and catch and display any exceptions that arise
        else
        {
            Console.WriteLine("Calculating...");
            SortedList<double, string> beatmaps = new SortedList<double, string>();
            List<DiffCalc> calculators = new List<DiffCalc>();
            Stopwatch timer = new Stopwatch();
            try
            {
                int count = 0;
                foreach(string name in args)
                {
                    timer.Start();

                    Beatmap map = new Beatmap(name);
                    DiffCalc calc;
                    try
                    {
                        calc = new DiffCalc(map);
                    }
                    catch(InvalidBeatmapException)
                    {
                        //Skip this beatmap if it's not a standard or ctb map, but only if
                        //it was loaded through debug
                        if(debugger.IsLoadCustom())
                            continue;
                        else
                            throw;
                    }
                    
                    string title = calc.GetBeatmapTitle() + ": \t";
                    double difficulty = calc.GetDifficulty();

                    timer.Stop();
                    
                    title += timer.ElapsedMilliseconds;
                    beatmaps[difficulty] = title;
                    calculators.Add(calc);
                    
                    timer.Reset();
                    count++;
                    Console.Write(Math.Round((double)count * 100 / args.Length) + "%\r");
                }
                
                Console.WriteLine("\n");
                for(int i = beatmaps.Count - 1; i >= 0; i--)
                {
                    string[] titleandtime = beatmaps.Values[i].Split('\t');
                    Console.WriteLine(titleandtime[0] + beatmaps.Keys[i]);
                    Console.WriteLine("Calculation Time (ms): " + titleandtime[1] + "\n");
                }
                
                debugger.WriteDebug(calculators.ToArray());

                Console.WriteLine("\nDone.");
            }
            catch(Exception e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                //Just in case the timer is still running
                timer.Stop();
            }
        }

        Console.ReadKey();
    }