public KeyPlayer(Stopwatch stopwatch, LevelProfile levelProfile) { _stopwatch = stopwatch; _keyboard = new InputSimulator().Keyboard; _mouse = new InputSimulator().Mouse; _levelProfile = levelProfile; }
public GlobalController(LevelProfile levelProfile) { _globalHook = Hook.GlobalEvents(); Log.Information($"Using high-resolution stopwatch: {Stopwatch.IsHighResolution}."); _stopwatch = new Stopwatch(); _levelProfile = levelProfile; _keyPlayer = new KeyPlayer(_stopwatch, levelProfile); _keyRecorder = new KeyRecorder(_stopwatch, _levelProfile, _globalHook); }
static void Main(string[] args) { if (!args.Any()) { Console.Error.WriteLine("The program takes an argument of the level to run."); } var isSuccess = uint.TryParse(args[0], out var level); if (!isSuccess || level <= 0) { Console.Error.WriteLine("Invalid level."); } ConfigureLogger(); var levelProfile = new LevelProfile(level); var globalController = new GlobalController(levelProfile); globalController.SubscribeHandlers(); Application.Run(new ApplicationContext()); // Need this to keep the program running as well as make the global key hook work. }