Code Monkey home page Code Monkey logo

fsc-inireader's Introduction

FSC-IniReader

New, better, easier ... The powerful crossplatform IniReader is back.

2.2.0 Early Access

What's new?

Big remake. Please use the namespace FSCIni.Future. The old namespace is automatically marked as obsolete. If you find any issue, please message me. More details on github.

  • Added custom datatypes like FSCIniTypes
  • Added new methods like ini1.Merge(ini2);
  • Upgrade to .Net 7

Example Code

using FSC_IniReader.Future;

FSCIni ini = @"
[AccountInfo]
Username = Jack
Password = JacksPassword1234

[Settings]
EnableDarkmode = true
RememberLogin = false
ProgramWidth = 720
ProgramHeight = 480
";

if (ini["Settings"]["ProgramWidth"].GetInt == 720)
{
    ini["Settings"]["ProgramWidth"] = 1080;
}

Console.WriteLine(ini.ToString());

Example Code 2

using FSC_IniReader.Future;

FSCIni ini = new FSCIni(@"
[AccountInfo]
Username = Jack
Password = JacksPassword1234

[Settings]
EnableDarkmode = true
RememberLogin = false
ProgramWidth = 720
ProgramHeight = 480
");

if (ini["Settings"]["ProgramWidth"].GetInt == 720)
{
    ini["Settings"]["ProgramWidth"] = 1080;
}

Console.WriteLine(ini.ToString());

Options

FSCIni got new options. Check out the constructor or the SetOptions Method

2.1.0

What's new?

  • Now ini files get delivered as a string.
    • That makes it possible to files in your own choice of encoding and you can add ini content into your source code.
  • The code is easier to use.
  • The script is shorter.
  • Upgrade to .Net6. + (Since 2.1.1 more targets supported)
  • Key value pairs (without section) will now be added to section [NULL]

How to use?

  1. Create an ini string by reading a file or write it directly into the source code.
  2. Create an instance of FSCIni with the ini parameter
using FSC_IniReader;

var content = "..."; // <- Ini file content

var ini = new FSCIni(content);
or
var ini = new FSCIni(content, new FSCIniOptions());
  1. Access the ini sections
ini["Section1"]
  1. Access the keys to get the values
ini["Section1"]["Key1"]

Methods:

Section:
FSCIniSection Add(string section);
bool Delete(string section);
bool HasSection(string section);
List<FSCIniSection> GetAllSections();
string ToString()
string ToString(bool minify);

KeyValues:
FSCIniKey Add(string key, string value);
bool Delete(string key);
bool HasKey(string key);
List<FSCIniKey> GetAllKeys();

FSCIniOptions contains some extended customize possibilities.


Some features are missing or you found a bug? Message me on discord, every idea is welcome: Discord -> Fabian#3563 (Don't message me for fun!)

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.