Esempio n. 1
0
        static int Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;
            if (!Utils.FfFilesExist)
            {
                Console.WriteLine(Properties.Resources.FFmpegFFprobeIsMissing);
                return(-1);
            }

            var cp     = new ConsoleProgram();
            var result = cp.Run(args);

            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Runs Eraser as a command-line application.
 /// </summary>
 /// <param name="commandLine">The command line parameters passed to Eraser.</param>
 private static int CommandMain(string[] commandLine)
 {
     using (ConsoleProgram program = new ConsoleProgram(commandLine))
         try
         {
             program.Handlers.Add("help",
                                  new ConsoleActionData(CommandHelp, new ConsoleArguments()));
             program.Handlers.Add("erase",
                                  new ConsoleActionData(CommandErase, new EraseArguments()));
             program.Handlers.Add("addtask",
                                  new ConsoleActionData(CommandAddTask, new TaskArguments()));
             program.Handlers.Add("importtasklist",
                                  new ConsoleActionData(CommandImportTaskList, new ConsoleArguments()));
             program.Handlers.Add("shell",
                                  new ConsoleActionData(CommandShell, new ShellArguments()));
             program.Run();
             return(0);
         }
         catch (UnauthorizedAccessException)
         {
             return(Win32ErrorCode.AccessDenied);
         }
     catch (Win32Exception e)
     {
         Console.WriteLine(e.Message);
         return(e.ErrorCode);
     }
     catch (ArgumentException e)
     {
         Console.WriteLine(e.Message);
         return(Win32ErrorCode.BadArguments);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.WriteLine(e.StackTrace);
         throw;
     }
 }
Esempio n. 3
0
 private static int CommandMain(string[] commandLine)
 {
     using (ConsoleProgram program = new ConsoleProgram(commandLine))
        using (ManagerLibrary library = new ManagerLibrary(new Settings()))
     try
     {
      program.Handlers.Add("help",
       new ConsoleActionData(CommandHelp, new ConsoleArguments()));
      program.Handlers.Add("querymethods",
       new ConsoleActionData(CommandQueryMethods, new ConsoleArguments()));
      program.Handlers.Add("addtask",
       new ConsoleActionData(CommandAddTask, new AddTaskArguments()));
      program.Handlers.Add("importtasklist",
       new ConsoleActionData(CommandImportTaskList, new ConsoleArguments()));
      program.Run();
      return 0;
     }
     catch (UnauthorizedAccessException)
     {
      return Win32ErrorCode.AccessDenied;
     }
     catch (Win32Exception e)
     {
      Console.WriteLine(e.Message);
      return e.ErrorCode;
     }
     catch (Exception e)
     {
      Console.WriteLine(e.Message);
      return 1;
     }
 }