├── src
├── .idea
│ └── .idea.Yarhl
│ │ └── .idea
│ │ ├── .name
│ │ ├── indexLayout.xml
│ │ ├── .gitignore
│ │ ├── CakeRider.xml
│ │ └── vcs.xml
├── nuget.config
├── Yarhl.Examples
│ ├── Yarhl.Examples.csproj
│ ├── Tutorial
│ │ ├── TextEntry.cs
│ │ ├── TxtiFormat.cs
│ │ ├── Txti2Po.cs
│ │ ├── Binary2Txti.cs
│ │ └── Program.cs
│ ├── Program.cs
│ ├── Formats
│ │ ├── Converters.cs
│ │ └── Formats.cs
│ ├── IO
│ │ └── DataStreamExamples.cs
│ ├── Plugins
│ │ └── LocateTypesExamples.cs
│ └── Introduction.cs
├── Yarhl
│ ├── IO
│ │ ├── Serialization
│ │ │ ├── ITypeFieldNavigator.cs
│ │ │ ├── Attributes
│ │ │ │ ├── BinaryOrderAttribute.cs
│ │ │ │ ├── BinaryInt24Attribute.cs
│ │ │ │ ├── BinaryIgnoreAttribute.cs
│ │ │ │ ├── BinaryEndiannessAttribute.cs
│ │ │ │ ├── BinaryEnumAttribute.cs
│ │ │ │ ├── BinaryBooleanAttribute.cs
│ │ │ │ └── BinaryStringAttribute.cs
│ │ │ ├── FieldInfo.cs
│ │ │ └── DefaultTypePropertyNavigator.cs
│ │ ├── EndiannessMode.cs
│ │ ├── IBinary.cs
│ │ ├── SeekMode.Obsolete4.cs
│ │ ├── StreamFormat
│ │ │ └── RecyclableMemoryStream.cs
│ │ ├── DataStream.Obsolete4.cs
│ │ └── NumericExtension.cs
│ ├── Yarhl.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── FileFormat
│ │ ├── IFormat.cs
│ │ ├── FormatExtensions.cs
│ │ ├── IInitializer.Obsolete4.cs
│ │ ├── ICloneableFormat.cs
│ │ ├── IConverter.cs
│ │ ├── ConvertFormat.Obsolete4.cs
│ │ └── ConvertFormat.cs
│ └── FileSystem
│ │ ├── NodeSystem.cs
│ │ ├── NavigationMode.cs
│ │ ├── NavigableNodeCollection.cs
│ │ └── Node.Obsolete4.cs
├── Tests.runsettings
├── Yarhl.sln.DotSettings
├── Yarhl.IntegrationTests
│ └── Yarhl.IntegrationTests.csproj
├── Yarhl.Plugins
│ ├── Yarhl.Plugins.csproj
│ ├── TypeImplementationInfo.cs
│ ├── GenericTypeImplementationInfo.cs
│ └── FileFormat
│ │ └── ConverterTypeInfo.cs
├── Directory.Packages.props
├── Yarhl.PerformanceTests
│ ├── Yarhl.PerformanceTests.csproj
│ ├── IO
│ │ ├── StreamType.cs
│ │ ├── DataStreamCompare.cs
│ │ └── DataStreamReadWriteTests.cs
│ ├── Program.cs
│ ├── FileSystem
│ │ └── NodeTransformWithInterfaces.cs
│ └── Encodings
│ │ └── japanese.txt
├── Yarhl.Media.Text
│ ├── Yarhl.Media.Text.csproj
│ └── Encodings
│ │ └── SpanStream.cs
├── Yarhl.UnitTests
│ ├── Yarhl.UnitTests.csproj
│ ├── FileFormat
│ │ ├── TestConvertersDefinition.FormatInheritance.cs
│ │ ├── BaseGeneralTests.cs
│ │ ├── ConvertFormatTests.FormatInheritance.cs
│ │ ├── FormatExtensionsTests.cs
│ │ └── ConvertFormatTests.Obsolete4.cs
│ ├── Plugins
│ │ ├── TestTypesDefinition.cs
│ │ └── FileFormat
│ │ │ └── TestConvertersDefinition.cs
│ ├── IO
│ │ ├── FileOpenModeTests.cs
│ │ └── NumericExtensionTests.cs
│ ├── FileSystem
│ │ ├── NavigableNodeCollectionTests.cs
│ │ └── NodeTests.Obsolete4.cs
│ └── Media
│ │ └── Text
│ │ └── Encodings
│ │ └── SpanStreamTests.cs
└── Directory.Build.props
├── docs
├── articles
│ ├── media-text
│ │ ├── tables.md
│ │ ├── encodings.md
│ │ ├── po-format.md
│ │ └── toc.yml
│ ├── core
│ │ ├── binary
│ │ │ ├── binaryformat.md
│ │ │ ├── custom-streams.md
│ │ │ ├── binaryreader-writer.md
│ │ │ ├── textreader-writer.md
│ │ │ ├── attr-serialization.md
│ │ │ └── images
│ │ │ │ ├── datastream-container.drawio.png
│ │ │ │ └── datastream-container-substreams.drawio.png
│ │ ├── virtual-file-system
│ │ │ ├── container-format.md
│ │ │ ├── navigate-nodes.md
│ │ │ └── images
│ │ │ │ ├── node-simple.drawio.png
│ │ │ │ └── node-children.drawio.png
│ │ ├── getting-started
│ │ │ ├── net-languages.md
│ │ │ ├── images
│ │ │ │ ├── hex_view.png
│ │ │ │ ├── po_poedit.png
│ │ │ │ ├── po_vscode.png
│ │ │ │ ├── deserializer_output.png
│ │ │ │ └── goal_overview.drawio.png
│ │ │ ├── resources
│ │ │ │ └── texts.bin
│ │ │ └── architecture.md
│ │ ├── formats
│ │ │ ├── cloneable-format.md
│ │ │ └── formats.md
│ │ └── toc.yml
│ ├── changelog.md
│ └── plugins
│ │ ├── overview.md
│ │ ├── locate-types.md
│ │ └── load-assembly.md
├── images
│ ├── logo.png
│ ├── favicon.ico
│ ├── logo-50.png
│ ├── favicon-128.png
│ └── logo-large.png
├── api
│ └── .gitignore
├── .gitignore
├── template
│ └── public
│ │ ├── main.js
│ │ └── main.css
├── toc.yml
├── docfx.json
└── index.md
├── .prettierrc.yaml
├── GitVersion.yml
├── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .github
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── pull_request_template.md
└── workflows
│ ├── build-and-release.yml
│ ├── build.yml
│ └── deploy.yml
├── SECURITY.md
├── .vscode
├── settings.json
├── launch.json
└── tasks.json
├── .config
└── dotnet-tools.json
├── LICENSE
├── GitReleaseManager.yaml
├── CODE_OF_CONDUCT.md
└── CONTRIBUTING.md
/src/.idea/.idea.Yarhl/.idea/.name:
--------------------------------------------------------------------------------
1 | Yarhl
--------------------------------------------------------------------------------
/docs/articles/media-text/tables.md:
--------------------------------------------------------------------------------
1 | # Tables
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/articles/media-text/encodings.md:
--------------------------------------------------------------------------------
1 | # Encodings
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/articles/core/binary/binaryformat.md:
--------------------------------------------------------------------------------
1 | # Binary format
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/articles/core/binary/custom-streams.md:
--------------------------------------------------------------------------------
1 | # Custom streams
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/articles/media-text/po-format.md:
--------------------------------------------------------------------------------
1 | # PO translation format
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/articles/core/binary/binaryreader-writer.md:
--------------------------------------------------------------------------------
1 | # Binary reader and writer
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/articles/core/binary/textreader-writer.md:
--------------------------------------------------------------------------------
1 | # Text reader and writer
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/.prettierrc.yaml:
--------------------------------------------------------------------------------
1 | overrides:
2 | - files: "*.md"
3 | options:
4 | proseWrap: always
5 |
--------------------------------------------------------------------------------
/docs/articles/changelog.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | To be filled on preview and stable builds.
4 |
--------------------------------------------------------------------------------
/docs/articles/core/virtual-file-system/container-format.md:
--------------------------------------------------------------------------------
1 | # Container format
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/articles/core/virtual-file-system/navigate-nodes.md:
--------------------------------------------------------------------------------
1 | # Navigate the nodes
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/images/logo.png
--------------------------------------------------------------------------------
/docs/api/.gitignore:
--------------------------------------------------------------------------------
1 | ###############
2 | # temp file #
3 | ###############
4 | *.yml
5 | .manifest
6 |
--------------------------------------------------------------------------------
/docs/articles/core/binary/attr-serialization.md:
--------------------------------------------------------------------------------
1 | # (De)serialization via attributes
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/articles/core/getting-started/net-languages.md:
--------------------------------------------------------------------------------
1 | # Yarhl in other .NET languages
2 |
3 | TODO
4 |
--------------------------------------------------------------------------------
/docs/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/images/favicon.ico
--------------------------------------------------------------------------------
/docs/images/logo-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/images/logo-50.png
--------------------------------------------------------------------------------
/docs/images/favicon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/images/favicon-128.png
--------------------------------------------------------------------------------
/docs/images/logo-large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/images/logo-large.png
--------------------------------------------------------------------------------
/GitVersion.yml:
--------------------------------------------------------------------------------
1 | mode: ContinuousDeployment
2 | branches:
3 | develop:
4 | tag: preview
5 | increment: Patch
6 |
--------------------------------------------------------------------------------
/docs/articles/core/getting-started/images/hex_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/getting-started/images/hex_view.png
--------------------------------------------------------------------------------
/docs/articles/core/getting-started/resources/texts.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/getting-started/resources/texts.bin
--------------------------------------------------------------------------------
/docs/articles/core/getting-started/images/po_poedit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/getting-started/images/po_poedit.png
--------------------------------------------------------------------------------
/docs/articles/core/getting-started/images/po_vscode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/getting-started/images/po_vscode.png
--------------------------------------------------------------------------------
/docs/articles/core/binary/images/datastream-container.drawio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/binary/images/datastream-container.drawio.png
--------------------------------------------------------------------------------
/docs/articles/core/getting-started/images/deserializer_output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/getting-started/images/deserializer_output.png
--------------------------------------------------------------------------------
/docs/articles/core/getting-started/images/goal_overview.drawio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/getting-started/images/goal_overview.drawio.png
--------------------------------------------------------------------------------
/docs/articles/core/virtual-file-system/images/node-simple.drawio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/virtual-file-system/images/node-simple.drawio.png
--------------------------------------------------------------------------------
/docs/articles/core/virtual-file-system/images/node-children.drawio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/virtual-file-system/images/node-children.drawio.png
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | ###############
2 | # folder #
3 | ###############
4 | /**/DROP/
5 | /**/TEMP/
6 | /**/packages/
7 | /**/bin/
8 | /**/obj/
9 | _site
10 |
11 | # DrawIO
12 | .$*.drawio*
13 |
--------------------------------------------------------------------------------
/docs/articles/core/binary/images/datastream-container-substreams.drawio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SceneGate/Yarhl/develop/docs/articles/core/binary/images/datastream-container-substreams.drawio.png
--------------------------------------------------------------------------------
/docs/articles/media-text/toc.yml:
--------------------------------------------------------------------------------
1 | - name: 📝 Text formats
2 | - name: 🚧 GNU Gettext PO format
3 | href: ./po-format.md
4 | - name: 🚧 Encodings
5 | href: ./encodings.md
6 | - name: 🚧 Tables
7 | href: ./tables.md
8 |
--------------------------------------------------------------------------------
/docs/template/public/main.js:
--------------------------------------------------------------------------------
1 | export default {
2 | iconLinks: [
3 | {
4 | icon: "github",
5 | href: "https://github.com/SceneGate/Yarhl",
6 | title: "GitHub",
7 | },
8 | ],
9 | };
10 |
--------------------------------------------------------------------------------
/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Description
2 |
3 | A clear and concise description of what the bug or feature is.
4 |
5 | ### Example
6 |
7 | Small example on how to use the new classes and methods.
8 |
9 | This closes #
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Output
2 | obj/
3 | bin/
4 | build/artifacts/
5 | build/temp/
6 | /CHANGELOG.md
7 | /CHANGELOG.NEXT.md
8 |
9 | # IDE
10 | *.userprefs
11 | *.user
12 | *.vs
13 | *.DotSettings.user
14 | launchSettings.json
15 |
16 | # Benchmarks
17 | BenchmarkDotNet.Artifacts/
18 |
--------------------------------------------------------------------------------
/docs/toc.yml:
--------------------------------------------------------------------------------
1 | - name: Core
2 | href: articles/core/
3 |
4 | - name: Text formats
5 | href: articles/media-text/
6 |
7 | - name: API
8 | href: api/
9 |
10 | - name: Changelog
11 | href: articles/changelog.md
12 |
13 | - name: GitHub
14 | href: https://github.com/SceneGate/Yarhl
15 |
--------------------------------------------------------------------------------
/docs/articles/core/getting-started/architecture.md:
--------------------------------------------------------------------------------
1 | # Framework architecture
2 |
3 | TODO: base goal and requirements
4 |
5 | ## Reading, deserializing, exporting
6 |
7 | TODO
8 |
9 | ## Core library and plugins
10 |
11 | TODO
12 |
13 | ## Related tools
14 |
15 | TODO
16 |
17 | ## End game
18 |
19 | TODO
20 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Yarhl/.idea/indexLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ../../yarhl
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Yarhl/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Rider ignored files
5 | /.idea.Yarhl.iml
6 | /projectSettingsUpdater.xml
7 | /modules.xml
8 | /contentModel.xml
9 | # Editor-based HTTP Client requests
10 | /httpRequests/
11 | # Datasource local storage ignored files
12 | /dataSources/
13 | /dataSources.local.xml
14 |
--------------------------------------------------------------------------------
/src/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Yarhl/.idea/CakeRider.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Yarhl/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ""
5 | labels: ""
6 | assignees: ""
7 | ---
8 |
9 | ## Goal
10 |
11 | TODO: describe with user stories or a short text the goal of the feature.
12 |
13 | ## Description
14 |
15 | TODO: describe the motivation behind of the idea and what it should do.
16 |
17 | ## Proposed solution
18 |
19 | TODO: add any ideas for the implementation or how it should look like.
20 |
21 | ## Acceptance criteria
22 |
23 | TODO: list of expectations it should pass to close the request.
24 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | Only the latest stable version is actively supported with critical bug fixed and
6 | security issues.
7 |
8 | ## Reporting a Vulnerability
9 |
10 | Vulnerabilities can be reported to my personal email address (you can check it
11 | from my [GitHub profile](https://github.com/pleonex)).
12 |
13 | All the security issues will be analyzed and a reply will be given in two
14 | working days. Once the issue is accepted it will be fixed in the current
15 | development branch and for the latest version. A new version would be released.
16 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ""
5 | labels: ""
6 | assignees: ""
7 | ---
8 |
9 | ## Description
10 |
11 | TODO: describe the issue
12 |
13 | ## Reproducer
14 |
15 | TODO: steps to reproduce the behavior.
16 |
17 | ## Expected behavior
18 |
19 | TODO: description of the expected behavior.
20 |
21 | ## Report info
22 |
23 | TODO: if applicable, the full exception stacktrace that you get.
24 |
25 | TODO: if applicable, add screenshots to help explain your problem.
26 |
27 | TODO: describe your environment like OS, app/lib version
28 |
--------------------------------------------------------------------------------
/src/Yarhl.Examples/Yarhl.Examples.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | enable
7 |
8 | false
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | TODO: description of the PR work.
2 |
3 | This PR closes #
4 |
5 | ## Quality check list
6 |
7 | - [ ] Related code has been tested automatically or manually
8 | - [ ] Related documentation is updated
9 | - [ ] I acknowledge I have read and filled this checklist and accept the
10 | [developer certificate of origin](https://developercertificate.org/)
11 |
12 | ## Acceptance criteria
13 |
14 | TODO: list of expectations it has passed from the related issue.
15 |
16 | ## Follow-up work
17 |
18 | TODO: describe any missing or future required work.
19 |
20 | ## Example
21 |
22 | TODO: small code-snippet or screenshot of the work
23 |
--------------------------------------------------------------------------------
/src/Yarhl/IO/Serialization/ITypeFieldNavigator.cs:
--------------------------------------------------------------------------------
1 | namespace Yarhl.IO.Serialization;
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Reflection;
6 |
7 | ///
8 | /// Interface to provide implementations that iterate over fields of types.
9 | ///
10 | public interface ITypeFieldNavigator
11 | {
12 | ///
13 | /// Iterate over the fields of a given type using reflection with enumerables.
14 | ///
15 | /// The type to iterate over fields.
16 | /// Enumerable to iterate over its fields.
17 | IEnumerable IterateFields(Type type);
18 | }
19 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.rulers": [
3 | 80,
4 | 120
5 | ],
6 | "editor.renderWhitespace": "boundary",
7 | "editor.defaultFormatter": "esbenp.prettier-vscode",
8 | "[markdown]": {
9 | "editor.formatOnSave": true,
10 | },
11 | "[csharp]": {
12 | "editor.defaultFormatter": "ms-dotnettools.csharp",
13 | "editor.formatOnType": true
14 | },
15 | "cSpell.words": [
16 | "Conv",
17 | "cref",
18 | "Dependee",
19 | "Ekona",
20 | "Diagnoser",
21 | "finalizer",
22 | "msgctxt",
23 | "Msgid",
24 | "typeparam"
25 | ],
26 | "dotnet.defaultSolution": "src/Yarhl.sln",
27 | }
--------------------------------------------------------------------------------
/src/Tests.runsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | cobertura
10 | [.*UnitTest]*,[.*IntegrationTest]*
11 | GeneratedCodeAttribute,ExcludeFromCodeCoverageAttribute,ObsoleteAttribute
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Yarhl.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
3 | <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
4 | True
--------------------------------------------------------------------------------
/src/Yarhl.IntegrationTests/Yarhl.IntegrationTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Plugin integration tests for Yarhl.
6 | net6.0;net8.0
7 |
8 | enable
9 | enable
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/Yarhl.Plugins/Yarhl.Plugins.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Assembly scaning for file formats and converters implemented with Yarhl.
5 | true
6 |
7 | net6.0;net8.0
8 |
9 | enable
10 | enable
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/Yarhl/IO/Serialization/Attributes/BinaryOrderAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace Yarhl.IO.Serialization.Attributes;
2 |
3 | using System;
4 |
5 | ///
6 | /// Specify the order to serialize or deserialize the fields in binary format.
7 | ///
8 | [AttributeUsage(AttributeTargets.Property)]
9 | public class BinaryOrderAttribute : Attribute
10 | {
11 | ///
12 | /// Initializes a new instance of the class.
13 | ///
14 | /// The order of the field in the binary serialization.
15 | public BinaryOrderAttribute(int order)
16 | {
17 | Order = order;
18 | }
19 |
20 | ///
21 | /// Gets or sets the order of the field in the binary format.
22 | ///
23 | public int Order { get; set; }
24 | }
25 |
--------------------------------------------------------------------------------
/.config/dotnet-tools.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "isRoot": true,
4 | "tools": {
5 | "gitversion.tool": {
6 | "version": "5.12.0",
7 | "commands": [
8 | "dotnet-gitversion"
9 | ],
10 | "rollForward": false
11 | },
12 | "thirdlicense": {
13 | "version": "1.3.1",
14 | "commands": [
15 | "thirdlicense"
16 | ],
17 | "rollForward": false
18 | },
19 | "dotnet-reportgenerator-globaltool": {
20 | "version": "5.2.0",
21 | "commands": [
22 | "reportgenerator"
23 | ],
24 | "rollForward": false
25 | },
26 | "docfx": {
27 | "version": "2.77.0",
28 | "commands": [
29 | "docfx"
30 | ],
31 | "rollForward": false
32 | },
33 | "gitreleasemanager.tool": {
34 | "version": "0.16.0",
35 | "commands": [
36 | "dotnet-gitreleasemanager"
37 | ],
38 | "rollForward": false
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "Run perf test",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "Build release",
12 | "program": "${workspaceFolder}/src/Yarhl.PerformanceTests/bin/Release/net8.0/Yarhl.PerformanceTests.dll",
13 | "args": [ "auto" ],
14 | "cwd": "${workspaceFolder}",
15 | "stopAtEntry": false,
16 | "console": "internalConsole"
17 | },
18 | {
19 | "name": ".NET Attach",
20 | "type": "coreclr",
21 | "request": "attach",
22 | "processId": "${command:pickProcess}"
23 | }
24 | ]
25 | }
--------------------------------------------------------------------------------
/src/Yarhl/Yarhl.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Library with features for implementing file formats, converters and a virtual file system.
6 | true
7 |
8 | net6.0;net8.0
9 |
10 | enable
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/Directory.Packages.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Yarhl.PerformanceTests/Yarhl.PerformanceTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Exe
6 | Performance tests for Yarhl.
7 | net8.0
8 |
9 | false
10 |
11 |
12 |
13 |
14 | Always
15 |
16 |
17 | Always
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/Yarhl.Media.Text/Yarhl.Media.Text.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Library with Yarhl converters for text formats.
6 | true
7 |
8 | net6.0;net8.0
9 |
10 | enable
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/Yarhl.UnitTests/Yarhl.UnitTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Yarhl unit tests.
6 | net6.0;net8.0
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | all
20 | runtime; build; native; contentfiles; analyzers; buildtransitive
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.github/workflows/build-and-release.yml:
--------------------------------------------------------------------------------
1 | name: Build and release
2 |
3 | on:
4 | # Dev
5 | workflow_dispatch:
6 | pull_request:
7 | push:
8 | # Preview
9 | branches: [ develop ]
10 | # Stable
11 | tags: [ "v*" ]
12 |
13 | jobs:
14 | build:
15 | name: "Build"
16 | uses: ./.github/workflows/build.yml
17 | with:
18 | dotnet_version: '8.0.401'
19 |
20 | # Preview release on push to main only
21 | # Stable release on version tag push only
22 | deploy:
23 | name: "Deploy"
24 | if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v')
25 | needs: build
26 | uses: ./.github/workflows/deploy.yml
27 | with:
28 | dotnet_version: '8.0.401'
29 | azure_nuget_feed: 'https://pkgs.dev.azure.com/SceneGate/SceneGate/_packaging/SceneGate-Preview/nuget/v3/index.json'
30 | secrets:
31 | nuget_preview_token: "az" # Dummy values as we use Azure DevOps only
32 | nuget_stable_token: ${{ secrets.NUGET_FEED_TOKEN }}
33 | azure_nuget_token: ${{ secrets.ADO_NUGET_FEED_TOKEN }}
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 SceneGate
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/docs/articles/core/formats/cloneable-format.md:
--------------------------------------------------------------------------------
1 | # Cloneable format
2 |
3 | .NET does not provide an interface to guarantee a
4 | [deep clone](https://learn.microsoft.com/en-us/dotnet/api/system.icloneable?view=net-7.0#remarks)
5 | implementation.
6 |
7 | The [`ICloneableFormat`](xref:Yarhl.FileFormat.ICloneableFormat) gives the
8 | possibility to a format implementation to specify how it should _deep_ clone its
9 | data into a new format. This could be as simple as copying its properties into a
10 | new object or in the case of binary data, copying all its bytes into a new
11 | stream.
12 |
13 | [!code-csharp[cloneable](./../../../../src/Yarhl.Examples/Formats/Formats.cs?name=CloneableFormat)]
14 |
15 | The interface already implements `IFormat` so it's not needed to add both.
16 |
17 | > [!IMPORTANT]
18 | > This interface is not required to be implemented by every format but some APIs
19 | > of the library relies on it. For instance it's only possible to clone a
20 | > [node via its constructor]()
21 | > if it has a format that implements
22 | > [`ICloneableFormat`](xref:Yarhl.FileFormat.ICloneableFormat).
23 |
24 | > [!TIP]
25 | > The built-in formats from _Yarhl_ implements
26 | > [`ICloneableFormat`](xref:Yarhl.FileFormat.ICloneableFormat).
27 |
--------------------------------------------------------------------------------
/src/Yarhl/IO/Serialization/FieldInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Yarhl.IO.Serialization;
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 |
7 | ///
8 | /// Information of a field member of a type.
9 | ///
10 | /// Name of the field.
11 | /// Type of the field.
12 | /// Function that returns the fields' value given the object.
13 | ///
14 | /// Function that sets the fields'value on the given object.
15 | /// The first argument is the object and the second the value to set.
16 | ///
17 | /// Optional collection of attributes on the field.
18 | public record FieldInfo(
19 | string Name,
20 | Type Type,
21 | Func