protected override void ProcessRecord()
        {
            var settings = new Settings
            {
                GroupByMethod      = this.GroupBy == GroupByMethod,
                ResolutionDuration = this.ResolutionInSeconds == 0 ? StatsGenerator.GetTimeSpanResolution(this.Resolution) : TimeSpan.FromSeconds(this.ResolutionInSeconds)
            };

            if (this.InputFiles == null && this.LogEntries != null)
            {
                StatsGenerator.Create(this.LogEntries.ToList(), this.WriteOutputCallback, this.WriteVerboseCallback, () => this.stopRequest, settings);
            }

            var supressCsvHeader = false;

            if (this.InputFiles != null && this.LogEntries == null)
            {
                this.WriteVerbose(string.Format("{0} files will be read.", this.InputFiles.Count()));

                foreach (var fileInfoGroup in this.InputFiles.GroupBy(x => x.Name).OrderByDescending(x => x.Key))
                {
                    List <LogEntry> logEntries = new List <LogEntry>();

                    this.WriteVerbose(string.Format("Reading {0} files with filename {1}", fileInfoGroup.Count(), fileInfoGroup.Key));
                    LogReader.ProcessLogFiles(fileInfoGroup.ToArray(), entry => logEntries.Add(entry), this.WriteProgress, this.ErrorHandling, this.NoProgress.IsPresent, () => { return(this.stopRequest); });

                    this.WriteVerbose(String.Format("Create stats."));
                    StatsGenerator.Create(logEntries, this.WriteOutputCallback, this.WriteVerboseCallback, () => this.stopRequest, settings, supressCsvHeader);

                    supressCsvHeader = true;
                }
            }
        }
Esempio n. 2
0
 protected override void ProcessRecord()
 {
     LogReader.ProcessLogFiles(this.InputFiles, this.WriteOutput, this.WriteProgress, this.ErrorHandling, this.NoProgress.IsPresent, () => { return(this.stopRequest); });
 }