我试着往listbox里全部读取INI段。。。发现比起你的来我的效率弱爆了。
求 解决方案 您不会用的是指针吧……
---------------------------------------------------------------------------
private butLiseSec_Click()
{
——ClassDisposeINI a=new ClassDisposeINI ();//后面的那个引用过来
——int i = 0;
——int iMax=a.ReadFileSectionNumber (txtFilePath.Text );//获取总段数
——string cc = txtFilePath.Text;//INI路径
——listBox.Items.Clear();
——for (i=0; i <= iMax;i++ )
——{
————listBox.Items.Add(a.ReadSectionbyIndex(i, cc));
——}
}
ClassDisposeINI
------------------------------------------------------------------------------
public string ReadSectionbyIndex(int Index, string FilePath)
{
——string strBetween;//dim strBetween as string
——strBetween = strINI.Replace("\r\n[", "@").Split('@')[Index].Split (']')[0];
——return strBetween;
}
public int ReadFileSectionNumber(string FilePath)
{
——int strNumber;
——if (hasBeenReadin != 2)//判断是否重新读取文件
——{
————GetINIFile(FilePath);
——}
——strNumber = strINI.Replace("]\r\n", "@").Split('@').Length;
——return strNumber-1 ;
}
求 解决方案 您不会用的是指针吧……
---------------------------------------------------------------------------
private butLiseSec_Click()
{
——ClassDisposeINI a=new ClassDisposeINI ();//后面的那个引用过来
——int i = 0;
——int iMax=a.ReadFileSectionNumber (txtFilePath.Text );//获取总段数
——string cc = txtFilePath.Text;//INI路径
——listBox.Items.Clear();
——for (i=0; i <= iMax;i++ )
——{
————listBox.Items.Add(a.ReadSectionbyIndex(i, cc));
——}
}
ClassDisposeINI
------------------------------------------------------------------------------
public string ReadSectionbyIndex(int Index, string FilePath)
{
——string strBetween;//dim strBetween as string
——strBetween = strINI.Replace("\r\n[", "@").Split('@')[Index].Split (']')[0];
——return strBetween;
}
public int ReadFileSectionNumber(string FilePath)
{
——int strNumber;
——if (hasBeenReadin != 2)//判断是否重新读取文件
——{
————GetINIFile(FilePath);
——}
——strNumber = strINI.Replace("]\r\n", "@").Split('@').Length;
——return strNumber-1 ;
}