private void button3_Click(object sender, EventArgs e) { try { openFileDialog1.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory; openFileDialog1.Title = "选择dll的路径"; openFileDialog1.Filter = "dll文件(*.dll)|*.dll"; openFileDialog1.RestoreDirectory = true; DllParameter dllParameter; string tmp = ""; if (openFileDialog1.ShowDialog() == DialogResult.OK) { foreach (var item in openFileDialog1.FileNames) { tmp = Path.GetFileName(item); dllParameter = new DllParameter { dllPath = item, dllName = tmp }; if (ExcludeEmptyList2(dllParameter)) { dlls.Add(dllParameter); } } } } catch (Exception ex) { throw ex; } Refreshlist2(); }
private bool ExcludeEmptyList2(DllParameter parameter) { var finded = dlls.FindAll(a => a.dllPath == parameter.dllPath); if (finded != null) { return(true); } return(false); }