internal override FileStatistics ComputeStatistics(HttpPostedFileBase httpPostedFileBase) { StreamReader sr = new StreamReader(httpPostedFileBase.InputStream); var delimeters = GetDelimeters(); int wordCount = 0; int linesCount = 0; while (!sr.EndOfStream) { var line = sr.ReadLine(); if (line != null) { line = line.Trim(); var fields = line.Split(delimeters, StringSplitOptions.RemoveEmptyEntries); wordCount += fields.Length; linesCount++; } } sr.Close(); FileStatistics fileStatistics = new FileStatistics { WordsCount = wordCount, LinesCount = linesCount, Filename = httpPostedFileBase.FileName }; return fileStatistics; }
public FileStatisticsEntity(FileStatistics fileStatistics) { LinesCount = fileStatistics.LinesCount; WordsCount = fileStatistics.WordsCount; Filename = fileStatistics.Filename; }