.INI file usage in C#
-
Is there support for using .ini files in C#? I can't seem to find it anywhere. Is there a substitute for this (I don't want to use the registry)? Thanks for your help! dpb Darryl Borden Principal IT Analyst darryl.borden@elpaso.com
-
Is there support for using .ini files in C#? I can't seem to find it anywhere. Is there a substitute for this (I don't want to use the registry)? Thanks for your help! dpb Darryl Borden Principal IT Analyst darryl.borden@elpaso.com
Darryl Borden wrote: Is there a substitute for this (I don't want to use the registry)? How about just using an XML file, I believe this is the "way" some apps are going now because it is so easy to work with them inside the Framework. Nick Parker
May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
-
Darryl Borden wrote: Is there a substitute for this (I don't want to use the registry)? How about just using an XML file, I believe this is the "way" some apps are going now because it is so easy to work with them inside the Framework. Nick Parker
May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
-
Is there support for using .ini files in C#? I can't seem to find it anywhere. Is there a substitute for this (I don't want to use the registry)? Thanks for your help! dpb Darryl Borden Principal IT Analyst darryl.borden@elpaso.com
Try to use this code in your app. //////////////////////////////////////////////////// public class IniFile { public string path; [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section,string key,string val,string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder retVal,int size,string filePath); public IniFile(string INIPath) { path = INIPath; } public void IniWriteValue(string Section,string Key,string Value) { WritePrivateProfileString(Section,Key,Value,this.path); } public string IniReadValue(string Section,string Key) { StringBuilder temp = new StringBuilder(255); int i = GetPrivateProfileString(Section,Key,"",temp,255,this.path); return temp.ToString(); } } ===================== http://wasp.elcat.kg
-
Here is an article that may help: Convert INI file to XML[^] Nick Parker
May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing