2008-04-15

net 读取ini文件

ServiceConfig.ini
文件内容:

[General]

StationLine=DL1
StationGroup=EMKAU
StationId=EMKAU11
Section=Emilie_Connection
Printer=FinePrint
CultureInfo=zh-TW

[Emilie_Connection]
srvAddress = tcp://172.1.5.2:2103/RoutingObject.Routing

主文件读取.ini文件内容[ DllImport ( "kernel32" ) ]
private static extern int GetPrivateProfileString ( string section ,string key , string def , StringBuilder retVal ,int size , string filePath ) ;
StringBuilder temp = new StringBuilder ( 255 ) ;
GetPrivateProfileString("General", "Section", "", temp, 255, configFilePath);
section = temp.ToString();
GetPrivateProfileString("General", "StationLine", "", temp, 255, configFilePath);
lineID = temp.ToString();
temp.Remove(0, temp.Length);
GetPrivateProfileString("General", "StationGroup", "", temp, 255, configFilePath);
STATION_GROUP_NAME = temp.ToString();
temp.Remove(0, temp.Length);
GetPrivateProfileString("General", "StationId", "", temp, 255, configFilePath);
STATION_ID = temp.ToString();
评论
发表评论

提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则

您还没有登录,请登录后发表评论

心似海
搜索本博客
博客分类
最近加入圈子
存档
最新评论