private void SendXml(string xml) { this.rtbResult.Clear(); xml = xml.Replace("##GUID", SDKClient.GetInstace().GetGUID()); SDKClient.GetInstace().SendXmlCmd(xml); this.rtbResult.AppendText("发送数据: \n" + xml + "\n\n"); xml = SDKClient.GetInstace().RecvXmlCmd(); this.rtbResult.AppendText("接收数据: \n" + xml + "\n\n"); }
private void RefreshFileList_Click(object sender, EventArgs e) { this.rtbResult.Clear(); string xml = XmlCmd.GetFiles(); xml = xml.Replace("##GUID", SDKClient.GetInstace().GetGUID()); SDKClient.GetInstace().SendXmlCmd(xml); this.rtbResult.AppendText("发送数据: \n" + xml + "\n\n"); xml = SDKClient.GetInstace().RecvXmlCmd(); this.rtbResult.AppendText("接收数据: \n" + xml + "\n\n"); this.LoadXmlToFileList(xml, this.RemoteList); }
private void Upload_Click(object sender, EventArgs e) { ArrayList files = new ArrayList(); foreach (ListViewItem item in UploadList.Items) { FileServices.FileSession session = new FileServices.FileSession(); session.name = item.SubItems[0].Text; session.size = Convert.ToInt64(item.SubItems[1].Text); if (item.SubItems[2].Text == "图片") { session.type = FileServices.HFileType.kImageFile; } else if (item.SubItems[2].Text == "视频") { session.type = FileServices.HFileType.kVideoFile; } else if (item.SubItems[2].Text == "字体") { session.type = FileServices.HFileType.kFont; } else if (item.SubItems[2].Text == "固件") { session.type = FileServices.HFileType.kFireware; } else if (item.SubItems[2].Text == "FPGA参数") { session.type = FileServices.HFileType.kFPGAConfig; } else if (item.SubItems[2].Text == "基本参数") { session.type = FileServices.HFileType.kSettingCofnig; } else { continue; } session.md5 = item.SubItems[3].Text; session.path = item.SubItems[4].Text; files.Add(session); } FileServices services = new FileServices(SDKClient.GetInstace(), files); services.SendFiles(); }
private void DeleteRomoteFile_Click(object sender, EventArgs e) { if (this.RemoteList.SelectedItems.Count == 0) { //说明没有行被选中 return; } ArrayList names = new ArrayList(); for (int i = 0; i < this.RemoteList.SelectedItems.Count; i++) { names.Add(this.RemoteList.SelectedItems[i].Text); } string xml = ""; string header = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<sdk guid=\"##GUID\">\n" + " <in method=\"DeleteFiles\">\n" + " <files>\n"; string end = " </files>\n" + " </in>\n" + "</sdk>\n"; int size = names.Count; string item = " <file name=\"##name\"/>\n"; string name = ""; for (int i = 0; i < size; i++) { name = item.Replace("##name", (string)names[i]); xml += name; } xml = header + xml + end; this.rtbResult.Clear(); xml = xml.Replace("##GUID", SDKClient.GetInstace().GetGUID()); SDKClient.GetInstace().SendXmlCmd(xml); this.rtbResult.AppendText("发送数据: \n" + xml + "\n\n"); xml = SDKClient.GetInstace().RecvXmlCmd(); this.rtbResult.AppendText("接收数据: \n" + xml + "\n\n"); }