public static List<AssetRecord> ParseRecordsFromFile(string file) { List<AssetRecord> list = new List<AssetRecord>(); string[] lines = File.ReadAllLines(file); AssetRecord currentRecord = null; foreach (string line in lines) { if (line.StartsWith(m_startString) && currentRecord == null) { currentRecord = new AssetRecord(); currentRecord.Path = GetPathFromLine(line); currentRecord.Type = AssetRecordTypeSolver.GetTypeFromPath(currentRecord.Path); } else if (line.StartsWith(m_stopString) && currentRecord != null) { currentRecord.Time = GetTimeFromLine(line); list.Add(currentRecord); currentRecord = null; } } return list; }
static string CSVLineFromRecord(AssetRecord record) { return record.Path + "," + record.Type + "," + record.Time; }