Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            #region oldmain

            Console.Clear();
            if (args.Length > 0)
            {
                const char GRAB_WINDOW_KEY = 'Q';
                const char PLAY_SONG_KEY   = 'W';
                const char DTIME_KEY       = 'E';
                const char RESET_KEY       = 'R';
                const char QUIT_KEY        = 'T';
                Console.WriteLine("Loading: " + args[0]);
                Console.WriteLine("Press: " + GRAB_WINDOW_KEY + " to set the osu window");
                Console.WriteLine("Press: " + PLAY_SONG_KEY + " to start the song after the first note");
                Console.WriteLine("Press: " + DTIME_KEY + " to toggle double time");
                Console.WriteLine("Press: " + RESET_KEY + " to reset");
                Console.WriteLine("Press: " + QUIT_KEY + " to force close the bot");

                bool allow_toggle = false;
                bool windowSet    = false;
                Controller.Win_Controller controller = new Controller.Win_Controller(null);
                bool doubleTime = false;
RESET_POINT:
                osu.SongData song = new osu.SongData();
                song.Parse(File.OpenRead(args[0]));

                Player osuPlayer = new Player(controller);


                osuPlayer.Reset();
                osuPlayer.SetSong(song);
                bool songPlayed = false;


                while (true)
                {
                    osuPlayer.DoubleTime = doubleTime;
                    WinAPI.POINT point = new WinAPI.POINT();
                    WinAPI.GetCursorPos(ref point);


                    if (!windowSet && WinAPI.GetAsyncKeyState(GRAB_WINDOW_KEY) != 0)
                    {
                        windowSet = true;
                        IntPtr handle = WinAPI.WindowFromPoint(point);
                        controller.WindowHandle = new Win32.Window(handle);
                        Console.WriteLine(controller.WindowHandle.Title());
                        Console.WriteLine("Window set");
                    }

                    if (WinAPI.GetAsyncKeyState(QUIT_KEY) != 0)
                    {
                        return;
                    }

                    if (WinAPI.GetAsyncKeyState(RESET_KEY) != 0 && osuPlayer.IsPlaying)
                    {
                        Console.WriteLine("Reset");
                        goto RESET_POINT;
                    }

                    if (WinAPI.GetAsyncKeyState(DTIME_KEY) != 0)
                    {
                        if (allow_toggle)
                        {
                            allow_toggle = false;
                            if (doubleTime)
                            {
                                doubleTime = false;
                                Console.WriteLine("Double time is OFF...");
                            }
                            else
                            {
                                doubleTime = true;
                                Console.WriteLine("Double time is ON...");
                            }
                        }
                    }
                    else
                    {
                        allow_toggle = true;
                    }

                    if (windowSet)
                    {
                        if (!songPlayed && WinAPI.GetAsyncKeyState(PLAY_SONG_KEY) != 0)
                        {
                            songPlayed = true;
                            osuPlayer.StartFirstNote();
                            Console.WriteLine("Song started");
                        }
                        osuPlayer.Update();
                    }


                    System.Threading.Thread.Sleep(2);
                }
            }
            else
            {
                Console.WriteLine("Please drag an osu file into the EXE to begin...");
            }

            #endregion
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            #region oldmain

            Console.Clear();
            if (args.Length > 0)
            {
                const char GRAB_WINDOW_KEY = 'Q';
                const char PLAY_SONG_KEY = 'W';
                const char DTIME_KEY = 'E';
                const char RESET_KEY = 'R';
                const char QUIT_KEY = 'T';
                Console.WriteLine("Loading: " + args[0]);
                Console.WriteLine("Press: " + GRAB_WINDOW_KEY + " to set the osu window");
                Console.WriteLine("Press: " + PLAY_SONG_KEY + " to start the song after the first note");
                Console.WriteLine("Press: " + DTIME_KEY + " to toggle double time");
                Console.WriteLine("Press: " + RESET_KEY + " to reset");
                Console.WriteLine("Press: " + QUIT_KEY + " to force close the bot");

                bool allow_toggle = false;
                bool windowSet = false;
                Controller.Win_Controller controller = new Controller.Win_Controller(null);
                bool doubleTime = false;
            RESET_POINT:
                osu.SongData song = new osu.SongData();
                song.Parse(File.OpenRead(args[0]));

                Player osuPlayer = new Player(controller);

                osuPlayer.Reset();
                osuPlayer.SetSong(song);
                bool songPlayed = false;

                while (true)
                {
                    osuPlayer.DoubleTime = doubleTime;
                    WinAPI.POINT point = new WinAPI.POINT();
                    WinAPI.GetCursorPos(ref point);

                    if (!windowSet && WinAPI.GetAsyncKeyState(GRAB_WINDOW_KEY) != 0)
                    {
                        windowSet = true;
                        IntPtr handle = WinAPI.WindowFromPoint(point);
                        controller.WindowHandle = new Win32.Window(handle);
                        Console.WriteLine(controller.WindowHandle.Title());
                        Console.WriteLine("Window set");
                    }

                    if (WinAPI.GetAsyncKeyState(QUIT_KEY) != 0)
                    {
                        return;
                    }

                    if (WinAPI.GetAsyncKeyState(RESET_KEY) != 0 && osuPlayer.IsPlaying)
                    {
                        Console.WriteLine("Reset");
                        goto RESET_POINT;
                    }

                    if (WinAPI.GetAsyncKeyState(DTIME_KEY) != 0)
                    {
                        if (allow_toggle)
                        {
                            allow_toggle = false;
                            if (doubleTime)
                            {
                                doubleTime = false;
                                Console.WriteLine("Double time is OFF...");
                            }
                            else
                            {
                                doubleTime = true;
                                Console.WriteLine("Double time is ON...");
                            }
                        }
                    }
                    else
                    {
                        allow_toggle = true;
                    }

                    if (windowSet)
                    {
                        if (!songPlayed && WinAPI.GetAsyncKeyState(PLAY_SONG_KEY) != 0)
                        {
                            songPlayed = true;
                            osuPlayer.StartFirstNote();
                            Console.WriteLine("Song started");
                        }
                        osuPlayer.Update();
                    }

                    System.Threading.Thread.Sleep(2);
                }
            }
            else
            {
                Console.WriteLine("Please drag an osu file into the EXE to begin...");

            }

            #endregion
        }