本文整理汇总了C#中OperationResponse.SetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# OperationResponse.SetParameters方法的具体用法?C# OperationResponse.SetParameters怎么用?C# OperationResponse.SetParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationResponse
的用法示例。
在下文中一共展示了OperationResponse.SetParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnOperationRequest
protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
{
switch (operationRequest.OperationCode)
{
case 1:
if (operationRequest.Parameters.ContainsKey(1))
{
m_log.Debug("Login:" + operationRequest.Parameters[1] + " password:" + operationRequest.Parameters[2]);
if (operationRequest.Parameters[2].Equals("1"))
{
OperationResponse response;
response = new OperationResponse(operationRequest.OperationCode);
Dictionary<byte, object> dictionary;
dictionary = new Dictionary<byte, object>();
dictionary.Add(1, "Accepted");
response.SetParameters(dictionary);
SendOperationResponse(response, sendParameters);
}
else
{
OperationResponse response;
response = new OperationResponse(operationRequest.OperationCode);
Dictionary<byte, object> dictionary;
dictionary = new Dictionary<byte, object>();
dictionary.Add(1, "Bad password");
response.SetParameters(dictionary);
SendOperationResponse(response, sendParameters);
}
}
break;
/*case 2:
if (operationRequest.Parameters.ContainsKey(1))
{
Log.Debug("recv:" + operationRequest.Parameters[1]);
EventData eventdata = new EventData(1);
eventdata.Parameters = new Dictionary<byte, object> { { 1, "response for event" } };
SendEvent(eventdata, sendParameters);
}
break;*/
default:
m_log.Debug("Unknown OperationRequest received!:" + operationRequest.OperationCode);
break;
}
}