示例#1
0
        private void pageInstallerCaptureStart_Commit(object sender, WizardPageConfirmEventArgs e)
        {
            try
            {
                var captureSession = CaptureSession.Start(_feedBuilder);

                using (var handler = new DialogTaskHandler(this))
                    _installerCapture.RunInstaller(handler);

                _installerCapture.CaptureSession = captureSession;
            }
            #region Error handling
            catch (OperationCanceledException)
            {
                e.Cancel = true;
            }
            catch (Exception ex) when(ex is IOException or InvalidOperationException)
            {
                e.Cancel = true;
                Log.Warn(ex);
                Msg.Inform(this, ex.Message, MsgSeverity.Warn);
            }
            catch (UnauthorizedAccessException ex)
            {
                e.Cancel = true;
                Log.Error(ex);
                Msg.Inform(this, ex.Message, MsgSeverity.Error);
            }
            #endregion
        }
示例#2
0
        private ExitCode Start()
        {
            if (_additionalArgs.Count != 2)
            {
                return(PrintHelp());
            }
            string snapshotFile = _additionalArgs[1];

            if (FileExists(snapshotFile))
            {
                return(ExitCode.IOError);
            }

            var session = CaptureSession.Start(new FeedBuilder());

            session.Save(snapshotFile);

            return(ExitCode.OK);
        }