示例#1
0
        public override Exception Run(CancellationToken token)
        {
            LoadConfig("~/.config/taa/config.yml");

            InputFiles = InputFiles.Any() ? InputFiles : Directory.EnumerateFiles(TargetDirectory);

            Logger.Info("Vtn:");
            Logger.Info($"\tVoltage: {VtnVoltage}");
            Logger.Info($"\tSigma: {VtnSigma}");
            Logger.Info($"\tDeviation: {VtnDeviation}");
            Logger.Info("Vtp:");
            Logger.Info($"\tVoltage: {VtpVoltage}");
            Logger.Info($"\tSigma: {VtpSigma}");
            Logger.Info($"\tDeviation: {VtpDeviation}");
            Logger.Info($"Total Files: {InputFiles.Count()}");

            Logger.Info("Start push");
            using (var bar = new ProgressBar(2, "Master", new ProgressBarOptions {
                ForegroundColor = ConsoleColor.DarkGreen,
                BackgroundCharacter = '-',
                ProgressCharacter = '>',
                CollapseWhenFinished = false
            })) {
                var opt = new ProgressBarOptions {
                    ForegroundColor      = ConsoleColor.DarkYellow,
                    ProgressCharacter    = '=',
                    CollapseWhenFinished = false
                };
                using (var pushBar = bar.Spawn(0, "Pushing...", opt))
                    using (var parseBar = bar.Spawn(InputFiles.Count(), "Parsing...", opt))
                        return(PushFiles(token, bar, parseBar, pushBar));
            }
        }
        public override bool Equals(object obj)
        {
            if (obj.GetType() != typeof(CommandLineOptions))
            {
                return(false);
            }

            var other = (CommandLineOptions)obj;

            if (this.InputFiles.Count() != other.InputFiles.Count())
            {
                return(false);
            }

            for (int i = 0; i < InputFiles.Count(); i++)
            {
                if (this.InputFiles.ElementAt(i) != other.InputFiles.ElementAt(i))
                {
                    return(false);
                }
            }

            return
                (this.Parser == other.Parser &&
                 this.DebugMode == other.DebugMode &&
                 this.UseOpenCover == other.UseOpenCover &&
                 this.CoverallsRepoToken == other.CoverallsRepoToken);
        }
示例#3
0
        public override bool RunTask()
        {
            if (InputFiles == null || InputFiles.Count() == 0)
            {
                Log.LogCodedError("XA1020", Properties.Resources.XA1020);
                return(false);
            }

            if (References != null)
            {
                foreach (var path in References)
                {
                    if (!Directory.Exists(path.ItemSpec) && !File.Exists(path.ItemSpec))
                    {
                        Log.LogCodedError("XA1022", Properties.Resources.XA1022, path.ItemSpec);
                    }
                }
            }

            if (Log.HasLoggedErrors)
            {
                return(false);
            }

            try {
                return(base.RunTask());
            }
            finally {
                File.Delete(responseFilePath);
            }
        }
