Skip to content

feat: extract NosCore.ClientTools so a launcher can reuse the client plumbing - #18

Open
erwan-joly wants to merge 2 commits into
masterfrom
feat/extract-client-tools
Open

feat: extract NosCore.ClientTools so a launcher can reuse the client plumbing#18
erwan-joly wants to merge 2 commits into
masterfrom
feat/extract-client-tools

Conversation

@erwan-joly

@erwan-joly erwan-joly commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Groundwork for the .NET 10 rewrite of NosCoreLegend/Launcher. That launcher needs exactly three things this repo already has — NosCoreAuthClient, ClientPatcher, and the noscore_gf.dll stub — but they live inside a WinExe, so nothing outside this repo can reference them.

What moves

src/NosCore.ClientToolsnet10.0, AnyCPU, packable as NosCore.ClientTools:

  • NosCoreAuthClient (moved verbatim)
  • ClientPatcher + EntryPatchMode (moved verbatim)
  • GfStub (new) — FileName, OpenStream(), DeployTo(dir). PatchImportName now writes GfStub.FileName rather than its own copy of the literal, so the "both names are 14 chars" invariant has one owner.

The GfStub publish-and-embed target moves here too. NosCore.DeveloperTools keeps the Hook payload and picks the rest up by ProjectReference; MainForm's inline GetManifestResourceStream block collapses to GfStub.DeployTo(outDir).

No behaviour change — the stub is byte-identical and the patch logic is untouched.

Why AnyCPU

The x86 constraint exists for same-arch injection. A launcher only spawns the client, so it has no reason to inherit it; the stub travels as prebuilt bytes, not as code.

Solution build fix

Dropped Build.0 for NosCore.DeveloperTools.Hook and NosCore.DeveloperTools.GfStub. The solution was building them AnyCPU while the Exec targets ran dotnet publish -r win-x86 on them concurrently, racing on the same obj/ directory:

CSC : error CS2012: Cannot open '...GfStub/obj/Debug/net10.0/win-x86/noscore_gf.dll' for writing
error MSB3491: Could not write lines to file "obj/.../Hook.csproj.FileListAbsolute.txt"

Latent on master — adding a third project changed the scheduling enough to start losing it. These are RID-specific payloads, so an AnyCPU solution build of them was wasted work regardless; they still build in the IDE and are still published by the Exec targets.

Verified

dotnet build clean (0 warnings, TreatWarningsAsErrors on). Packed and consumed the .nupkg from a throwaway console app:

OpenStream length = 678912
DeployTo -> noscore_gf.dll (678912 bytes)

Not in this PR

  • No NuGet publish workflow — my token lacks the workflow scope, so I can't push .github/workflows/*. Needed before the Launcher repo can PackageReference this.
  • Conflicts with feat: drive the client's own walk routine from the hook #15: its ClientDriver.cs uses NosCoreAuthClient from the old namespace. One-line fix (using NosCore.ClientTools;) on whichever merges second.

Summary by CodeRabbit

  • New Features

    • Added client tooling for patching client imports and deploying the required compatibility component.
    • Added a reusable client authentication toolset.
    • Packaged the compatibility component for easier distribution and deployment.
  • Improvements

    • Updated the developer tools patching workflow to use the new client tooling, simplifying setup and improving consistency.
    • Standardized the compatibility component name used during patching and deployment.

…plumbing

The auth flow and the PE patches are not packet-logger concerns — they are
what any NosCore-facing launcher needs: trade credentials for an auth code,
point a client binary at a server, and hand it a gf_wrapper replacement.
They lived in a WinExe, so nothing outside this repo could reference them.

Moves NosCoreAuthClient and ClientPatcher into a packable AnyCPU library and
gives the embedded stub a real API (GfStub.OpenStream / DeployTo) instead of
a bare GetManifestResourceStream call in MainForm. The x86 constraint stays
where it belongs: on the injector and the stub, not on consumers that only
spawn the client.

Also drops Build.0 for the two NativeAOT payload projects. The solution was
building them AnyCPU while the Exec targets published them for win-x86 at
the same time, racing on the same obj/ directory. Adding a third project
changed the scheduling enough to start losing that race.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 8ea8fa2e-43b3-44c5-9174-d5cb1f807f2f

📥 Commits

Reviewing files that changed from the base of the PR and between 5b2afa3 and 1c2a40a.

📒 Files selected for processing (1)
  • src/NosCore.ClientTools/NosCore.ClientTools.csproj

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c55c969f-328c-43bc-9e4a-8ea7256ab52b

📥 Commits

Reviewing files that changed from the base of the PR and between 267726f and 5b2afa3.

📒 Files selected for processing (8)
  • NosCore.DeveloperTools.sln
  • src/NosCore.ClientTools/ClientPatcher.cs
  • src/NosCore.ClientTools/GfStub.cs
  • src/NosCore.ClientTools/NosCore.ClientTools.csproj
  • src/NosCore.ClientTools/NosCoreAuthClient.cs
  • src/NosCore.DeveloperTools/Forms/MainForm.cs
  • src/NosCore.DeveloperTools/Models/AppSettings.cs
  • src/NosCore.DeveloperTools/NosCore.DeveloperTools.csproj

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a NosCore.ClientTools project that packages the NativeAOT gf-wrapper payload. It moves client patching APIs into that project and updates NosCore.DeveloperTools to deploy the payload through GfStub.

Changes

ClientTools integration

Layer / File(s) Summary
ClientTools project and solution registration
NosCore.DeveloperTools.sln, src/NosCore.ClientTools/NosCore.ClientTools.csproj
The solution registers NosCore.ClientTools. The project publishes the x86 NativeAOT stub and embeds noscore_gf.dll in the package.
Payload API and client patching
src/NosCore.ClientTools/GfStub.cs, src/NosCore.ClientTools/ClientPatcher.cs, src/NosCore.ClientTools/NosCoreAuthClient.cs
GfStub exposes payload deployment. ClientPatcher uses GfStub.FileName. ClientTools types use the new namespace.
DeveloperTools deployment integration
src/NosCore.DeveloperTools/NosCore.DeveloperTools.csproj, src/NosCore.DeveloperTools/Forms/MainForm.cs, src/NosCore.DeveloperTools/Models/AppSettings.cs
DeveloperTools references ClientTools, removes its local payload build target, and calls GfStub.DeployTo during patch execution.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant MainForm
  participant GfStub
  participant EmbeddedResource
  MainForm->>GfStub: DeployTo(outDir)
  GfStub->>EmbeddedResource: Open embedded noscore_gf.dll
  EmbeddedResource-->>GfStub: Return payload stream
  GfStub-->>MainForm: Return deployed DLL path
Loading

Merge Risk: ⚪ Minimal · up to 5b2af

The payload extraction preserves the shared DLL-name and deployment contract, with no actionable merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: extracting NosCore.ClientTools so launcher code can reuse client functionality.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/extract-client-tools

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant