E3.Utility/UtilityINI.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Collections;
using System.Collections.Specialized;
using System.Text.RegularExpressions;
namespace E3.Utility
{
public class UtilityINI
{
public string FileName; //INI文件名
//声明读写INI文件的API函数
[DllImport("kernel32")]
private static extern bool WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, byte[] retVal, int size, string filePath);
//[DllImport("MesInifile.dll")]
//private static extern int WriteInifile(string filePath, string section, string key, string val, string message);
//类的构造函数,传递INI文件名
public UtilityINI(string AFileName)
{
// 判断文件是否存在
FileInfo fileInfo = new FileInfo(AFileName);
//Todo:搞清枚举的用法
if ((!fileInfo.Exists))
{ //|| (FileAttributes.Directory in fileInfo.Attributes))
//文件不存在,建立文件
System.IO.StreamWriter sw = new System.IO.StreamWriter(AFileName, false, System.Text.Encoding.Default);
try
{
sw.Write("#表格配置档案");
sw.Close();
}
catch
{
throw (new ApplicationException("Ini文件不存在"));
}
}
//必须是完全路径,不能是相对路径
FileName = fileInfo.FullName;
}
//写INI文件(用祝瑞提供cvi的dll)
//public void WriteStringByCvi(string Section, string Ident, string Value)
//{
// string message = string.Empty;
// if (WriteInifile(FileName, Section, Ident, Value, message) == 0)
// {
// throw (new ApplicationException("写Ini文件出错."));
// }
//}
/// <summary>
/// 删除文本文件指定行
/// </summary>
/// <param name="deleteLineIndex"></param>
后面还有 199 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。