seztion-parser 3.1.0

dotnet add package seztion-parser --version 3.1.0
                    
NuGet\Install-Package seztion-parser -Version 3.1.0
                    
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="seztion-parser" Version="3.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="seztion-parser" Version="3.1.0" />
                    
Directory.Packages.props
<PackageReference Include="seztion-parser" />
                    
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 seztion-parser --version 3.1.0
                    
#r "nuget: seztion-parser, 3.1.0"
                    
#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 seztion-parser@3.1.0
                    
#: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=seztion-parser&version=3.1.0
                    
Install as a Cake Addin
#tool nuget:?package=seztion-parser&version=3.1.0
                    
Install as a Cake Tool

seztion-parser

seztion-parser-logo

seztion-parser downloads license

Seztion Parser is a lightweight .NET library for reading section-based configuration files, such as .ini files. It provides a simple API for accessing the contents of each section while remaining independent of the file extension.

Why this library exists

Seztion Parser was originally developed for the Capture the Flag game mode for SA-MP (San Andreas Multiplayer), a multiplayer mod for GTA San Andreas.

Each map configuration file contained information such as:

  • Alpha team spawn locations
  • Beta team spawn locations
  • Red and blue flag locations
  • Interior ID
  • Weather
  • World time

Instead of using a database, each map's configuration was stored in an INI file organized into sections.

#
# Aim_Headshot Map
#

# Format: X,Y,Z,Angle
[AlphaTeamLocations]
-669.9301,2567.7261,233.1899,4.0968
-662.3662,2568.0757,233.1899,4.4101

[BetaTeamLocations]
-656.4174,2739.6848,219.2168,177.9750
-650.9906,2739.0764,219.2168,177.9750

# Format: X,Y,Z
[RedFlagLocation]
-729.1639,2635.3447,223.3559

[BlueFlagLocation]
-576.2537,2731.9312,233.3905

[Interior]
10

[Weather]
1

[WorldTime]
12

Seztion Parser provides a straightforward API for loading this configuration and accessing each section.

Features

  • Read section-based configuration files.
  • Access sections by name.
  • Enumerate all values within a section.
  • Read typed values from the first line of a section.
  • Supports any file extension (not limited to .ini).
  • Lightweight with no external dependencies.

Installation

Install the package using the .NET CLI:

dotnet add package seztion-parser

Or using the NuGet Package Manager:

Install-Package seztion-parser

Usage

The following example loads the map configuration and reads the data from each section.

using SeztionParser;

ISectionsData sections = SectionsFile.Load("Aim_Headshot.ini");

Console.WriteLine("[AlphaTeamLocations]");
ISectionData alphaTeamLocations = sections["AlphaTeamLocations"];
foreach (string data in alphaTeamLocations)
    Console.WriteLine(data);

Console.WriteLine();

Console.WriteLine("[BetaTeamLocations]");
ISectionData betaTeamLocations = sections["BetaTeamLocations"];
foreach (string data in betaTeamLocations)
    Console.WriteLine(data);

Console.WriteLine();

Console.WriteLine("[RedFlagLocation]");
ISectionData redFlagLocation = sections["RedFlagLocation"];
foreach (string data in redFlagLocation)
    Console.WriteLine(data);

Console.WriteLine();

Console.WriteLine("[BlueFlagLocation]");
ISectionData blueFlagLocation = sections["BlueFlagLocation"];
foreach (string data in blueFlagLocation)
    Console.WriteLine(data);

int interior = sections.GetFirstLineInt("Interior");
Console.WriteLine();
Console.WriteLine("[Interior]");
Console.WriteLine(interior);

int weather = sections.GetFirstLineInt("Weather");
Console.WriteLine();
Console.WriteLine("[Weather]");
Console.WriteLine(weather);

int worldTime = sections.GetFirstLineInt("WorldTime");
Console.WriteLine();
Console.WriteLine("[WorldTime]");
Console.WriteLine(worldTime);

Documentation

Documentation is available on the project website.

Contribution

Contributions of all kinds are welcome! You can help by improving the code, documentation, or tests.

To contribute:

  • Fork the repository.
  • Create a feature branch (git checkout -b my-new-change).
  • Commit your changes (git commit -am "Add some change").
  • Push to your branch (git push origin my-new-change).
  • Open a Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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
3.1.0 57 7/22/2026
3.0.0 15,432 7/27/2024
2.0.0 230 7/6/2024
1.0.2 544 11/23/2022
1.0.1 573 11/7/2021
1.0.0 606 11/5/2021