2025年ini文件编码(ini文件怎么编写)

ini文件编码(ini文件怎么编写)nbsp 1 using nbsp System nbsp 2 using nbsp System Runtime InteropServi nbsp nbsp 3 using nbsp System Text nbsp nbsp 4 nbsp 5 namespace nbsp IPVOD Hotel Remoting nbsp 6 nbsp 7 nbsp nbsp nbsp nbsp nbsp lt



1技术分享using System;
2技术分享using System.Runtime.InteropServices;
3技术分享using System.Text;
4技术分享
5技术分享namespace IPVOD.Hotel.Remoting
6技术分享{
7技术分享    /// <summary>
8技术分享    /// INI文件的操作类
9技术分享    /// </summary>

10技术分享    public class IniFile
11技术分享    {
12技术分享        public string Path;
13技术分享
14技术分享        public IniFile(string path)
15技术分享        {
16技术分享            this.Path = path;
17技术分享        }

18技术分享        
19技术分享        声明读写INI文件的API函数
29技术分享
30技术分享        /// <summary>
31技术分享        /// 写INI文件
32技术分享        /// </summary>
33技术分享        /// <param name="section">段落</param>
34技术分享        /// <param name="key"></param>
35技术分享        /// <param name="iValue"></param>

36技术分享        public void IniWriteValue(string section, string key, string iValue)
37技术分享        {
38技术分享            WritePrivateProfileString(section, key, iValue, this.Path);
39技术分享        }

40技术分享
41技术分享        /// <summary>
42技术分享        /// 读取INI文件
43技术分享        /// </summary>
44技术分享        /// <param name="section">段落</param>
45技术分享        /// <param name="key"></param>
46技术分享        /// <returns>返回的键值</returns>

47技术分享        public string IniReadValue(string section, string key)
48技术分享        {
49技术分享            StringBuilder temp = new StringBuilder(255);
50技术分享
51技术分享            int i = GetPrivateProfileString(section, key, "", temp, 255, this.Path);
52技术分享            return temp.ToString();
53技术分享        }

54技术分享
55技术分享        /// <summary>
56技术分享        /// 读取INI文件
57技术分享        /// </summary>
58技术分享        /// <param name="Section">段,格式[]</param>
59技术分享        /// <param name="Key"></param>
60技术分享        /// <returns>返回byte类型的section组或键值组</returns>

61技术分享        public byte[] IniReadValues(string section, string key)
62技术分享        {
63技术分享            byte[] temp = new byte[255];
64技术分享
65技术分享            int i = GetPrivateProfileString(section, key, "", temp, 255, this.Path);
66技术分享            return temp;
67技术分享        }

68技术分享    }

69技术分享}

70技术分享
编程小号
上一篇 2025-03-08 10:27
下一篇 2025-02-28 19:30

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/bian-cheng-ri-ji/36371.html