private void button1_Click(object sender, EventArgs e) { lib.SetPath("E:\\ASYMTEK.lib"); CADImport.Instance.OnLoadASYMTEKLib(); getType(); lib.Save(); }
/// <summary> /// 将用户Lib融入到已有Lib /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMerge_Click(object sender, EventArgs e) { bool isFinded = false; if (string.IsNullOrEmpty(this.curLib.PathLib)) { return; } ComponentLib lib = new ComponentLib(); lib.Clear(); lib.AddRange(this.curLib.FindAll()); this.curLib.Save(); int index = findMaxIndex(lib); foreach (var userComp in this.curUserLib.FindAll()) { isFinded = false; foreach (var libComp in lib.FindAll()) { if (libComp.component.Name == userComp.component.Name) { isFinded = true; continue; } } if (isFinded == false) { index++; ComponentEx cmp = new ComponentEx(index); cmp.component = userComp.component.DepCopy(); lib.Add(cmp); } } string path = string.Format("{0}\\{1}.lib", Path.GetDirectoryName(this.curLib.GetPath()), Path.GetFileNameWithoutExtension(this.curLib.GetPath())); lib.SetPath(path); lib.PathLib = path; lib.Save(); }