夜间模式暗黑模式
字体
阴影
滤镜
圆角
主题色
C# 配置文件操作(*.ini)
class Ini
    {
        [System.Runtime.InteropServices.DllImport("kernel32", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="section"></param>
        /// <param name="key"></param>
        /// <param name="def">没有找到对应值时返回的值</param>
        /// <param name="retVal">String.Builder获取读取到的值</param>
        /// <param name="size"></param>
        /// <param name="filePath"></param>
        /// <returns></returns>
        [System.Runtime.InteropServices.DllImport("kernel32", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        private static extern int GetPrivateProfileString(string section, string key, string def, System.Text.StringBuilder retVal, int size, string filePath);
        
        string ConfPath;
        public Ini(string path)
        {
            ConfPath = path;
        }
        public bool Write(string section, string key, string value)
        {
            if (WritePrivateProfileString(section, key, value, ConfPath) != 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public string Read(string section,string key)
        {
            StringBuilder temp = new StringBuilder(255);
            GetPrivateProfileString(section, key, "", temp, 255, ConfPath);
            return temp.ToString();
        }
    }

评论

  1. Mk7

    大神 你分享的网易音乐下载器 很好用 非常感谢

    4周前
    2020-3-16 23:32:45

发送评论 编辑评论


				
上一篇
下一篇