[GENERAL]
CUSTOMER = PLANETYOGA
DATABASE =C:\FoxternIVR\DIAL.MDB[CONFIG]
GREETINGMSG = C:\FoxternIVR\greeting.wav
ATTEMPT=1
LINEINGRP=1-4
ISPREFIX=N
PREFIX=9
CRITERIA=WHERE GetDigits <> '9'
HUNTINGRP=921055255ini文件如下

解决方案 »

  1.   

    用kernel32中 getprivateprofileint和getprivateprofilestring,getprivateprofilesection实现
      

  2.   

    using System.Runtime.InteropServices;
    using System.Text;public class IniFile { public string path;    //INI文件名 [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);
    //声明读写INI文件的API函数      public IniFile(string INIPath) { path = INIPath; }//类的构造函数,传递INI文件名 public void IniWriteValue(string Section,string Key,string Value) { WritePrivateProfileString(Section,Key,Value,this.path); }//写INI文件          public string IniReadValue(string Section,string Key) { StringBuilder temp = new StringBuilder(255); int i = GetPrivateProfileString(Section,Key,"",temp,255,this.path); return temp.ToString(); }//读取INI文件指定 }
      

  3.   


    StreamReader sr = new StreamReader("settings.ini");
                        string input = null;
                        IDictionary<string, string> paramValues = new Dictionary<string, string>();
                        while ((input = sr.ReadLine()) != null)
                        {
                            string[] param = input.Split('=');
                            if (param.Length == 2)
                            {
                                paramValues.Add(param[0].TrimStart(' ').TrimEnd(' '), param[1].TrimStart(' ').TrimEnd(' ').TrimEnd(';').TrimStart('"').TrimEnd('"'));
                            }
                        }
                        sr.Close();