英文字幕,巨齿蛉,林志颖老婆陈若仪资料
/// <summary>
/// 读取数据,并以txt格式保存
/// </summary>
/// <param name="data">数据源,文件内容</param>
/// <param name="sort">文件夹名称</param>
public static string savaprocess(string data,string sort)
{
if (!string.isnullorempty(data))
{
system.datetime currenttime = system.datetime.now;
//获取当前日期的前一天转换成tofiletime
string strymd = currenttime.tostring("yyyymmddhhmmssfff");
//按照日期建立一个文件名
string filename = strymd + ".txt";
//获取当前项目所在磁盘
string curdir = system.windows.forms.application.startuppath.substring(0, system.windows.forms.application.startuppath.indexof(':')) + ":\\" + @"savedir";
//判断路径是否存在
if (!system.io.directory.exists(curdir))
{
system.io.directory.createdirectory(curdir);
}
string name =curdir+"\\"+@""+sort+"";
if(!system.io.directory.exists(name))
{
system.io.directory.createdirectory(name);
}
curdir = name;
//不存在就创建
string filepath = curdir + "\\" + filename;
////文件覆盖方式添加内容
system.io.streamwriter file = new system.io.streamwriter(filepath, false);
//保存数据到文件
file.write(data);
//关闭文件
file.close();
//释放对象
file.dispose();
return filepath;
}
else
{
return "";
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论