示例#4
0
        protected override void OnFinishButton()
        {
            base.OnFinishButton();
            SaveSettings();
            if (string.IsNullOrEmpty(m_fileListBox.Text))
            {
                return;
            }
            using (var dlg = new ProgressDialogWithTask(this))
            {
                dlg.AllowCancel = false;
                dlg.Minimum     = 0;
                // Allow 100 units of progress for each file for now. This allows for plenty of resolution for the LL importer
                dlg.Maximum = InputFiles.Count() * 100;

                try
                {
                    dlg.RunTask(true, DoConversion);
                }
                catch (WorkerThreadException ex)                 // any exception on the worker thread is converted to this
                {
                    // JohnT: I hate to just report and otherwise ignore all exceptions, but have not been able to find any doc of which ones,
                    // if any, EncConverters may throw.
                    System.Diagnostics.Debug.WriteLine("Error: " + ex.InnerException.Message);
                    MessageBox.Show(this, String.Format(ITextStrings.ksSfmImportProblem, ex.InnerException.Message),
                                    ITextStrings.ksUnhandledError,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    DialogResult = DialogResult.Cancel;
                    Close();
                }
            }
            m_mediator.SendMessage("MasterRefresh", ActiveForm);
            if (m_firstNewText != null)
            {
                // try to select it.
                var clerk = RecordClerk.FindClerk(m_propertyTable, "interlinearTexts");
                if (clerk != null)
                {
                    clerk.JumpToRecord(m_firstNewText.ContentsOA.Hvo);
                }
            }
        }
示例#5
0
        private int Run()
        {
            try
            {
                Log.WriteMessage("Starting execution of SignCheck.");

                SignatureVerificationOptions options = SignatureVerificationOptions.None;
                options |= Options.Recursive ? SignatureVerificationOptions.VerifyRecursive : SignatureVerificationOptions.None;
                options |= Options.EnableXmlSignatureVerification ? SignatureVerificationOptions.VerifyXmlSignatures : SignatureVerificationOptions.None;
                options |= Options.SkipTimestamp ? SignatureVerificationOptions.None : SignatureVerificationOptions.VerifyAuthentiCodeTimestamps;
                options |= Options.VerifyStrongName ? SignatureVerificationOptions.VerifyStrongNameSignature : SignatureVerificationOptions.None;
                options |= Options.EnableJarSignatureVerification ? SignatureVerificationOptions.VerifyJarSignatures : SignatureVerificationOptions.None;
                options |= !String.IsNullOrEmpty(Options.ExclusionsOutput) ? SignatureVerificationOptions.GenerateExclusion : SignatureVerificationOptions.None;

                var signatureVerificationManager = new SignatureVerificationManager(Exclusions, Log, options);

                ResultDetails = Options.Verbosity > LogVerbosity.Normal ? DetailKeys.ResultKeysVerbose : DetailKeys.ResultKeysNormal;

                if (InputFiles.Count() > 0)
                {
                    DateTime startTime = DateTime.Now;
                    IEnumerable <SignatureVerificationResult> results = signatureVerificationManager.VerifyFiles(InputFiles);
                    DateTime endTime = DateTime.Now;

                    AllFilesSigned = true;
                    Log.WriteLine();
                    Log.WriteMessage(LogVerbosity.Minimum, SignCheckResources.scResults);
                    Log.WriteLine();
                    ProcessResults(results, 0);

                    // Generate an exclusions file for any unsigned files that were reported.
                    if (!String.IsNullOrEmpty(Options.ExclusionsOutput))
                    {
                        if (!Directory.Exists(Options.ExclusionsOutput))
                        {
                            Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(Options.ExclusionsOutput)));
                        }
                        using (var exclusionsWriter = new StreamWriter(Options.ExclusionsOutput, append: false))
                        {
                            GenerateExclusionsFile(exclusionsWriter, results);
                        }
                    }

                    if (LoggedResults)
                    {
                        Log.WriteLine();
                    }

                    if (AllFilesSigned)
                    {
                        Log.WriteMessage(LogVerbosity.Minimum, SignCheckResources.scAllFilesSigned);
                    }
                    else
                    {
                        Log.WriteError(LogVerbosity.Minimum, SignCheckResources.scUnsignedFiles);
                    }

                    TimeSpan totalTime = endTime - startTime;
                    Log.WriteMessage(LogVerbosity.Minimum, String.Format(SignCheckResources.scTime, totalTime));
                    Log.WriteMessage(LogVerbosity.Minimum, String.Format(SignCheckResources.scStats,
                                                                         TotalFiles, TotalSignedFiles, TotalUnsignedFiles, TotalSkippedFiles, TotalExcludedFiles, TotalSkippedExcludedFiles));
                }
                else
                {
                    Log.WriteMessage(LogVerbosity.Minimum, SignCheckResources.scNoFilesProcessed);
                }
            }

            catch (Exception e)
            {
                Log.WriteError(e.ToString());
            }
            finally
            {
                if (Log != null)
                {
                    Log.Close();
                }
            }

            return(Log.HasLoggedErrors ? -1 : 0);
        }