static void Main(string[] args) { Setting.LoadDefault(); if (args.Length > 0) { string host = String.Empty; foreach (string param in args) { if (param.StartsWith("host:")) { host = param.Replace("host:", ""); } } List <string> chat = new List <string>(); chat.AddRange(File.ReadAllText(Setting.chatlist, Encoding.UTF8).Split('\n')); Content.SetServerIP(host); ServerInfo info = new ServerInfo(Content.ServerIP, Content.ServerPort); if (info.StartGetServerInfo()) { Bot.tBotsTask_a s = new Bot.tBotsTask_a(info, Setting.name, Setting.threads, chat); s.newTask(); } } else { Content.Start(); } }
internal MinecraftBot(string host, int port, string username, int protocolver, ForgeInfo forge, tBotsTask_a s) { ProtocolVersion = protocolver; Host = host; Port = port; forgeInfo = forge; bots = s; if (username != null) { playername = username.Replace("%RANDOM%", randomName()); } }
public static void Init() { try { SetServerIP(); Console.WriteLine("测试方案:"); Console.WriteLine("1:(代理)Proxy-Bots 并发测试."); int Method = int.Parse(Console.ReadLine()); List <string> chat = new List <string>(); ServerInfo info = new ServerInfo(ServerIP, ServerPort); if (info.StartGetServerInfo()) { int protocol = info.ProtocolVersion; PrintServerInfo(info, ref protocol); Helper.WriteLogs(info.ServerIP, info.ServerPort, info.GameVersion, Setting.threads); switch (Method) { case 1: chat.AddRange(File.ReadAllText(Setting.chatlist, Encoding.UTF8).Split('\n')); Bot.tBotsTask_a s_a; if (Setting.protocol == 0) { s_a = new Bot.tBotsTask_a(info, Setting.name, Setting.threads, chat, protocol); } else { s_a = new Bot.tBotsTask_a(info, Setting.name, Setting.threads, chat, Setting.protocol); } s_a.newTask(Setting.cooldown); break; default: Console.WriteLine("未提供相应方案,请重新选择"); Init(); break; } } else { Console.WriteLine("取服务器信息失败,请重试.."); Program.Exit(); } }catch (Exception e) { Console.WriteLine(e.Message); } }
private static void Debug()//仅用于调试程序 { string host = "127.0.0.1"; int port = 25565; string username = "******"; int thread = 500; List <string> chat = new List <string>(); chat.Add("仅供测试!"); ServerInfo info = new ServerInfo(host, port); if (info.StartGetServerInfo()) { Bot.tBotsTask_a s = new Bot.tBotsTask_a(info, username, thread, chat); s.newTask(); } }