From: <br...@us...> - 2008-06-04 12:57:33
|
Revision: 211 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=211&view=rev Author: brus07 Date: 2008-06-04 05:57:22 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Update protocol (change separator character to '$'). Fixed bug with empty response. Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-04 09:08:29 UTC (rev 210) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-04 12:57:22 UTC (rev 211) @@ -45,8 +45,8 @@ void Send2(string message) { - string res = (message.Split(' '))[0]; - string id = (message.Split(' '))[1]; + string res = (message.Split('$'))[0]; + string id = (message.Split('$'))[1]; HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1/d/set.php?res=" + res + "&id=" + id); myRequest.Method = "GET"; myRequest.GetResponse(); @@ -67,6 +67,8 @@ string result = sr.ReadToEnd(); sr.Close(); myResponse.Close(); + if (result.Length == 0) + return null; return result; } } Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs 2008-06-04 09:08:29 UTC (rev 210) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs 2008-06-04 12:57:22 UTC (rev 211) @@ -14,11 +14,9 @@ public Result(string message) { //TODO - string[] messages = message.Split(' '); - if (messages.Length != 3) - throw new Exception("Result.Result: \xED\xE5\xEF\xF0\xE0\xE2\xE8\xEB\xFC\xED\xE8\xE9 \xF4\xEE\xF0\xEC\xE0\xF2 \xE2\xF5\xB3\xE4\xED\xEE\xBF \xF1\xF2\xF0\xB3\xF7\xEA\xE8"); - temp = messages[0]; - submit = new Submit(messages[1] + " " + messages[2]); + temp = message.Substring(0, message.IndexOf('$')); + string s = message.Substring(message.IndexOf('$') + 1); + submit = new Submit(s); } public Submit Submit Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs 2008-06-04 09:08:29 UTC (rev 210) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs 2008-06-04 12:57:22 UTC (rev 211) @@ -13,11 +13,8 @@ public Submit(string message) { //TODO - string[] messages = message.Split(' '); - if (messages.Length != 2) - throw new Exception("Submit.Submit: \xED\xE5\xEF\xF0\xE0\xE2\xE8\xEB\xFC\xED\xE8\xE9 \xF4\xEE\xF0\xEC\xE0\xF2 \xE2\xF5\xB3\xE4\xED\xEE\xBF \xF1\xF2\xF0\xB3\xF7\xEA\xE8"); - id = Convert.ToInt32(messages[0]); - temp = messages[1]; + id = Convert.ToInt32(message.Substring(0,message.IndexOf('$'))); + temp = message.Substring(message.IndexOf('$')+1); } //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |