Hl.Code/TextHelper.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Text;
using System.IO;
using System.Web;
namespace Hl.Code
{
/// <summary>
/// txt文件操作
/// </summary>
public class TextHelper
{
/// <summary>
/// 读取文件
/// </summary>
public static string SelectText(string filePath, bool isReadLine)
{
string returnInfo = "";
#region "处理"
try
{
filePath = HttpContext.Current.Server.MapPath(filePath);
if (File.Exists(filePath))
{
string strInput = "";
StreamReader sr = new StreamReader(filePath, UnicodeEncoding.GetEncoding("gb2312"));
strInput = sr.ReadLine();
while (strInput != null)
{
returnInfo += strInput + (isReadLine ? "\r\n" : "");
strInput = sr.ReadLine();
}
sr.Close();
}
else
{
returnInfo = "";
}
}
catch { }
#endregion
return returnInfo;
}
/// <summary>
/// 创建text
/// </summary>
public static void CreateText(string filePath, string txtString)
{
FileStream fs = null;
try
{
filePath = HttpContext.Current.Server.MapPath(filePath);
if (File.Exists(filePath))
{
fs = new FileStream(filePath, FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
sw.WriteLine(txtString);
sw.Flush();
sw.Close();
后面还有 27 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
