using System;
using MSNP;
namespace MSNP.CommandParsers{
/// <summary>
/// Summary description for NoIDCommandParser.
/// </summary>
internal class NoIDCommandParser : ICommandParser
{
protected internal NoIDCommandParser() {}
public Response ParseResponse(string rawResponse)
{
string curCommand;
string[] curParameters = new String[0];
string[] allParts = rawResponse.Trim().Split(new char[] {' '}, 2);
int curPart = 0;
if( allParts.Length > 0 )
{
curCommand = allParts[curPart++];
if( allParts.Length > 1 )
curParameters = allParts[curPart++].Split(new char[] {' '});
return new Response(curCommand, -1, curParameters);
}
else
throw new Exception("Invalid response from server: " + rawResponse);
}
}
}
|