| 12345678910111213141516171819202122232425 |
- using SHJX.Service.Control.PortProduction.PortProducerImpl;
- namespace SHJX.Service.Control.PortProduction
- {
- public class PortProducerFactory
- {
- private static OptCommand _command;
- public PortProducerFactory(OptCommand command)
- {
- _command = command;
- }
- public static IPortProducer Factory(WriteWay way)
- {
- IPortProducer operate = way switch
- {
- WriteWay.Read => new ReadPortProducer(_command),
- WriteWay.Write => new WritePortProducer(_command),
- _ => throw new ArgumentException("未找到对应的枚举!")
- };
- return operate;
- }
- }
- }
|