jeevanjames / inifile Goto Github PK
View Code? Open in Web Editor NEW.NET library to open, modify and save .INI files
License: Apache License 2.0
.NET library to open, modify and save .INI files
License: Apache License 2.0
I've tried to read only a time from Ini, but I get an exception that DateValue cannot be created from that string. Maybe the new classes DateOnly and TimeOnly should be added to the converting routines.
I assume i have ini content as follow:
//////////
[tcp]
ip = localhost
/////////
then read the file:
string iniStr = File.ReadAllText(path);
Ini ini = Ini.Load(iniStr)
then how to get property value of "ip" , thanks
By the way , when i use "Ini ini = new ini(file)" to load ini file , there is always error : can't reference null object. im sure the file is at the right folder. can you give a hint ?
The lib itself works very well, but can I get at least key matching be case insensitive? And even section matching?
[sEcTiOn]
vAlUe = 1
Can this be read via ini["Section"]["Value"] somehow?
I was curious if there are any plans to support .netcore 3.1?
Hello, I have some problems during use.
(1) Property Name Key under the same Section is not unique?
(2) Calling the SaveToAsync function threw an exception.
Can you help me with my doubts? thanks
`
var ini = new Ini()
{
new Section("SectionName")
{
new Property("PropertyName_1", "A string value"),
new Property("PropertyName_2", 10),
new Property("PropertyName_2", DateTime.Now) // Property Name Key Not Unique ?
}
};
string desktopDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string filePath = Path.Combine(desktopDirectory, "TestIni.ini");
using var writer = new StreamWriter(filePath, false, Encoding.UTF8);
ini.SaveToAsync(writer); // System.InvalidOperationException : The stream is currently in use by a previous operation on the stream.
`
Currently, when accessing a section through the indexer syntax, if the section does not exist, a KeyNotFoundException
exception is thrown. The existence of the section must be first checked before attempting to access a property in it:
string value = "default value";
if (ini.TryGetValue("section", out var section))
value = section["property"];
To support the C# 6 null conditional operator, the section indexer should return null
if the section is not found.
This will allow for the following syntax:
string value = ini["section"]?["property"];
Hi all,
I wanted to use the library to read desktop.ini and .url files that may contain information that targets Windows Search (metadata on folders and links) which uses guid's as section names but the library fails to read them:
MethodInvocationException: Exception calling ".ctor" with "1" argument(s): "An unrecognized line was encountered in the INI content.
[{64440492-4C8B-11D1-8B70-080036B11A03}]"
I also wanted to use it to read git repository config files but this fails also:
MethodInvocationException: Exception calling ".ctor" with "1" argument(s): "An unrecognized line was encountered in the INI content.
[remote "origin"]"
Have a nice day,
Scal
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.