JieRuntime.Ini 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package JieRuntime.Ini --version 1.0.4                
NuGet\Install-Package JieRuntime.Ini -Version 1.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JieRuntime.Ini" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JieRuntime.Ini --version 1.0.4                
#r "nuget: JieRuntime.Ini, 1.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install JieRuntime.Ini as a Cake Addin
#addin nuget:?package=JieRuntime.Ini&version=1.0.4

// Install JieRuntime.Ini as a Cake Tool
#tool nuget:?package=JieRuntime.Ini&version=1.0.4                

<p align="center"> <img width="100px" src="https://avatars.githubusercontent.com/u/39112172?v=4" align="center" alt="JieRuntimeNet.Ini" /> <h2 align="center">JieRuntimeNet.Ini</h2> </p> <p align="center"> <p align="center"> <a href="https://www.nuget.org/packages/JieRuntime.Ini"> <img alt="Nuget" src="https://img.shields.io/nuget/v/JieRuntime.Ini?label=Nuget"> </a> <a href="../LICENSE"> <img alt="GitHub" src="https://img.shields.io/github/license/Jie2GG/JieRuntimeNet"> </a> <br/> <a href="https://github.com/Jie2GG/JieRuntimeNet/issues">报告 Bug</a> · <a href="https://github.com/Jie2GG/JieRuntimeNet/issues">请求增加功能</a> </p> </p> <p align="center">喜欢这个项目?给我点个Star吧!

关于项目

JieRuntime.Ini 是基于 .NET 平台的一款跨平台 ini 配置项处理工具类, 该工具能快速实现 ini 配置文件的增删改查, 轻松分离 ini 配置文件中的 "节"、"键"、"值" 和 "注释", 大量使用了 .NET 平台的特性, 使其更易于使用.

快速开始

本运行库基于 .net standard 2.0 构建, 可以在支持 .net standard 2.0 依赖的任意项目上引用本运行库. 你可以在 Nuget 上搜索 JieRuntime.Ini 来安装本运行库.

Demo

  1. 创建一个新的配置项
    // 指定文件路径, 默认使用 UTF8 编码
    IniConfiguration ini = new IniConfiguration (文件路径);
    // 指定文件路径, 指定文件的编码
    IniConfiguration ini = new IniConfiguration (文件路径, 文件编码);
  1. 从现有的配置项读取文件
    // 创建对象时指定了文件路径, 因此直接读取
    ini.Load ();
  1. 增加配置
    // 增加 "节"
    ini.Configuration.Add (new IniSection ("Section1"));
    // 增加 "键值"
    ini.Configuration["Section1"].Add ("key1", value);

    // 如果 Section1 或 Key1 不存在会自动创建
    ini.Configuration["Section1"]["Key1"] = value;
  1. 删除配置
    // 删除 "节"
    ini.Configuration.Remove ("Section1");

    // 删除 "键值"
    ini.Configuration["Section1"].Remove ("Key1");
  1. 修改配置
    // 修改 "节"
    // 无论传入的 IniSection 对象的 Name 是何值, 都会被修改成 Section1
    ini.Configuration["Section1"] = new IniSection("xxxxx");

    // 修改 "键值"
    // value 可以是已知范围的任何类型的值, 将会自动转换为文本, 如果 Section1 或 Key1 不存在会自动创建
    ini.Configuration["Section1"]["Key1"] = value;
  1. 查询配置
    // 查询 "节", 不存在会自动创建
    IniSection section = ini.Configuration["Section1"];

    // 查询 "键值", 不存在会返回默认值, 会依据返回值的类型自动转换
    var value = ini.Configuration["Section1"]["Key1"];
  1. 将修改保存到文件
    // 创建对象时指定了文件路径, 因此直接写入
    ini.Save ();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.