/// <summary> /// 解析XML /// </summary> /// <param name="north"></param> /// <returns></returns> public List <GofTask> GetAllTasks() { List <GofTask> list = new List <GofTask>(); foreach (XmlNode item in doc.DocumentElement.ChildNodes) { var task = GofTask.ParseXml(item.OuterXml); list.Add(task); } return(list); }
public void ListenClient() { //try //{ while (true) { if (Stop) { break; } try { TcpClient = TcpListener.AcceptTcpClient(); } catch (Exception ex) { ShowInfo(ex.Message); break; } TelCommand cmd = new TelCommand(TcpClient); list.Add(cmd); string info = "来自" + cmd.LocalEndPoint + ",命令:" + cmd.CmdStr + "\r\n"; ShowInfo(info); ShowInfo("开始执行任务...."); //解析并保存到当前目录 CurrentTask = GofTask.ParseXml(TelMsg.ParseXml(cmd.CmdStr).XmlContent); var localGofPath = SaveGofToLocal(CurrentTask); //开始执行 var pathes = new string[] { localGofPath }; this.AppendPathToTextBox(pathes); this.AddTasksAndRun(pathes); } //} //catch (Exception ex) //{ // if (!this.IsDisposed) // ShowInfo("运行错误:" + ex.Message); //} }