public String PostFile2Server() { String filefullPath = file.mFileFullPath; StringBuilder FullUrl = new StringBuilder(); FullUrl.Append(GetAppConfig("URL_POST_FILE")); FullUrl.Append("?LoginID=zhangxiaochen"); FullUrl.Append("&Password=123123"); FullUrl.Append("&FileName=" + HttpUtility.UrlEncode(file.GetFileName(), Encoding.UTF8)); FullUrl.Append("&PrinterCopies=" + file.PParamcopies.ToString()); FullUrl.Append("&PrinterColor=" + ((file.PParamcolor == true) ? 1 : 0).ToString()); FullUrl.Append("&PrintPaperSize=A4"); FullUrl.Append("&PrintRange=" + file.PParamRange); FullUrl.Append("&PrinterIsDuplex=" + ((file.PParam2Paper == true)?1:0).ToString()); FullUrl.Append("&WifiMac=" + LibCui.GetWifiMacAddress()); FullUrl.Append("&PrinterMachineMac=" + LibCui.GetLocalMacAddress()); FullUrl.Append("&MachineBrand=" + HttpUtility.UrlEncode(file.GetPrinterName(), Encoding.UTF8)); FullUrl.Append("&MachineType=" + HttpUtility.UrlEncode(file.GetPrinterName(), Encoding.UTF8)); FullUrl.Append("&Latitude=" + "0"); FullUrl.Append("&Logitude=" + "0"); return(this.HttpPostFile(FullUrl.ToString(), filefullPath)); }
private byte[] GetNotifyMessageXml(bool IsMulity) { byte[] buf = null; XmlDocument doc = new XmlDocument(); XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "UTF-8", null); doc.AppendChild(dec); XmlElement root = doc.CreateElement("CloudPrint"); XmlNode node = doc.CreateElement("Notify"); XmlElement elementPort = doc.CreateElement("Port"); if (this.mTCPServer == null) { elementPort.InnerText = "10001"; } else { elementPort.InnerText = ((IPEndPoint)(this.mTCPServer.LocalEndPoint)).Port.ToString(); } node.AppendChild(elementPort); XmlElement elementHostType = doc.CreateElement("HostType"); elementHostType.InnerText = "1"; node.AppendChild(elementHostType); XmlElement elementHostName = doc.CreateElement("HostName"); elementHostName.InnerText = "pc"; node.AppendChild(elementHostName); XmlElement elementPhoneType = doc.CreateElement("PhoneType"); elementPhoneType.InnerText = "n"; node.AppendChild(elementPhoneType); XmlElement elementPcName = doc.CreateElement("PcName"); elementPcName.InnerText = Dns.GetHostName(); node.AppendChild(elementPcName); XmlElement elementPhoneNameAlias = doc.CreateElement("PhoneNameAlias"); elementPhoneNameAlias.InnerText = "n"; node.AppendChild(elementPhoneNameAlias); { XmlElement element = doc.CreateElement("MachineMac"); element.InnerText = LibCui.GetLocalMacAddress(); node.AppendChild(element); } XmlElement elementMultiply = doc.CreateElement("Multiply"); if (IsMulity) { elementMultiply.InnerText = "true"; } else { elementMultiply.InnerText = "false"; } node.AppendChild(elementMultiply); root.AppendChild(node); doc.AppendChild(root); buf = Encoding.UTF8.GetBytes(doc.InnerXml); // doc.Save("Notify.xml"); return(buf); }