diff options
-rw-r--r-- | CSharp/Ivy/Ivy/IvyTCPStreamV4.cs | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/CSharp/Ivy/Ivy/IvyTCPStreamV4.cs b/CSharp/Ivy/Ivy/IvyTCPStreamV4.cs index 028b2c5..9a96d62 100644 --- a/CSharp/Ivy/Ivy/IvyTCPStreamV4.cs +++ b/CSharp/Ivy/Ivy/IvyTCPStreamV4.cs @@ -96,15 +96,16 @@ namespace IvyBus sendMsg(MessageType.ApplicationId, priority, appId);
}
- void IvyProtocol.TokenAddBinding(Ivy.ApplicationBinding bind)
+ void IvyProtocol.TokenAddBinding(BindingType type, ushort id, string expression)
{
- if (bind.type == Ivy.BindingType.BindRegexp)
+ switch (type)
{
- sendMsg(MessageType.AddRegexp, bind.key, bind.expression); /* perhaps we should perform some checking here */
- }
- else
- {
- sendMsg(MessageType.AddBinding, bind.key, bind.expression); /* perhaps we should perform some checking here */
+ case BindingType.Regexp:
+ sendMsg(MessageType.AddRegexp, id, expression); /* perhaps we should perform some checking here */
+ break;
+ case BindingType.Simple:
+ sendMsg(MessageType.AddBinding, id, expression); /* perhaps we should perform some checking here */
+ break;
}
}
@@ -185,7 +186,6 @@ namespace IvyBus }
bool IvyProtocol.receiveMsg()
{
- Ivy.ApplicationBinding bind;
MessageType msgType = MessageType.Die;
ushort msgId = 0;
string[] msgData = null;
@@ -207,19 +207,11 @@ namespace IvyBus break;
case MessageType.AddRegexp:
- bind = new Ivy.ApplicationBinding();
- bind.type = Ivy.BindingType.BindRegexp;
- bind.key = msgId;
- bind.expression = msgData[0];
- receiver.TokenAddBinding(bind);
+ receiver.TokenAddBinding(BindingType.Regexp, msgId, msgData[0]);
break;
case MessageType.AddBinding:
- bind = new Ivy.ApplicationBinding();
- bind.type = Ivy.BindingType.BindSimple;
- bind.key = msgId;
- bind.expression = msgData[0];
- receiver.TokenAddBinding(bind);
+ receiver.TokenAddBinding(BindingType.Simple, msgId, msgData[0]);
break;
case MessageType.DelBinding:
|