GalacticShrine.GsC
1.0.1
dotnet add package GalacticShrine.GsC --version 1.0.1
NuGet\Install-Package GalacticShrine.GsC -Version 1.0.1
<PackageReference Include="GalacticShrine.GsC" Version="1.0.1" />
<PackageVersion Include="GalacticShrine.GsC" Version="1.0.1" />
<PackageReference Include="GalacticShrine.GsC" />
paket add GalacticShrine.GsC --version 1.0.1
#r "nuget: GalacticShrine.GsC, 1.0.1"
#:package GalacticShrine.GsC@1.0.1
#addin nuget:?package=GalacticShrine.GsC&version=1.0.1
#tool nuget:?package=GalacticShrine.GsC&version=1.0.1
<div align="center">
GsC / GsCc
Readable configuration. Encrypted data. One standalone .NET library.
GalacticShrine.GsC · ⋞Galactic-Shrine⋟
<a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/blob/main/README.md">Français</a> · <a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/blob/main/README.en.md" aria-current="page">English</a> · <a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/blob/main/README.de.md">Deutsch</a> · <a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/blob/main/README.es.md">Español</a> · <a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/blob/main/README.it.md">Italiano</a> · <a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/blob/main/README.ja.md">日本語</a>
Documentation · Changelog · Contribute · Security
</div>
<a id="overview"></a>
Why GsC?
GsC is a structured configuration format created by ⋞Galactic-Shrine⋟. GsCc is its encrypted container. The C# library GalacticShrine.GsC lets you read, write, parse, validate and edit both formats in your .NET applications, with no runtime NuGet dependencies.
| Feature | What the library provides |
|---|---|
| Structured syntax | Nested sections, objects, lists, arrays, numbers, strings, booleans and null values. |
| Typed access | Object model, generic conversions and TryGet methods with fallback values. |
| Validation | Required members, types, allowed values, bounds, lengths and default values. |
| Editor support | Immutable snapshots preserving exact text, including incomplete or invalid input. |
| Authenticated encryption | GsCc uses AES-256-GCM and PBKDF2-SHA256; encrypted data is represented in Base64. |
| Internationalization | Structured diagnostics and 41 RESX catalogs; French and English XML API documentation. |
<a id="installation"></a>
Installation
Version 1.0.1. Install: dotnet add package GalacticShrine.GsC --version 1.0.1. To build the package locally:
dotnet pack src/GalacticShrine.GsC/GalacticShrine.GsC.csproj -c Release -o artifacts/packages
Add the folder containing the .nupkg to your local NuGet sources, then run this command in your consuming project:
dotnet add package GalacticShrine.GsC --version 1.0.1
<a id="quick-start"></a>
Quick start
One section, two properties, then typed access:
using GalacticShrine.Configuration;
using GalacticShrine.Model.Configuration;
GsCData data = GsCFacade.Parse("""
<{Audio}>
Volume ~> 50;
Enabled ~> true;
""");
int volume = data.GetSection("Audio").GetValue("Volume").Get<int>();
GsCFacade.Save("settings.GsC", data);
Identifiers and keys are user-defined. Both vrai / faux / nul and true / false / null literals are accepted. Lists use { ... }, arrays [ ... ] and objects < ... >; :: separates section path levels.
<a id="encryption"></a>
GsCc encryption
Using the data from the previous example, select the .GsCc extension and supply a password to save and reload encrypted content. Set GSC_PASSWORD in your environment before running this example:
using System;
string password = Environment.GetEnvironmentVariable("GSC_PASSWORD")
?? throw new InvalidOperationException("Set GSC_PASSWORD before running this example.");
GsCFacade.Save("settings.GsCc", data, password);
GsCData restored = GsCFacade.Load("settings.GsCc", password);
The canonical header is GSC-C:1. The envelope contains the decryption parameters, salt, nonce, authentication tag and encrypted data. Base64 is a representation, not encryption: the password is still required to derive the key. The current format uses a 16-byte tag. No migration from older internal envelopes is provided.
<a id="editing"></a>
Editing without reformatting
ParseSyntax preserves comments, whitespace, quotes, escapes and line endings. Edit a part without reformatting the rest of the document:
using System.Linq;
using GalacticShrine.Configuration;
using GalacticShrine.Enumeration.Configuration;
var engine = new GsC();
var document = engine.ParseSyntax("Volume ~> 50; # keep this comment\r\n");
var number = document.Parts.Single(part => part.TokenType == GsCTokenType.Number);
var edited = document.WithPartText(number, "75");
string exactText = edited.ToFullString();
GsCData editedData = edited.GetData();
string canonical = engine.FormatCanonical(editedData);
Only 50 becomes 75. WithChange(offset, length, newText) also supports insertion, deletion and replacement. Offsets and lengths use zero-based UTF-16 code units; lines and columns are one-based. Each edit creates a new snapshot and reparses the entire document. Parts from another snapshot are rejected.
GetData() creates a separate semantic model and throws if the text is invalid. Modifying that model does not modify the snapshot. Use FormatCanonical or Save for canonical output. ReadFrom(TextReader) and WriteTo(TextWriter) integrate with an editor’s file handling; the caller controls encoding and BOM handling. Preservation applies to characters, not original bytes; the writer remains open.
<a id="diagnostics"></a>
Diagnostics and translations
TryParse returns recovered data with syntax errors. Schema validation collects violations in a result. Stable codes such as GSC-ACCESS-001, GSC-SYNTAX-* and GSC-SCHEMA-001 through GSC-SCHEMA-009 remain independent of the message language.
All 41 catalogs contain 68 messages each: neutral English and 40 translations, including fr, ja, de, es, it, th, ko, ar, zh-Hans and zh-Hant. The RESX files live in Properties, work with ResX Resource Manager, and fall back to English. Translations were reviewed with AI assistance; native-speaker reviews are welcome.
pwsh ./tools/Validate-Resources.ps1 -RequireComplete
Unknown escapes are rejected with GSC-LEX-003. Supported sequences: \n, \r, \t, \", \', \\ and \uXXXX. A supplementary Unicode character can use a surrogate pair, such as \uD83C\uDF19.
<a id="compatibility"></a>
Compatibility and validation
The CI matrix is configured for the following nine combinations. It runs unit tests and SelfTests, then checks the same candidate package on each operating system and .NET target before publication. The CI badge reports the published repository’s status.
| Operating system | .NET 8 | .NET 9 | .NET 10 |
|---|---|---|---|
| Windows | CI | CI | CI |
| Linux | CI | CI | CI |
| macOS | CI | CI | CI |
Tests include 26 historical documents: 12 valid documents checked against expected JSON values and 14 invalid documents that must be rejected. They also cover canonical round trips and editor text preservation; they do not establish compatibility with historical GsCc envelopes.
<a id="build"></a>
Build and package
Install the .NET 8, 9 and 10 SDKs to build and test all targets. From the repository root:
dotnet restore GsC-GsCc.sln
dotnet build GsC-GsCc.sln -c Release --no-restore
dotnet test tests/GalacticShrine.GsC.Tests/GalacticShrine.GsC.Tests.csproj -c Release
dotnet pack src/GalacticShrine.GsC/GalacticShrine.GsC.csproj -c Release -o artifacts/packages
Packaging produces the .nupkg, XML API documentation, portable PDBs and the .snupkg symbol package. All six READMEs are included; the NuGet page uses the English version.
On Windows with WSL, Run-Compatibility-Matrix.cmd checks the six Windows/Linux combinations and writes results to TestResults/.
<a id="documentation"></a>
Documentation and versions
The full GsC/GsCc specification and API documentation are maintained outside this repository at docs.galactic-shrine.com. The MSBuild DocumentationUrl property can override this address when packaging.
The public NuGet/GitHub version uses MAJOR.MINOR.PATCH: 1.0.1. The assembly version retains the build: 1.0.1.174. The build may increase but must never be reset.
<a id="contributors"></a>
Contributors
Code, tests, documentation, translations, reports and ideas: every contribution counts. See the contributing guide and issues.
Thanks to everyone helping GsC/GsCc grow. This project follows the All Contributors specification; the list is managed through .all-contributorsrc across all README languages.
<table width="220"> <tbody> <tr> <td align="center" valign="top" width="25%"><p><a href="https://github.com/GsKizuna"><img src="https://wsrv.nl/?url=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F2974534&w=96&h=96&fit=cover&mask=circle&output=png" width="96" height="96" alt="Kizuna" /></a></p><p><a href="https://github.com/GsKizuna"><strong>Kizuna</strong></a><br /><sub>@GsKizuna</sub></p><p><a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/commits?author=GsKizuna" title="Code"><img src="https://img.shields.io/badge/%F0%9F%92%BB%20Code-2563eb?style=plastic" alt="💻 Code" /></a><br /><a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/commits?author=GsKizuna" title="Documentation"><img src="https://img.shields.io/badge/%F0%9F%93%96%20Documentation-8b5cf6?style=plastic" alt="📖 Documentation" /></a><br /><a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/commits?author=GsKizuna" title="Tests"><img src="https://img.shields.io/badge/%E2%9A%A0%EF%B8%8F%20Tests-b45309?style=plastic" alt="⚠️ Tests" /></a><br /><a href="https://github.com/Galactic-Shrine/CSharp-GalacticShrine.GsC/commits?author=GsKizuna" title="Translation"><img src="https://img.shields.io/badge/%F0%9F%8C%8D%20Translation-0f766e?style=plastic" alt="🌍 Translation" /></a></p></td> </tr> </tbody> </table>
<a id="license"></a>
License
Distributed under the Mozilla Public License 2.0.
Copyright © 2017–2026 ⋞Galactic-Shrine⋟.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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 is compatible. 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.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.
Fix the lexer infinite loop on dollar-prefixed identifiers. Preserve build 174.