示例#1
0
        public MissWindow(MissWindowController controller)
        {
            Text = "Miss Analyzer";
            Size = new Size(size, size + SystemInformation.CaptionHeight);
            Area = base.ClientRectangle;
            gOut = Graphics.FromHwnd(Handle);

            FormBorderStyle = FormBorderStyle.FixedSingle;
            Controller      = controller;
            Controller.View = this;
            Controller.UpdateView();
        }
示例#2
0
        public static void Main(string[] args)
        {
            MissAnalyzer         missAnalyzer;
            MissWindowController controller;
            MissWindow           window;

            Debug.Print("Starting MissAnalyser... ");
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            string        replay = null, beatmap = null;
            List <string> extras;
            Dictionary <string, string> optList = new Dictionary <string, string>();
            bool   help        = false;
            int    getMiss     = -1;
            string optionsFile = "options.cfg";

            var opts = new OptionSet()
            {
                { "o|osudir=", "Set osu! directory", o => optList["osudir"] = o },
                { "c|config=", "Set options.cfg", f => optionsFile = f },
                { "s|songsdir=", "Set songs directory", s => optList["songsdir"] = s },
                { "d|daemon", "Run without dialogs", d => headless = d != null },
                { "h|help", "Displays help", h => help = h != null },
                { "m|miss=", "Export miss #", (int m) => getMiss = m }
            };

            extras = opts.Parse(args);
            foreach (var arg in extras)
            {
                if (arg.EndsWith(".osu") && File.Exists(arg))
                {
                    beatmap = arg;
                }
                if (arg.EndsWith(".osr") && File.Exists(arg))
                {
                    replay = arg;
                }
            }
            if (!File.Exists(optionsFile))
            {
                File.Create(optionsFile).Close();
                Debug.Print("\nCreating options.cfg... ");
                Debug.Print("- In options.cfg, you can define various settings that impact the program. ");
                Debug.Print("- To add these to options.cfg, add a new line formatted <Setting Name>=<Value> ");
                Debug.Print("- Available settings : SongsDir | Value = Specify osu!'s songs dir.");
                Debug.Print("-                       APIKey  | Value = Your osu! API key (https://osu.ppy.sh/api/");
                Debug.Print("-                       OsuDir  | Value = Your osu! directory");
            }
            if (help)
            {
                Console.WriteLine("osu! Miss Analyzer");
                opts.WriteOptionDescriptions(Console.Out);
                return;
            }

            try
            {
                Options        options      = new Options("options.cfg", optList);
                UIReplayLoader replayLoader = new UIReplayLoader(options);
                if (!replayLoader.Load(replay, beatmap))
                {
                    return;
                }
                if (replayLoader.Replay == null || replayLoader.Beatmap == null)
                {
                    ShowErrorDialog("Couldn't find " + (replayLoader.Replay == null ? "replay" : "beatmap"));
                    return;
                }

                missAnalyzer = new MissAnalyzer(replayLoader);
                controller   = new MissWindowController(missAnalyzer, replayLoader);
                window       = new MissWindow(controller);
                Application.Run(window);
            } catch (Exception e)
            {
                ShowErrorDialog(e.Message);
                File.WriteAllText("exception.log", e.ToString());
            }
        }