Parsec 1.2.0

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

Parsec

.NET codecov Nuget License: MIT

Parsec is a simple .NET parsing library for Shaiya file formats which provides easy to use APIs for serialization and deserialization of the game's file formats, including JSON and CSV support.

Parsec works on any .NET Standard 2.0 compliant platform, including .NET 5+, .NET Framework 4.6.1+, .NET Core 2.0+, Unity and Godot.

Supported file formats

  • data.sah/saf
  • NpcQuest.SData
  • KillStatus.SData
  • Cash.SData
  • SetItem.SData
  • DualLayerClothes.SData
  • GuildHouse.SData
  • Monster.SData
  • Item.SData
  • Skill.SData
  • NpcSkill.SData
  • svmap
  • WLD
  • dg
  • ANI
  • 3DC
  • 3DO
  • 3DE
  • MLT
  • ITM
  • SMOD
  • EFT
  • seff
  • zon
  • ALT
  • VAni
  • MAni
  • MLX
  • MON
  • CTL
  • dat (Cloth/Emblem)
  • DBItemData.SData
  • DBItemText.SData
  • DBMonsterData.SData
  • DBMonsterText.SData
  • DBSkillData.SData
  • DBSkillText.SData
  • DBItemSellData.SData
  • DBItemSellText.SData
  • DBNpcSkillData.SData
  • DBNpcSkillText.SData
  • DBDualLayerClothesData.SData
  • DBSetItemData.SData
  • DBSetItemText.SData
  • DBTransformModelData.SData
  • DBTransformWeaponModelData.SData

NOTE: These file formats have been tested on Episodes 5, 6 & 8. Other episodes might differ slightly and this library might not work with them.

Features

  • Shaiya file formats parsing and serialization (including JSON and CSV support)
  • data extraction, building and patching
  • SData encryption/decryption

Getting Started

Prerequisites

  • .NET 8 SDK (recommended) or any .NET Standard 2.0 compliant platform

Documentation

Reading

From a standalone file
// Read file with default episode (EP5) and encoding (ASCII)
var svmap = ParsecReader.FromFile<Svmap>("0.svmap");

// Read file with a specific episode and default encoding
var svmap = ParsecReader.FromFile<Svmap>("0.svmap", Episode.Ep6);

// Read file with a specific episode and a specific encoding
var windows1252Encoding = CodePagesEncodingProvider.Instance.GetEncoding(1252);
var svmap = ParsecReader.FromFile<Svmap>("0.svmap", Episode.Ep6, windows1252Encoding);
From data.saf
// Load data (sah and saf)
var data = new Data("data.sah", "data.saf");

// Find the file you want to read
var file = data.GetFile("world/0.svmap");

// Read and parse the file's content directly from the saf file
var svmap = ParsecReader.FromBuffer<Svmap>(file.Name, data.GetFileBuffer(file));
From a JSON file

Parsec supports importing a file as JSON, which can be later exported as its original format. The user must make sure that the JSON file is properly formatted to match the JSON standards and contain all the fields present in the chosen format.

// Read JSON file
var svmap = ParsecReader.FromJsonFile<Svmap>("0_svmap.json");

It is advised to first read a file from its original format, export it as JSON, edit it, and import it once again as JSON, so that all the original fields are present in the JSON file.

From a CSV file

Only some pre-Ep8 SData formats support reading as CSV. All of the Episode 8 BinarySData formats have CSV support.

// Read csv file
var item = Item.FromCsv("Item.csv");

Encoding

When reading files, the default encoding is ASCII. If you want to read a file with a different encoding, you can specify it as a parameter when calling the FromFile/Json/Csv methods.

Writing

Writing a standalone file

After modifying the file, you can save it in its original format by calling the Write method. If you specified the episode and encoding when reading the file, you don't need to specify them again when writing it.

// Write file with previously defined episode and encoding (defined when reading the file)
svmap.Write("0_modified.svmap");

// Write file with a specific episode and default encoding
svmap.Write("0_modified.svmap", Episode.Ep6);

// Write file with a specific episode and a specific encoding
var windows1252Encoding = CodePagesEncodingProvider.Instance.GetEncoding(1252);
svmap.Write("0_modified.svmap", Episode.Ep6, windows1252Encoding);
Writing as JSON

Call the WriteJson method

svmap.WriteJson("map0.json");
Writing as CSV

Only some pre-Ep8 SData formats support exporting as CSV. All of the Episode 8 BinarySData formats have CSV support.

// Write as csv
item.WriteCsv("Item.csv")

Encoding

When writing files, the default encoding is ASCII. If you want to write a file with a different encoding, you can specify it as a parameter when calling the Write, WriteJson and WriteCsv methods.

Samples

sah/saf

Read and extract
// Load data (sah and saf)
var data = new Data("data.sah", "data.saf");

// Find the file you want to extract
var file = data.GetFile("world/2.svmap");

// Extract the selected file
data.Extract(file, "extracted");
Data/Patch building
// Create data from directory
DataBuilder.CreateFromDirectory("input", "output");
Patch
// Load target data and patch data
var data = new Data("data.sah", "data.saf");
var update = new Data("update.sah", "update.saf");

// Patch data
using (var dataPatcher = new DataPatcher())
{
    dataPatcher.Patch(data, update);
}

SData

Encryption / Decryption

SData encryption is slightly different for pre-Ep8 and Ep8 SData files. The SDataVersion enum is used to specify which version of SData is being encrypted (it's not necessary when decrypting);

// Encrypt
SData.EncryptFile("NpcQuest.SData", "NpcQuest.encrypted.SData", SDataVersion.Regular);

// Decrypt
SData.DecryptFile("NpcQuest.SData", "NpcQuest.decrypted.SData");

More examples can be found in the samples directory.

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 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 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.

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
1.2.0 92 4/4/2025
1.1.1 206 2/8/2024
1.1.0 227 11/30/2023
1.0.1 144 10/13/2023
1.0.0 124 10/9/2023