From cc4c8fa1bf41be667705c1aea5ef282a8ef0fa3b Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:49:55 +0000 Subject: Utilisateur : Fcolin Date : 22/12/05 Heure : 11:19 Archivé dans $/CSharp/Ivy Commentaire: bug format message (vss 2) --- CSharp/Ivy/Ivy/IvyTCPStreamV3.cs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'CSharp/Ivy') diff --git a/CSharp/Ivy/Ivy/IvyTCPStreamV3.cs b/CSharp/Ivy/Ivy/IvyTCPStreamV3.cs index 12a204e..88e7041 100644 --- a/CSharp/Ivy/Ivy/IvyTCPStreamV3.cs +++ b/CSharp/Ivy/Ivy/IvyTCPStreamV3.cs @@ -47,7 +47,7 @@ namespace IvyBus /* * message Syntax: - * this is a binary formated message use of network representation + * this is text formated message 'type id STX ARG0 {[ETX] ARG1 [ETX] ARGn}\n' * * message Format: MessageType, id , length, string @@ -57,27 +57,19 @@ namespace IvyBus output.Write(arg); output.Write(sep); } - private void Serialize(string arg, char sep) - { - output.Write(arg); - output.Write(sep); - } private void Serialize(string[] arg, char sep) { - /* serialize value */ - //Serialize(arg.Value); - - /* serialize children */ - //Serialize((short)arg.Count); for (int i = 0; i < arg.Length; i++) { - Serialize(arg[i], sep); + output.Write(arg[i]); + if ( i != (arg.Length-1) ) output.Write(sep); } } private void sendMsg(MessageType msgType, ushort msgId,params string[] msgData) { - +#if DEBUG Console.WriteLine(" sendMsg {0} id={1} data={2}", msgType, msgId, msgData); +#endif Serialize((ushort)msgType, ' '); Serialize(msgId, ARG_START); Serialize(msgData, ARG_END); @@ -206,7 +198,9 @@ namespace IvyBus msgType = (MessageType)DeserializeShort(); msgId = DeserializeShort(); msgData = DeserializeArgument(); +#if DEBUG Console.WriteLine(" receiveMsg {0} id={1} data={2}", msgType, msgId, msgData); +#endif switch (msgType) { case MessageType.Die: -- cgit v1.1