[b][color=red]ServiceConfig.ini
文件内容:[/color]
[General][/b]
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
[b][color=red]主文件读取.ini文件内容[/color][/b][ 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();
文件内容:[/color]
[General][/b]
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
[b][color=red]主文件读取.ini文件内容[/color][/b][ 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();