Giter VIP home page Giter VIP logo

inifile's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar jeevanjames avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

inifile's Issues

DateOnly and TimeOnly

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.

How to get /update specified property of one section

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 ?

Keys case insensitive

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?

Calling the SaveToAsync function threw an exception

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.

`

Add support for null conditional operator

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"];

Cannot read desktop.ini, url files or git config

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.