using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace EastChanger
{
public static class sfj4Class
{
///
/// 保存Txt到服务器商
///
/// 接口调用数据
/// Txt地址
/// 接口返回数据
public static void SaveTxt(string Data, string path, string Result)
{
if (!Directory.Exists(Path.GetDirectoryName(path)))
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
}
StringBuilder sb = new StringBuilder();
sb.AppendLine("\r\n");
sb.AppendLine("----------------------调用接口所用JSon----------------------");
sb.AppendLine(Data);
sb.AppendLine("\r\n");
sb.AppendLine("----------------------调用接口返回JSon----------------------");
sb.AppendLine(Result);
FileStream fs = new FileStream(path, FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
fs.Position = fs.Length;
//开始写入
sw.Write(sb.ToString());
//清空缓冲区
sw.Flush();
//关闭流
sw.Close();
fs.Close();
}
}
}