/// <summary>
/// 获取配置文件各节名称
/// </summary>
/// <param name="FileName">配置文件路径</param>
/// <returns>各节名称数组 如无节则返回null</returns>
/// <remarks>利用读取配置文件,采用正则表达式(\[.+?\])逐行分析</remarks>
public static string[] GetSectionNames(string FileName) {
string[] ret = null;
string iniContent = KEVIN.IO.FileBase.ReadFile(FileName);
System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex(@"\[.+?\]");
System.Text.RegularExpressions.Match ma = re.Match(iniContent);
string val = "";
while (ma.Success)
{
if (val != "") val += "|";
val += ma.Value.Replace("[", "").Replace("]", "");
ma = ma.NextMatch();
}
if (val != "") {
ret = val.Split('|');
}
return ret;
}