public static CapeOpenUnitPort Create(CapeOpenPortType type, string name, string description, CapeOpenPortDirection direction) { CapeOpenUnitPort zPort = null; switch (type) { case CapeOpenPortType.Material: zPort = new MaterialPort(); break; default: throw new CapeOpenException(); } zPort.Name = name; zPort.Description = description; zPort.Direction = direction; return(zPort); }
public static CapePortType Map(CapeOpenPortType type) { switch (type) { case CapeOpenPortType.Material: return(CapePortType.CAPE_MATERIAL); case CapeOpenPortType.Energy: return(CapePortType.CAPE_ENERGY); case CapeOpenPortType.Information: return(CapePortType.CAPE_INFORMATION); case CapeOpenPortType.Any: return(CapePortType.CAPE_ANY); default: throw new CapeOpenException(); } }