public string[] sname(string fpath) { fileRead fr = new fileRead(); DirectoryInfo dir = new DirectoryInfo(fpath); FileSystemInfo[] fsi = dir.GetFileSystemInfos(); int i = 0; string[] sname = new string[fsi.Length]; foreach (FileSystemInfo file in fsi) { sname[i] = fr.fileName(file.ToString())[1]; i++; //i+1=考生数量 } return(sname); }
public string[] sid(string fpath) { fileRead fr = new fileRead(); DirectoryInfo dir = new DirectoryInfo(fpath); FileSystemInfo[] fsi = dir.GetFileSystemInfos(); int i = 0; string[] sid = new string[fsi.Length]; foreach (FileSystemInfo file in fsi) { //fname = fr.fileName(file.ToString()); sid[i] = fr.fileName(file.ToString())[0]; i++; //i+1=考生数量 } count = i; return(sid); }
private void button1_Click(object sender, EventArgs e) { //输出题目 ReadWord rw = new ReadWord(); LCS <string> lcs = new LCS <string>(rw.readList(), rw.readList1()); msg.Text = lcs.ToString(); msg.Visible = true; //先清除所有行 dataGridView1.Rows.Clear(); //初始化fileRead获取文件 fileRead fr = new fileRead(); writeMsg wm = new writeMsg(); wm.road(textBox1.Text); fileWtite fw = new fileWtite(); fw.writefile(); fr.readfile(); //扫描路径 DirectoryInfo dir = new DirectoryInfo(textBox1.Text); FileSystemInfo[] files = dir.GetFileSystemInfos(); int index = files.Length; int[] score = fileRead.score.ToArray(); string[] name = fileRead.name.ToArray(); string[] id = fileRead.id.ToArray(); int i; for (int a = 0; a < index; a++) { i = dataGridView1.Rows.Add(); dataGridView1.Rows[i].Cells[0].Value = id[a]; dataGridView1.Rows[i].Cells[1].Value = name[a]; dataGridView1.Rows[i].Cells[2].Value = score[a]; } }