bmatzelle / nini Goto Github PK
View Code? Open in Web Editor NEWAn uncommonly powerful .NET configuration library
License: Other
An uncommonly powerful .NET configuration library
License: Other
After a few tests I found a small bug in your current version in the "OrderedList.cs" file in a public property named "public object this[object key]".
In the "set" branch is the following code line:
table[IndexOf(key)] = new DictionaryEntry(key, value);
but I found out it has to be:
list[IndexOf(key)] = new DictionaryEntry(key, value);
because otherwise it never will assign the new value to the ArrayList if you want to set a key via
keys[key] = some_new_value;
Hi there!
I have absolutely no idea if this library is still being maintained or not, so bear with me...
I've stumbled across Nini inside the source code of an 'old' project, OpenSimulator โ started around 2007 and with continued ongoing development to this day โ where most (if not all) configuration files are, in a way or another, formatted using Nini's XML, since that's the ubiquitously used library in many of its subsystems and tools, very likely because, well, there was nothing else available back then ๐
In order to parse all those XML configuration files, I'd love to know if there was ever an officially developed DTD, or, even better, a XML Schema, which could be used for validation purposes. I'm aware that the format is reasonably simple and straightforward (therefore it should be even easier to parse with a DTD/XSD!); nevertheless, going through the source code here, I couldn't find a reference to any such file.
I'm just asking!... obviously, I can try to write my own DTD from scratch (and with a little patience, even the XSD...), but, of course, if there were an official source for such a document, it could be simply placed as a link to be fetched during validation...
Thanks in advance for any insights! And remember: this is a very low priority 'request', I'm not expecting an answer 'soon'.
We have a desktop application that reads and writes numerous ini files that contain dates and numbers in UK format (en-GB). If we run the application on (say) a French PC then IConfig.GetDouble() throws a FormatException because it can't parse values in the file such as "1.23" (because the French use "," as the decimal point character). The nature of the app means we can only supply these ini files in UK format, and can't (for example) provide French customers with ini files that have been formatted to their locale.
As a workaround, I have found that I if I set the CurrentCulture to "en-GB" just before instantiating the IniConfigSource object, then back to the PC's region (e.g. French) right after creation, then I am able to read and write the file regardless of what the CurrentCulture is. I'm not sure how this is possible, but am assuming IniConfigSource stores the culture at the moment of its creation, then uses this during all read and write operations?
I was wondering if there is a more elegant solution to the above? It perhaps would have been nice if the IniConfigSource had a constructor overload to pass in a CultureInfo object, to effectively tell it the culture of the file's contents.
I'd also like to know if there is something I'm missing, or some aspect of the above workaround that is is likely to bite me in the future!
Edit: looks like this line in ConfigSource is what enables my workaround to work, presumably picking up the current culture at the moment of instantiation?
IFormatProvider format = NumberFormatInfo.CurrentInfo;
Edit2: looks like this workaround only helps when reading files. When writing, numbers and dates are always written using the current culture.
There are some "unofficial" NuGet packages for Nini, but having "official one" could greatly promote Nini use in various kinds of projects, and possibly draw more contributors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.