public override void OnPost(HttpRequest request, HttpResponse response, string SavePath, string FileName) { string UnpackTarPath = ""; string FileSavePath = SavePath + "\\" + FileName; UnpackTarPath = sUnTarPath + "\\" + FileName.Split('.')[0]; if (File.Exists(FileSavePath)) { if (!Directory.Exists(UnpackTarPath)) { Directory.CreateDirectory(UnpackTarPath); } TarHelper tar = new TarHelper(); tar.DeleteFolder(UnpackTarPath); tar.UnpackTarFiles(FileSavePath, UnpackTarPath); string[] xmlfilenames = Directory.GetFiles(UnpackTarPath, "*.xml");//从解压XML文件夹下获取解压的XML文件名 string sTmpFile = string.Empty; string sAnalysisFileName = ""; string sSignFileName = ""; for (int i = 0; i < xmlfilenames.Length; i++) { sTmpFile = Path.GetFileName(xmlfilenames[i]); if (sTmpFile.ToUpper().IndexOf("EBDB") > -1 && sTmpFile.ToUpper().IndexOf("EBDS_EBDB") < 0) { sAnalysisFileName = xmlfilenames[i]; } //else if (sTmpFile.ToUpper().IndexOf("EBDS_EBDB") > -1)//签名文件 //{ // sSignFileName = xmlfilenames[i];//签名文件 //} } EBD ebd = null; try { using (FileStream fstream = new FileStream(sAnalysisFileName, FileMode.Open)) { StreamReader sr = new StreamReader(fstream, System.Text.Encoding.UTF8); String xmlInfo = sr.ReadToEnd(); xmlInfo = xmlInfo.Replace("xmlns:xs", "xmlns"); sr.Close(); xmlInfo = XmlSerialize.ReplaceLowOrderASCIICharacters(xmlInfo); xmlInfo = XmlSerialize.GetLowOrderASCIICharacters(xmlInfo); ebd = XmlSerialize.DeserializeXML <EBD>(xmlInfo); } IniFiles serverini = new IniFiles(StartupPath + "\\Config.ini"); CombineXML cx = new CombineXML(serverini); string strHBRONO = serverini.ReadValue("INFOSET", "HBRONO"); //实体编号 Random rd = new Random(); // string fName = "10" + rp.sHBRONO + "00000000000" + rd.Next(100, 999).ToString(); string fName = "10" + strHBRONO + "0000000000000" + rd.Next(100, 999).ToString(); XmlDocument xmlDoc = cx.CombineResponse(ebd, "EBDResponse", fName); string xmlSignFileName = "\\EBDB_" + fName + ".xml"; string BeXmlFilesPath = serverini.ReadValue("FolderSet", "BeXmlFileMakeFolder"); tar.DeleteFolder(BeXmlFilesPath);//新增20180816 cx.CreateXML(xmlDoc, BeXmlFilesPath + xmlSignFileName); //进行签名 string m_UsbPwsSupport = serverini.ReadValue("USBPSW", "USBPSWSUPPART"); Attestation Attestation = new Attestation(); // TarHelper tar = new TarHelper(); // ServerForm.mainFrm.AudioGenerateSignatureFile(ServerForm.strBeSendFileMakeFolder,"EBDI",fName); // Attestation.GenerateSignatureFile(m_UsbPwsSupport, SendFilePath, fName, StartupPath + "\\Config.ini"); 测试注释 20180814 tar.CreatTar(serverini.ReadValue("FolderSet", "BeXmlFileMakeFolder"), SendFilePath, fName);//使用新TAR string sSendTarName = SendFilePath + "\\EBDT_" + fName + ".tar"; response.SendNew(sSendTarName); } catch (Exception ex) { HttpModel.Log.Instance.LogWrite("异常:" + ex.Message); } } }