{"id":25002636,"url":"https://github.com/skwasjer/silenthunter","last_synced_at":"2025-04-12T11:41:33.396Z","repository":{"id":40909727,"uuid":"49097632","full_name":"skwasjer/SilentHunter","owner":"skwasjer","description":"Silent Hunter 3/4/5 file parsers","archived":false,"fork":false,"pushed_at":"2025-02-10T22:59:17.000Z","size":4361,"stargazers_count":4,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T23:45:56.295Z","etag":null,"topics":["hunter","parser","silent"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skwasjer.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-05T22:52:04.000Z","updated_at":"2025-01-12T01:15:35.000Z","dependencies_parsed_at":"2025-01-10T07:17:22.008Z","dependency_job_id":null,"html_url":"https://github.com/skwasjer/SilentHunter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skwasjer%2FSilentHunter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skwasjer%2FSilentHunter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skwasjer%2FSilentHunter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skwasjer%2FSilentHunter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skwasjer","download_url":"https://codeload.github.com/skwasjer/SilentHunter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248563323,"owners_count":21125258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hunter","parser","silent"],"created_at":"2025-02-04T21:53:13.809Z","updated_at":"2025-04-12T11:41:33.375Z","avatar_url":"https://github.com/skwasjer.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Silent Hunter 3/4/5 file parsers\n\nThis repository contains:\n- Silent Hunter game file parsers (with extensions `.dat`, `.sim`, `.zon`, `.dsd`, `.cam`, `.val`, `.sdl`, `.off`)\n- Silent Hunter controller templates\n- Dynamic code compiler (for controller templates)\n\n---\n\n[![Main workflow](https://github.com/skwasjer/SilentHunter/actions/workflows/main.yml/badge.svg)](https://github.com/skwasjer/SilentHunter/actions/workflows/main.yml)\n\n| | |\n|---|---|\n| `SilentHunter.FileFormats` | [![NuGet](https://img.shields.io/nuget/v/SilentHunter.FileFormats.svg)](https://www.nuget.org/packages/SilentHunter.FileFormats/) [![NuGet](https://img.shields.io/nuget/dt/SilentHunter.FileFormats.svg)](https://www.nuget.org/packages/SilentHunter.FileFormats/) |\n| `SilentHunter.Controllers` | [![NuGet](https://img.shields.io/nuget/v/SilentHunter.Controllers.svg)](https://www.nuget.org/packages/SilentHunter.Controllers/) [![NuGet](https://img.shields.io/nuget/dt/SilentHunter.Controllers.svg)](https://www.nuget.org/packages/SilentHunter.Controllers/) |\n| `SilentHunter.Controllers.Templates` | [![NuGet](https://img.shields.io/nuget/v/SilentHunter.Controllers.Templates.svg)](https://www.nuget.org/packages/SilentHunter.Controllers.Templates/) [![NuGet](https://img.shields.io/nuget/dt/SilentHunter.Controllers.Templates.svg)](https://www.nuget.org/packages/SilentHunter.Controllers.Templates/) |\n| `SilentHunter.Controllers.Compiler` | [![NuGet](https://img.shields.io/nuget/v/SilentHunter.Controllers.Compiler.svg)](https://www.nuget.org/packages/SilentHunter.Controllers.Compiler/) [![NuGet](https://img.shields.io/nuget/dt/SilentHunter.Controllers.Compiler.svg)](https://www.nuget.org/packages/SilentHunter.Controllers.Compiler/) |\n\n\n## Why?\n\nOver a decade ago, I wrote a popular modding application called S3D (http://s3d.skwas.com) for Silent Hunter game files. Back then, I used some proprietary code to do so (from my own business). Fast forward to today - for posterity sake - I took some time to clean up the old code base and release it for everyone to use.\n\nThis repository only covers the parsing logic and controller templates, but time permitted I will try to release S3D source code too in the future.\n\n\u003e Important: this is not fully backward compatible with S3D's controller templates that were released in 2009. This is due some refactoring done to make it more usuable in open source context. If you have updated/added/improved controllers, please submit a PR.\n\n## Usage\n\nThere are two ways to configure the parsers:\n\n- Using a dynamically compiled controller assembly\n- Using a precompiled controller assembly\n\nS3D specifically uses the dynamic controller assembly. This enabled modders to modify the controller templates, after which S3D would be able to use the new templates.\n\nWhich method you choose depends on how you wish to distribute your application. If you do not care much about this, simply use the precompiled package.\n\n## Configuration\n\nThe file parsers are developed with dependency injection for `IServiceCollection` in mind, allowing you to inject the parsers in your own code base. As such, you need to configure the container before being able to use the parsers.\n\n### Using a dynamically compiled controller assembly\n\n```powershell\nInstall-Package SilentHunter.Controllers.Templates\nInstall-Package SilentHunter.Controllers.Compiler\nInstall-Package SilentHunter.FileFormats\n```\n\nBy adding the package `SilentHunter.Controllers.Templates`, the template source files are added to your application build output directory.\n\nThe benefit of using the dynamic compiled assembly is that controllers can be updated without rebuilding/redistributing the whole application, and at the same time allowing modders control over the controller templates (hence why I did this for S3D).\n\n```csharp\nIServiceCollection services = ...\n\nstring controllerPath = \"path to the controllers\";\n\n// Add services\nservices\n    .AddSilentHunterParsers(configurer =\u003e configurer\n        .Controllers.CompileFrom(\n            controllerPath,\n            assemblyName: \"Controllers\"\n        )\n    );\n```\n\n### Using a precompiled controller assembly\n\nThe benefit of using the precompiled assembly is that you have strong typed access to all controllers and don't have to use reflection.\n\n```powershell\nInstall-Package SilentHunter.Controllers\nInstall-Package SilentHunter.FileFormats\n```\n\n```csharp\nIServiceCollection services = ...\n\n// Add services\nservices\n    .AddSilentHunterParsers(configurer =\u003e configurer\n        .Controllers.FromAssembly(typeof(ParticleGenerator).Assembly)\n    );\n```\n\n## Using the file parsers\n\n### DatFile\n\n```csharp\nIServiceProvider serviceProvider = ...  // Or inject into your classes directly.\n\n// Request (transient) instance of DatFile\nDatFile datFile = serviceProvider.GetRequiredService\u003cDatFile\u003e();\nusing (var fsIn = File.OpenRead(...))\nusing (var fsOut = File.OpenWrite(...))\n{\n    await datFile.LoadAsync(fsIn);\n\n    var newChunk = datFile.CreateChunk\u003cLabelChunk\u003e();\n    newChunk.Text = \"My new label\";\n    datFile.Chunks.Add(newChunk);\n\n    await datFile.SaveAsync(fsOut);\n}\n```\n\n\u003e This example uses `IServiceProvider` directly. It is better to design classes and inject `DatFile`, `SdlFile` or `OffFile` instances in there to work with.\n\n### SdlFile / OffFile\n\nFor SDL and OFF files, the principle is the same. Simply request a new instance from the service container or inject into a class:\n\n```csharp\nSdlFile sdlFile = serviceProvider.GetRequiredService\u003cSdlFile\u003e();\nawait sdlFile.LoadAsync(..filename..);\nvar newSound = new SoundInfo\n{\n    Name = \"sound_name\",\n    WaveName = \"sound.wav\",\n    Volume = 0.9f,\n    ..\n};\nsdlFile.Add(newSound);\n```\n\n```csharp\nOffFile offFile = serviceProvider.GetRequiredService\u003cOffFile\u003e();\nawait offFile.LoadAsync(..filename..);\nvar newChar = new OffCharacter\n{\n    Character = 'A',\n    BoundingBox = new Rectangle\n    {\n        X = 10,\n        Y = 20,\n        Width = 30,\n        Height = 40\n    }\n}\noffFile.Add(newChar);\n```\n\n### Contributions\nPR's are welcome. Please rebase before submitting, provide test coverage, and ensure the AppVeyor build passes. I will not consider PR's otherwise.\n\n### Contributors\n- skwas (author/maintainer)\n\n### Target Frameworks\n- .NET Standard 2.0\n- .NET 4.6.1\n\n### Build requirements\n- Visual Studio 2017/2019\n- .NET Core 2.2 SDK\n- .NET 4.6.1 targetting pack\n\n### Useful info\n\n- [Changelog](Changelog.md)\n- [S3D website](http://s3d.skwas.com)\n- [S3D release thread at SubSim.com](https://www.subsim.com/radioroom/showthread.php?t=119571)\n\n#### With thanks to\n\nUbisoft, Silent Hunter development team, SubSim.com\n\nAlso individuals:  \nCaptainCox, leovampire, the modders at Submarine Sim Central, tater, Anvart, Bando, WEBSTER, maikarant, Jace11, WilhelmTell, lurbz, Sansal, longam, PepsiCan, UBOAT234, Digital_Trucker, DirtyHarry3033, Kaleun_Endrass, sergbuto, SquareSteelBar, sober, jaketoox, reallydedpoet, swdw, nautilus42, nvdrifter, kapitan_zur_see, DeepIron, panthercules, l3th4l, Laffertytig, alamwuhk2a, privateer, g_BonE, Ducimus,  lurker_hlb3, haegemon, wildchild, urfisch, LukeFF, ref, kikn79, WernerSobe, Redwine, GuillermoZS, keltos01, Mikhayl, Kriller2, DrBeast, jimbob, Rubini, M. Sarsfield, miner1436, AVGWarhawk, reallydedpoet, Subject, and those who have been debugging the file formats long before me.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskwasjer%2Fsilenthunter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskwasjer%2Fsilenthunter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskwasjer%2Fsilenthunter/lists"}