private void button4_Click(object sender, EventArgs e) { if (tabControl1.SelectedIndex == 0) { if (!Directory.Exists(this.textBox1.Text)) { MessageBox.Show("路径不合理"); return; } this.Hide(); SingleFolder folder = new SingleFolder(this.textBox1.Text); folder.ShowDialog(); this.Show(); } else { if (!Directory.Exists(this.textBox2.Text) || !Directory.Exists(this.textBox3.Text)) { MessageBox.Show("路径不合理"); return; } if (this.textBox2.Text == this.textBox3.Text) { MessageBox.Show("路径不能相同"); return; } this.Hide(); DoubleFolder folder = new DoubleFolder(this.textBox2.Text, this.textBox3.Text); folder.ShowDialog(); this.Show(); } }
private void DoubleFolder_Load(object sender, EventArgs e) { this.label1.Text = "目录:" + p1 + "\r\n\r\n " + this.label1.Text; this.label2.Text = "目录:" + p2 + "\r\n\r\n " + this.label2.Text; this.label1.Height += 10; this.label2.Height += 10; dic1 = Functions.GenMD5Dic(p1); dic2 = Functions.GenMD5Dic(p2); var iedic1 = dic1.OrderBy(o => o, new FielInfoDicComparer(dic2)); foreach (var it in iedic1) { var grop = SingleFolder.GenGroup(listView1, it); if (dic2.ContainsKey(it.Key)) { foreach (ListViewItem vitm in grop.Items) { vitm.ForeColor = Color.DarkRed; } } } var iedic2 = dic2.OrderBy(o => o, new FielInfoDicComparer(dic1)); foreach (var it in iedic2) { var grop = SingleFolder.GenGroup(listView2, it); if (dic1.ContainsKey(it.Key)) { foreach (ListViewItem vitm in grop.Items) { vitm.Checked = true; vitm.ForeColor = Color.DarkRed; } } } }