@@ -58,49 +58,56 @@ private set
5858 }
5959 }
6060
61+ private void setPortConfigType ( EPortType type , bool enable )
62+ {
63+ if ( enable )
64+ portConfig . Type |= type ;
65+ else
66+ portConfig . Type &= ~ type ;
67+ }
68+
6169 protected override void OnOutputEnable ( int port )
6270 {
63- portConfig . Type |= EPortType . InputToArtNet ;
64- portConfig . Type &= ~ EPortType . OutputFromArtNet ;
65- portConfig . GoodInput = GoodInput . None ;
71+ setPortConfigType ( EPortType . InputToArtNet , true ) ;
6672 portConfig . GoodOutput = new GoodOutput ( isBeingOutputAsDMX : true ) ;
73+
6774 IsOutput = true ;
6875 }
6976
7077 protected override void OnOutputDisable ( int port )
7178 {
72- portConfig . Type &= ~ EPortType . InputToArtNet ;
73- portConfig . GoodInput = GoodInput . None ;
74- portConfig . GoodOutput = new GoodOutput ( isBeingOutputAsDMX : true ) ;
79+ setPortConfigType ( EPortType . InputToArtNet , false ) ;
80+ portConfig . GoodOutput = GoodOutput . None ;
81+
7582 IsOutput = false ;
7683 }
7784
7885 protected override void OnInputEnable ( int port )
7986 {
80- portConfig . Type |= EPortType . OutputFromArtNet ;
81- portConfig . Type &= ~ EPortType . InputToArtNet ;
82- portConfig . GoodInput = GoodInput . None ;
83- portConfig . GoodOutput = new GoodOutput ( isBeingOutputAsDMX : false ) ;
87+ setPortConfigType ( EPortType . OutputFromArtNet , true ) ;
88+ portConfig . GoodInput = new GoodInput ( inputDisabled : false ) ;
89+
8490 IsInput = true ;
8591 }
8692
8793 protected override void OnInputDisable ( int port )
8894 {
89- portConfig . Type &= ~ EPortType . OutputFromArtNet ;
95+ setPortConfigType ( EPortType . OutputFromArtNet , false ) ;
9096 portConfig . GoodInput = GoodInput . None ;
91- portConfig . GoodOutput = new GoodOutput ( isBeingOutputAsDMX : false ) ;
97+
9298 IsInput = false ;
9399 }
94100
95101 protected override void OnEnable ( )
96102 {
97- portConfig . GoodInput = GetOutputState ( 0 ) ? new GoodInput ( dataReceived : true ) : new GoodInput ( inputDisabled : true ) ;
98- portConfig . GoodOutput = GetInputState ( 0 ) ? new GoodOutput ( isBeingOutputAsDMX : true ) : new GoodOutput ( isBeingOutputAsDMX : false ) ;
103+ portConfig . Type = EPortType . DMX512 ;
104+
99105 if ( IsInput )
100106 {
101107 OnInputEnable ( 0 ) ;
102108 OnOutputDisable ( 0 ) ;
103109 }
110+
104111 if ( IsOutput )
105112 {
106113 OnOutputEnable ( 0 ) ;
@@ -110,9 +117,11 @@ protected override void OnEnable()
110117
111118 protected override void OnDisable ( )
112119 {
113- portConfig . Type = EPortType . DMX512 ;
114120 portConfig . GoodInput = GoodInput . None ;
115121 portConfig . GoodOutput = GoodOutput . None ;
122+
123+ setPortConfigType ( EPortType . OutputFromArtNet , false ) ;
124+ setPortConfigType ( EPortType . InputToArtNet , false ) ;
116125 }
117126
118127 public override EInterfaceOptions Options
0 commit comments