//
Using system;
Using system.io;
Using system.Runtime.InteropServices;
Using system.text;
Namespace echoncomponentlibrary
{
///
/// inIfile's summary description.
/// summary>
Public class inIfile
{
// Write ini files
[DLLIMPORT ("kernel32")]]
Private Static Extern Bool WritePrivateProfileString (String Section, String Key, String Val, String Filepath);
// read the INI file (character
[DLLIMPORT ("kernel32")]]
Private static extern int GETPRIVATEPROFILESTRING (String Section, String Key, String DEF, STRINGBUILDER RETVAL, INT SIZE, STRING FILEPATH);
// Read Ini file (number
[DLLIMPORT ("kernel32")]]
Private static extern int GETPRIVATEPROFILEINT (String Section, String Key, INT DEF, STRING FILEPATH);
Private string ffilename;
[DLLIMPORT ("kernel32")]]
Private static extern int GETPRIVATEPROFILINT
String lpappname,
String LpKeyname,
Int ndefault,
String lpfilename
);
[DLLIMPORT ("kernel32")]]
Private static extern int getPrivateProfileString
String lpappname,
String LpKeyname,
String lpdefault,
StringBuilder LPRETURNEDSTRING,
Int nsize,
String lpfilename
);
[DLLIMPORT ("kernel32")]]
Private static extern bool writeprivateprofilestring (
String lpappname,
String LpKeyname,
String lpstring,
String lpfilename
);
Public inIfile (String filename)
{
FFileName = filename;
}
Public int Readint (String Section, String Key, INT DEF)
{
Return GetPrivateProfileint (Section, Key, DEF, FFileName);
}
Public String ReadString (String Section, String Key, String DEF)
{
StringBuilder Temp = New StringBuilder (1024);
GetPrivateProfileString (Section, Key, DEF, TEMP, 1024, FFileName);
Return Temp.toString ();
}
Public void WriteInt (String Section, String Key, IVAL) {
WritePrivateProfileString (Section, Key, IVAL.TOSTRING (), FFileName;
}
Public void Writestring (String Section, String Key, String Strig)
{
WritePrivateProfileString (Section, Key, Strval, FFileName);
}
Public void Delkey (String Section, String Key)
{
WritePrivateProfileString (Section, Key, Null, FFileName);
}
Public Void DELSECTION (STRING Section)
{
WritePrivateProfileString (Section, Null, Null, FFileName);
}
}
}