예제 #1
0
 /// <summary>
 /// 写入INI文件
 /// </summary>
 /// <param name="Section">项目名称(如 [TypeName] )</param>
 /// <param name="Key">键</param>
 /// <param name="Value">值</param>
 public static void ConfigWriteValue(string ConfigFilePath, string Section, string Key, string Value, bool ShouldEncrypt = false)
 {
     if (ShouldEncrypt)
     {
         Value = AESEncrypt.Encrypt(Value);
     }
     WritePrivateProfileString(Section, Key, Value, ConfigFilePath);
 }
예제 #2
0
        /// <summary>
        /// 读出INI文件
        /// </summary>
        /// <param name="Section">项目名称(如 [TypeName] )</param>
        /// <param name="Key">键</param>
        public static string ConfigReadValue(string ConfigFilePath, string Section, string Key, bool IsEncrypted = false)
        {
            StringBuilder temp = new StringBuilder(500);
            int           i    = GetPrivateProfileString(Section, Key, "", temp, 500, ConfigFilePath);

            if (IsEncrypted)
            {
                return(AESEncrypt.Decrypt(temp.ToString()));
            }

            return(temp.ToString());
        }