1.初始化项目。保险起见bin目录完整提交 2.基于现场代码为调整过的初始项目(此次提交还未解决代码差异问题)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
public class FileRW
|
||||
{
|
||||
[DllImport("kernel32")]
|
||||
public static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
|
||||
[DllImport("kernel32")]
|
||||
public static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// 读取INI文档
|
||||
/// </summary>
|
||||
/// <param name="Section">区段名</param>
|
||||
/// <param name="Key">键</param>
|
||||
/// <param name="file">文件路径</param>
|
||||
/// <returns>Value</returns>
|
||||
public static string ReadIniValue(string Section, string Key, string file)
|
||||
{
|
||||
StringBuilder _temp = new StringBuilder(1024);
|
||||
GetPrivateProfileString(Section, Key, "", _temp, 1024, file);
|
||||
return _temp.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// 写入INI文档
|
||||
/// </summary>
|
||||
/// <param name="Section">区段名</param>
|
||||
/// <param name="Key">键</param>
|
||||
/// <param name="value">Value</param>
|
||||
/// <param name="file">文件路劲</param>
|
||||
public static long WriteIniValue(string Section, string Key, string value, string file)
|
||||
{
|
||||
long rtu = WritePrivateProfileString(Section, Key, value, file);
|
||||
return rtu;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user