public void ReadSummaryCSVfile(string FilePath) { using (var fs = File.OpenRead(FilePath)) using (var reader = new StreamReader(fs)) { while (!reader.EndOfStream) { FileIOC Fileioc = new FileIOC(); var line = reader.ReadLine(); var values = line.Split(',').ToArray(); if (line.ElementAt(0) == ',' && line.ElementAt(1) == ',' && line.ElementAt(2) == ',') { Fileioc.AddIOC(Convert.ToInt32(line.ElementAt(line.Count() - 1)), line.ElementAt(line.Count()).ToString()); } else { Fileioc.Filename = values[0]; Fileioc.Type = values[1]; Fileioc.VTresults = values[2]; Fileioc.TotalSeverity = Convert.ToInt32(values[3]); Fileioc.MD5 = values[4]; Fileioc.SHA1 = values[5]; Fileioc.AddIOC(Convert.ToInt32(values[6]), values[7].ToString()); } Files.Add(Fileioc); } } }
public void ReadVTCSVfile(string FilePath) { using (var fs = File.OpenRead(FilePath)) using (var reader = new StreamReader(fs)) { while (!reader.EndOfStream) { FileIOC Fileioc = new FileIOC(); var line = reader.ReadLine(); var values = line.Split(',').ToArray(); Fileioc.Filename = values[0]; Fileioc.VTresults = values[1]; Files.Add(Fileioc); } } }