private static void Main(string[] args) { if (args.Length == 0) { var location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (string.IsNullOrEmpty(location)) { return; } var uiPath = Path.Combine(location, "captura.exe"); if (File.Exists(uiPath)) { Process.Start(uiPath); return; } } User32.SetProcessDPIAware(); ServiceProvider.LoadModule(new CoreModule()); ServiceProvider.LoadModule(new FakesModule()); Parser.Default.ParseArguments <StartCmdOptions, ShotCmdOptions, FFmpegCmdOptions, ListCmdOptions>(args) .WithParsed((ListCmdOptions options) => { Banner(); var lister = ServiceProvider.Get <ConsoleLister>(); lister.List(); }) .WithParsed((StartCmdOptions options) => { Banner(); using (var manager = ServiceProvider.Get <ConsoleManager>()) { manager.CopySettings(); manager.Start(options); } }) .WithParsed((ShotCmdOptions options) => { Banner(); using (var manager = ServiceProvider.Get <ConsoleManager>()) { manager.Shot(options); } }) .WithParsed((FFmpegCmdOptions options) => { Banner(); FFmpeg(options); }); }
static void Main(string[] Args) { if (Args.Length == 0) { var uiPath = Path.Combine(ServiceProvider.AppDir, "captura.exe"); if (File.Exists(uiPath)) { Process.Start(uiPath); return; } } User32.SetProcessDPIAware(); ServiceProvider.LoadModule(new CoreModule()); ServiceProvider.LoadModule(new FakesModule()); Parser.Default.ParseArguments <StartCmdOptions, ShotCmdOptions, FFmpegCmdOptions, ListCmdOptions>(Args) .WithParsed((ListCmdOptions Options) => { Banner(); var lister = ServiceProvider.Get <ConsoleLister>(); lister.List(); }) .WithParsed((StartCmdOptions Options) => { Banner(); using (var manager = ServiceProvider.Get <ConsoleManager>()) { manager.CopySettings(); manager.Start(Options); } }) .WithParsed((ShotCmdOptions Options) => { Banner(); using (var manager = ServiceProvider.Get <ConsoleManager>()) { manager.Shot(Options); } }) .WithParsed((FFmpegCmdOptions Options) => { Banner(); var ffmpegManager = ServiceProvider.Get <FFmpegConsoleManager>(); // Need to Wait instead of await otherwise the process will exit ffmpegManager.Run(Options).Wait(); }); }
static void Main(string[] Args) { if (Args.Length == 0) { var uiPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "captura.exe"); if (File.Exists(uiPath)) { Process.Start(uiPath); return; } } User32.SetProcessDPIAware(); ServiceProvider.LoadModule(new CoreModule()); ServiceProvider.LoadModule(new FakesModule()); // Hide on Full Screen Screenshot doesn't work on Console ServiceProvider.Get <Settings>().UI.HideOnFullScreenShot = false; Parser.Default.ParseArguments <StartCmdOptions, ShotCmdOptions, FFmpegCmdOptions, ListCmdOptions>(Args) .WithParsed((Action <ListCmdOptions>)(Options => List())) .WithParsed((Action <StartCmdOptions>)(Options => { Banner(); using (var vm = ServiceProvider.Get <MainViewModel>()) { vm.Init(false, false, false, false); CopySettings(vm.Settings); Start(vm, Options); } })) .WithParsed((Action <ShotCmdOptions>)(Options => { Banner(); using (var vm = ServiceProvider.Get <MainViewModel>()) { vm.Init(false, false, false, false); Shot(vm, Options); } })) .WithParsed((Action <FFmpegCmdOptions>)(Options => { Banner(); FFmpeg(Options); })); }
static void Main(string[] Args) { User32.SetProcessDPIAware(); ServiceProvider.LoadModule(new CoreModule()); ServiceProvider.LoadModule(new FakesModule()); ServiceProvider.LoadModule(new VerbsModule()); var verbTypes = ServiceProvider .Get <IEnumerable <ICmdlineVerb> >() .Select(M => M.GetType()) .ToArray(); Parser.Default.ParseArguments(Args, verbTypes) .WithParsed((ICmdlineVerb Verb) => { // Always display Banner Banner(); Verb.Run(); }); }
static void Main(string[] Args) { if (Args.Length == 0) { var uiPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "captura.exe"); if (File.Exists(uiPath)) { Process.Start(uiPath); return; } } User32.SetProcessDPIAware(); ServiceProvider.LoadModule(new CoreModule()); ServiceProvider.LoadModule(new FakesModule()); // Hide on Full Screen Screenshot doesn't work on Console ServiceProvider.Get <Settings>().UI.HideOnFullScreenShot = false; Parser.Default.ParseArguments <StartCmdOptions, ShotCmdOptions, FFmpegCmdOptions, ListCmdOptions>(Args) .WithParsed <ListCmdOptions>(Options => List()) .WithParsed <StartCmdOptions>(Options => { Banner(); using (var vm = ServiceProvider.Get <MainViewModel>()) { vm.Init(false, false, false, false); // Load settings dummy var dummySettings = new Settings(); dummySettings.Load(); vm.Settings.WebcamOverlay = dummySettings.WebcamOverlay; vm.Settings.MousePointerOverlay = dummySettings.MousePointerOverlay; vm.Settings.Clicks = dummySettings.Clicks; vm.Settings.Keystrokes = dummySettings.Keystrokes; vm.Settings.Elapsed = dummySettings.Elapsed; // FFmpeg Path vm.Settings.FFmpeg.FolderPath = dummySettings.FFmpeg.FolderPath; foreach (var overlay in dummySettings.Censored) { vm.Settings.Censored.Add(overlay); } foreach (var overlay in dummySettings.TextOverlays) { vm.Settings.TextOverlays.Add(overlay); } foreach (var overlay in dummySettings.ImageOverlays) { vm.Settings.ImageOverlays.Add(overlay); } Start(vm, Options); } }) .WithParsed <ShotCmdOptions>(Options => { Banner(); using (var vm = ServiceProvider.Get <MainViewModel>()) { vm.Init(false, false, false, false); Shot(vm, Options); } }) .WithParsed <FFmpegCmdOptions>(Options => { Banner(); FFmpeg(Options); }); }