📄 commander.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
namespace P2PGrid
{
class Commander
{
private INetworkOperator netOperation;
public Commander(INetworkOperator ino)
{
netOperation = ino;
}
public void Excute(string com)
{
string [] commands=com.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(com);
}
if (first == "set" && (count == 4))
{
netOperation.Send(com);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -