/// <summary> /// Gets boxes connected to some socket of box <paramref name="box"/>. /// </summary> /// <returns>An IBoxModule array of boxes connected to box /// <paramref name="box"/>.</returns> /// <param name="box">An <see cref="T:Ferda.ModulesManager.IBoxModule"/> /// representation of box</param> /// <seealso cref="M:Ferda.ProjectManager.Archive.ConnectionsFrom(Ferda.ModulesManager.IBoxModule)"/> public IBoxModule[] ConnectedTo(IBoxModule box) { IBoxModule[] resultArray = box.ConnectedTo(); Array.Sort<IBoxModule>(resultArray); return resultArray; }
/// <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(); }