Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach (string folder in folders)
- {
- Check1Folder(ref totalFiles, ref totalError, folder);
- }
- private void Check1Folder(ref int totalFiles, ref int totalError, string folder)
- {
- string[] files = Directory.GetFiles(folder,"*.txt");
- totalFiles += files.Length;
- foreach (string file in files)
- {
- string correct = "Correct";
- string comment = "";
- int firstLine = 0;
- int count = 0;
- string[] lines = File.ReadAllLines(file);
- if (lines.Length != 2)
- {
- correct = "Error";
- comment = "File format error";
- totalError++;
- }
- else
- {
- firstLine = Convert.ToInt32(lines[0]);
- count = lines[1].Split(',').Length / 2;
- if (firstLine != count)
- {
- correct = "Error";
- comment = "File content error";
- totalError++;
- }
- }
- //vì code này sẽ show lên 1 cái winform nên chỗ này là gửi data vào trong cái DataTabe d,
- // không có gì đặc biệt.
- d.Rows.Add(Path.GetFileName(folder), Path.GetFileName(file), firstLine, count, correct, comment);
- }
- }
Add Comment
Please, Sign In to add comment