//实现接口 public string execute(string [] args, bool isHash) { arguments = CommandLineArgumentParser.Parse(args); if (arguments.Has("-help")) { return(listCommand()); } else { if (arguments.Has("-listFolder")) { return(listAllFolder(args, isHash)); } } return(null); }
public Dictionary <string, string> getFilterMap(string command) { Dictionary <string, string> map = new Dictionary <string, string>(); if (arguments.Has(command)) { var next = arguments.Get(command).Next; var p = next; while (true) { if (null == p || p.Equals("") || null == p.Next) { break; } if (p.ToString().Contains("subject")) { map.Add("subject", getSubstring(p)); } else if (p.ToString().Contains("From")) { map.Add("From", getSubstring(p)); } else if (p.ToString().Contains("ToRecipient")) { map.Add("ToRecipien", getSubstring(p)); } p = next; next = next.Next; } } return(map); }
public string execute(string [] args, bool isHash) { arguments = CommandLineArgumentParser.Parse(args); int EMLCount = 0; if (arguments.Has("-Time")) { EMLCount = searchByTime(args, isHash); } else { EMLCount = searchMail(args, isHash); } return(Util.getOutputstring(EMLCount)); }
void IsKeyArgument(CommandLineArgumentParser arguments, ref int valid) { if (arguments.StartWith("/key")) { if (arguments.Has("-d")) { if (EntityControl.Instance.MasterEntityControllIndex == 0) { Console.WriteLine("[无可操作实体]"); valid += 1; return; } CommandLineArgument node = arguments.Get("-d"); IntVector2 vector = IntVector2.Zero; int value = 0; string s1 = null; if (node != null) { s1 = node.Take(); if (s1 != null && !int.TryParse(s1, out value)) { value = 0; } } string s2 = null; if (s1 != null && node.Next != null) { s2 = node.Next.Take(); if (s2 != null && !IntVector2.TryParse(s2, out vector)) { vector = IntVector2.Zero; } } DriverOrderCode orderCode = new DriverOrderCode().SetTragerPoint(vector).SetValue(value).SetOrigin(EntityControl.Instance.MasterEntityControllIndex); OrderCmd cmd = OrderCmd.Instance(orderCode.ToBytes()); ControlModel.NetCtrl.WhenCollectCmd(cmd.ToBytes()); Console.WriteLine("[索引]" + orderCode.index + "[速度]" + orderCode.vector + "[旋转]" + orderCode.value + "[长度]" + cmd.ToBytes().Length); valid += 1; return; } Console.WriteLine("[无效指令]"); valid += 1; return; } else { return; } }
public List <SearchFilter> getSearchFilterList(string[] args) { List <SearchFilter> filterList = new List <SearchFilter>(); Dictionary <string, string> map = new Dictionary <string, string>(); arguments = CommandLineArgumentParser.Parse(args); if (arguments.Has("-SearchMail")) { map = getFilterMap("-SeaarchFilter"); if (map["subject"] != null && !map["subject"].Equals("")) { filterList.Add(Filters.filterBySubject(map["subject"])); } if (map["From"] != null && !map["From"].Equals("")) { filterList.Add(Filters.filterBySubject(map["From"])); } } return(filterList); }
void IsConnectArgument(CommandLineArgumentParser arguments, ref int valid) { if (arguments.StartWith("/connect")) { if (arguments.Has("-t")) { ServerInfo info = null; if (arguments.Has("-f")) { foreach (var item in NetControl.Instance.ServerInfoDic) { if (item.Value.isValid) { info = item.Value; NetControl.Instance.TryServerConnectTest(info); valid += 1; return; } } Console.WriteLine("未找到任何服务端"); valid += 1; return; } else { CommandLineArgument node = arguments.Get("-t"); if (node.Take() != null && node.Take() != "") { string ip = node.Take(); IPEndPoint point = UdpConfig.StrParseToIp(ip); if (point == null) { point = UdpConfig.DnsToIPEndPoint(ip); } if (point != null) { NetControl.Instance.TryServerConnectTest(point); valid += 1; return; } else { Console.WriteLine("无效的网络地址"); valid += 1; return; } } } if (info != null) { NetControl.Instance.TryServerConnectTest(info); } else { Console.WriteLine("未选择任何服务端"); } valid += 1; return; } if (arguments.Has("-c")) { ServerInfo info = NetControl.Instance.CurrentConnectHost; if (info != null) { NetControl.Instance.TryCanelConnectHost(); } else { Console.WriteLine("未连接任何服务端"); } valid += 1; return; } if (arguments.Has("-f")) { foreach (var item in NetControl.Instance.ServerInfoDic) { if (item.Value.isValid) { NetControl.Instance.TryConnectHost(item.Value); valid += 1; return; } } Console.WriteLine("未找到任何服务端"); valid += 1; return; } if (arguments.Has("-i")) { ServerInfo info = NetControl.Instance.CurrentConnectHost; if (info != null) { Console.WriteLine("[n]" + info.name + "[d]" + info.description + "[r]" + info.remote + "[is]" + info.isSync + ":" + NodeControl.Instance.LocalPlayer.serial + "" + "[ic]" + info.isConnect + "[iv]" + info.isValid + "[io]" + info.isOvertime + "[nc]" + info.currentConnectNodeCount + "[mc]" + info.maxConnectNodeCount + "[ot]" + (TimeControl.TickTime - info.lastTime) + "ms"); } else { Console.WriteLine("未连接任何服务端"); } valid += 1; } Console.WriteLine("输入参考:\n参数 -c 取消当前连接\n参数 -f 连接第一个有效的服务端\n参数 -i 查看当前连接信息\n参数 -t[address] 尝试获取服务端信息"); valid += 1; } else { return; } }