Registry vs. INI file for storing user configurable application settings. In Linux, registry vs. INI file for storing user configurable applications settings.
static void Parse()
{
StreamReader tr = new StreamReader("config.ini");
string line;
Dictionary<string, string> config = new Dictionary<string, string>();
while ((line = tr.ReadLine()) != null)
{
// Allow for comments and empty lines.
if (line == "" || line.StartsWith("#"))
continue;
string[] kvPair = line.Split("=");
// Format must be option = value.
if (kvPair.Length != 2)
continue;
// If the option already exists, it"s overwritten.
config[kvPair[0].Trim()] = kvPair[1].Trim();
}
}
Tags: windows registry settings ini configuration-files
Source: By Kurt W. Leucht as answer to the question
This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 2.5
Related code-snippets:
- Embedding Windows Media Player for all browsers. Will help in making it portable.
- Register Windows program with mailto protocol programmatically.
- How do I see preview JPEG file of PDF on Windows?
- What are the best ways to access Exchange using PHP?
- Visual Studio Setup Project - Per User Registry Settings.
- What is the best file copy alternative than the Windows defaults?
- How can I retrieve a windows filename?
- How do I install Debian in Windows?
- How do I set up crontab to execute in specific time?
- Windows Equivalent of 'nice'.
- How do you create your own moniker (URL Protocol) on Windows systems?
- How can I redirect stderr from calls to fprintf?
- How do I wrap RSYNC for Windows?
- How can I obtain good concurrent read performance from disk?
- Why do programs choose to select different files in windows explorer?