using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;  //api
using System.Windows.Forms;

namespace DL580_9130
{
    class inifile
    {
        [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);
        [DllImport("kernel32")]
        private static extern bool Beep(int freq, int duration);
        
        public static  bool save=false ;
        public static  bool onlyone=false ;

        public static void Writeini(string Section, string Key, string Value) //写INI文件
        {
            string inipath = Application.StartupPath + "\\Rconfig.ini";
            WritePrivateProfileString(Section, Key, Value, inipath);
        }
        public  static string Readini(string Section, string Key)       //读INI文件
        {
            string inipath = Application.StartupPath + "\\Rconfig.ini";
            StringBuilder temp = new StringBuilder(500);
            int i = GetPrivateProfileString(Section, Key, "", temp, 500, inipath);
            return temp.ToString().Trim();
        }
    }
}
