예제 #1
0
파일: Client.cs 프로젝트: Falconne/ADLib
        private Client Run(string cmd, params string[] packagesAndArguments)
        {
            var args = new List <object> {
                cmd, "-y"
            };

            args.AddRange(packagesAndArguments);

            var result = Shell.RunAndGetExitCodeMS(GetChocoExecutable(), args.ToArray());

            GenLog.Info("Chocolatey command done");
            switch (result)
            {
            case 0:
                break;

            case 1641:
                _interactionHandler.ExitWithSuccess("Exiting for reboot");
                break;

            case 3010:
                AskForRestart();
                break;

            default:
                _interactionHandler.ExitWithError("Chocolatey failed");
                break;
            }

            return(this);
        }
예제 #2
0
 public void Run()
 {
     try
     {
         DoWork();
         InteractionHandler.ExitWithSuccess("All done");
     }
     catch (Exception e)
     {
         GenLog.Error(e.StackTrace);
         InteractionHandler.ExitWithError(e.Message);
     }
 }