示例#1
0
        /// <summary>
        /// get report from a file by input file name
        /// </summary>
        /// <param name="inputFile"> file name </param>
        /// <returns>report feeReport</returns>
        public Visa GetReport(string inputFile)
        {
            visaReport = new Visa();
            var watch = Stopwatch.StartNew();

            visaReport.LoadFile(inputFile);
            const Int32 BufferSize = 128;
            var         fileStream = File.OpenRead(inputFile);

            streamReader = new StreamReader(fileStream, Encoding.UTF8, true, BufferSize);
            String        line;
            List <string> ltsString = new List <string>();
            int           rowNumber = 0;

            while ((line = streamReader.ReadLine()) != null)
            {
                rowNumber++;
                if (streamReader.EndOfStream)
                {
                    visaReport.FileRow = rowNumber;
                }
                ReadLine(line, rowNumber);
            }

            // the code that you want to measure comes here
            fileStream.Close();
            watch.Stop();
            var elapsedMs = watch.ElapsedMilliseconds;

            visaReport.TimeProcess = elapsedMs.ToString();
            return(visaReport);
        }