类似这种形式的ini文件
———————————————————————————————
[Loading]
background=UI\Loading\background.bmp
font=宋体[run]
font=黑体
————————————————————————————————如何用c#进行读取,改写的操作?改变各项的值
———————————————————————————————
[Loading]
background=UI\Loading\background.bmp
font=宋体[run]
font=黑体
————————————————————————————————如何用c#进行读取,改写的操作?改变各项的值
[run]
font=黑体
用正则来分析阿
using System.Runtime.InteropServices;
声明 [DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
进行操作
参考
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32.dll")] //读INI
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);参数应该能看懂是什么意思吧。