public void Run(string command, string[] args, string text1, string text2, Bot serverBot) { if (Program.Importer.ImportThread != null) Program.Importer.ImportThread.Abort(); serverBot.SendChat("Canceled import."); }
public void ImportMBot(Bot client, short x, short y, short z) { if (!File.Exists("Imports\\" + ImportFile + ".mbot")) { client.SendChat("File not found."); return; } client.SendChat("Importing."); using (var sr = new StreamReader("Imports\\" + ImportFile + ".mbot")) sr.ReadToEnd().Split(new[] {'\n'}, StringSplitOptions.RemoveEmptyEntries); //ImportThread = new Thread(() => ImportMbotThread(BlockLines, Client, X, Y, Z)); //ImportThread.Start(); //ImportThread = new Thread(ImportMbotThread); //ImportThread.Start(BlockLines, Client, X, Y, Z); }
public void ImportMbotThread(string[] lines, Bot client, short baseX, short baseY, short baseZ) { foreach (string m in lines) { string[] mySplit = m.Split(','); int x, y, z, type; int.TryParse(mySplit[0], out x); int.TryParse(mySplit[1], out y); int.TryParse(mySplit[2], out z); int.TryParse(mySplit[3].Replace(":", ""), out type); if (type != 0) client.PlaceBlock(baseX + x, baseY + y, baseZ + z, (byte)type); } client.SendChat("Done importing."); }
public void Run(string command, string[] args, string text1, string text2, Bot serverBot) { if (args.Length > 0) serverBot.SendChat(text1.TrimStart(' ')); }
public void Run(string command, string[] args, string text1, string text2, Bot serverBot) { var dirInfo = new DirectoryInfo("Imports\\"); serverBot.SendChat("You have " + dirInfo.GetFiles().Length + " imports."); string importString = ""; foreach (FileInfo b in dirInfo.GetFiles()) importString += b.Name + ", "; serverBot.SendChat(importString.Substring(0, importString.Length - 2)); }
public void Run(string command, string[] args, string text1, string text2, Bot serverBot) { if (args.Length > 0) { if (!File.Exists("Imports\\" + args[0] + ".mbot")) { serverBot.SendChat("File not found."); return; } Program.Importer.ImportFile = args[0]; Program.Importer.Importing = true; serverBot.SendChat("Place an iron-ore marker to import."); } }