private void Import_Click(object sender, EventArgs e) { int i; TreeNodeAccess import; RemoteAccess ra; string name; string master; master = MasterPassword.getInstance().master; if (master == MasterPassword.NO_MASTER_ENTERED) { Close(); return; } import = new TreeNodeAccess(directoryName.Text); for (i = 0; i < checkedListBox1.CheckedItems.Count; i++) { ra = ((RemoteAccessEntry)checkedListBox1.CheckedItems[i]).access; // cipher collected passwords if (master == MasterPassword.NO_MASTER_ENABLED) { ra.password = Convert.ToBase64String(Encoding.UTF8.GetBytes(ra.password)); } else { using (Encryption enc = new Encryption(master)) { ra.password = enc.EncryptString(ra.password); } } name = ((RemoteAccessEntry)checkedListBox1.CheckedItems[i]).name; import.Nodes.Add(new TreeNodeAccess(ra, name)); } if (OnImport != null && i != 0) { OnImport(import); } Close(); }
public override object Clone() { TreeNodeAccess result; if (isFolder()) { TreeNodeAccess clone; result = new TreeNodeAccess(this.Text); result.ContextMenuStrip = ContextMenuStrip; foreach (TreeNodeAccess childNode in Nodes) { clone = (TreeNodeAccess)childNode.Clone(); result.Nodes.Add(clone); } } else { result = new TreeNodeAccess(_remoteAccess, this.Text); result.ContextMenuStrip = ContextMenuStrip; } return(result); }