2 Star 2 Fork 2

大湿胸/P2PGrid

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Commander.cs 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
大湿胸 提交于 2017-06-21 09:51 +08:00 . Init
using System;
using System.Text;
namespace P2PGrid
{
class MessagerProcessor
{
/// <summary>
/// use it to do network operation
/// </summary>
private INetworkOperator netOperation;
public MessagerProcessor(INetworkOperator ino)
{
netOperation = ino;
}
public void Process(string command)
{
string [] commands=command.Split(' ');
int count = commands.Length;
if (count > 0)
{
string first=commands[0].ToLower();
if (first == "start"&&(count==2))
{
netOperation.Start(int.Parse(commands[1]));
}
if (first == "connect" && (count==2||count==3) )
{
if (count == 2)
netOperation.Connect("127.0.0.1", int.Parse(commands[1]));
else
netOperation.Connect(commands[1],int.Parse(commands[2]));
}
if (first == "close" && (count == 1))
{
netOperation.CloseClient();
}
if (first == "get" && (count == 3))
{
netOperation.Send(command);
}
if (first == "set" && (count == 4))
{
netOperation.Send(command);
}
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/iframework/p2pgrid.git
git@gitee.com:iframework/p2pgrid.git
iframework
p2pgrid
P2PGrid
master

搜索帮助