ZoppaToml 0.1.1

dotnet add package ZoppaToml --version 0.1.1
                    
NuGet\Install-Package ZoppaToml -Version 0.1.1
                    
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="ZoppaToml" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZoppaToml" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="ZoppaToml" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZoppaToml --version 0.1.1
                    
#r "nuget: ZoppaToml, 0.1.1"
                    
#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.
#:package ZoppaToml@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZoppaToml&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=ZoppaToml&version=0.1.1
                    
Install as a Cake Tool

ZoppaToml

シンプルなTomlファイルの読み込みライブラリです。

以下のようにTomlファイルを読み込みます。

using ZoppaToml;

dynamic doc = TomlDocument.LoadFromFile("spec-example-1.toml");

// dynamicオブジェクトを使って取得できます
Console.WriteLine(doc.title.GetValue<string>());

dynamic owner = doc.owner;
Console.WriteLine(owner.name.GetValue<string>());
Console.WriteLine(owner.dob.GetValue<DateTimeOffset>());

dynamic database = doc.database;
Console.WriteLine(database.server.GetValue<string>());
foreach (TomlValue member in database.ports) {
    Console.WriteLine(member.GetValue<int>());
}
Console.WriteLine(database.connection_max.GetValue<int>());
Console.WriteLine(database.enabled.GetValue<bool>());

// インデクサを使って取得できます
var servers = doc["servers"];
Console.WriteLine(servers["alpha"]["ip"].GetValue<string>());
Console.WriteLine(servers["alpha"]["dc"].GetValue<string>());
Console.WriteLine(servers["beta"]["ip"].GetValue<string>());
Console.WriteLine(servers["beta"]["dc"].GetValue<string>());

Console.WriteLine(doc["clients"]["data"][0][0].GetValue<string>());
Console.WriteLine(doc["clients"]["data"][0][1].GetValue<string>());
Console.WriteLine(doc["clients"]["data"][1][0].GetValue<int>());
Console.WriteLine(doc["clients"]["data"][1][1].GetValue<int>());

Console.WriteLine(doc["clients"]["hosts"][0].GetValue<string>());
Console.WriteLine(doc["clients"]["hosts"][1].GetValue<string>());

Tomlファイルの内容は以下のとおりです。

# This is a TOML document. Boom.

title = "TOML Example"

[owner]
name = "Lance Uppercut"
dob = 1979-05-27T07:32:00-08:00 # First class dates? Why not?

[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002 ]
connection_max = 5000
enabled = true

[servers]

  # You can indent as you please. Tabs or spaces. TOML don't care.
  [servers.alpha]
  ip = "10.0.0.1"
  dc = "eqdc10"

  [servers.beta]
  ip = "10.0.0.2"
  dc = "eqdc10"

[clients]
data = [ ["gamma", "delta"], [1, 2] ]

# Line breaks are OK when inside arrays
hosts = [
  "alpha",
  "omega"
]

作成情報

  • 造田 崇(zoppa software)
  • ミウラ第1システムカンパニー
  • takashi.zouta@kkmiuta.jp

ライセンス

apache 2.0

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.

Version Downloads Last Updated
0.1.1 230 6/29/2024
0.1.0 195 6/29/2024