/// <summary> /// Removes box from archive. /// </summary> /// <param name="box">An <see cref="T:Ferda.ModulesManager.IBoxModule"/> /// representation of box</param> /// <seealso cref="M:Ferda.ProjectManager.Archive.Add(Ferda.ModulesManager.IBoxModule)"/> /// <seealso cref="P:Ferda.ProjectManager.Archive.Boxes"/> public void Remove(IBoxModule box) { foreach(IBoxModule otherBox in box.ConnectedTo()) { foreach(SocketInfo info in otherBox.Sockets) { foreach(IBoxModule thirdBox in otherBox.GetConnections(info.name)) { if(thirdBox == box) { otherBox.RemoveConnection(info.name,box); break; } } } } foreach(SocketInfo info in box.Sockets) { foreach(IBoxModule otherBox in box.GetConnections(info.name)) { box.RemoveConnection(info.name, otherBox); } } foreach(View view in views) { if(view.ContainsBox(box)) view.Remove(box); } if(boxes.Remove(box)) { removeBoxCategories(box); } boxesByProjectIdentifier.Remove(box.ProjectIdentifier); box.destroy(); }