/// <summary> /// 下载已签约/已存证文件 /// </summary> /// <param name="client"></param> /// <param name="contractId">合同编号</param> /// <param name="filePath">文件的保存路径</param> /// <returns></returns> public void Download(SDKClient client, string contractId, string filePath) { DownloadContractRequest request = new DownloadContractRequest(contractId); try { Stream outputStream = new MemoryStream(); client.Download(request, ref outputStream); MemoryStream memoryStream = (MemoryStream)outputStream; FileStream fs = new FileStream(filePath, FileMode.Create); BinaryWriter w = new BinaryWriter(fs); w.Write(memoryStream.ToArray()); fs.Close(); memoryStream.Close(); } catch (Exception e) { throw new Exception("取回文件失败,失败原因: " + e.Message); } }