Exemplo n.º 1
0
        private void ParseRecords(string dirPath, List <string> fileNames, FileTypes userFileType)
        {
            CsvStreamCreator csvStreamCreate = new CsvStreamCreator();

            foreach (var fileName in fileNames)
            {
                try
                {
                    TextReader inputStream = new StreamReader(dirPath + "\\" + fileName);
                    inputStream.ReadLine();
                    inputStream.ReadLine();
                    inputStream.ReadLine();

                    using (var csv = csvStreamCreate.CsvStream(inputStream, userFileType))
                    {
                        var records = csv.GetRecords <SRORecord>();

                        foreach (var record in records)
                        {
                            sroRecords.Add(record);
                        }
                    }
                }
                catch (Exception sroEx)
                {
                    System.Diagnostics.Trace.WriteLine(DateTime.Now + sroEx.ToString(), "Error parsing SRO log file");
                    throw;
                }
            }
        }
Exemplo n.º 2
0
        private void ParseRecords(string dirPath, string fileName, FileTypes userSelectedFileType)
        {
            CsvStreamCreator csvStreamCreate = new CsvStreamCreator();

            try
            {
                TextReader inputStream = new StreamReader(dirPath + "\\" + fileName);
                inputStream.ReadLine();
                inputStream.ReadLine();
                inputStream.ReadLine();

                using (var csv = csvStreamCreate.CsvStream(inputStream, userSelectedFileType))
                {
                    IEnumerable <MemoryRecord> records = csv.GetRecords <MemoryRecord>();

                    foreach (var record in records)
                    {
                        memRecords.Add(record);
                    }
                }
            }
            catch (Exception memEx)
            {
                System.Diagnostics.Trace.WriteLine(DateTime.Now + memEx.ToString(), "Error parsing memory log file");
                throw;
            }
        }