Skip to content

Add DeviceDetector.NET.Icons extension (icon path resolution)#103

Merged
totpero merged 12 commits into
masterfrom
icon-integration
Jul 13, 2026
Merged

Add DeviceDetector.NET.Icons extension (icon path resolution)#103
totpero merged 12 commits into
masterfrom
icon-integration

Conversation

@totpero

@totpero totpero commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #101 — adds a new DeviceDetector.NET.Icons extension project that resolves icon file
paths for detection results (bots, browsers, operating systems, clients, device brands/types),
porting the resolution/fallback/sanitization logic of
Simbiat/DeviceDetectorIcons (MIT licensed).
No icon image assets are vendored — consumers point IconResolver at their own copy of an icon
pack.

Design and implementation plan (not included in this branch — internal planning docs kept out of
the repo):
docs/superpowers/specs/2026-07-10-icon-integration-design.md and
docs/superpowers/plans/2026-07-10-icon-integration.md.

What's included

  • DeviceDetector.NET.Icons project (netstandard2.0;net462;net8.0;net9.0;net10.0)
  • IconResolverOptions with defaults matching upstream DDCIcons.php (extension priority,
    name-sanitization table, fallback icon, URL base path)
  • IconResolver: full 1:1 port of the PHP resolution/fallback-chain logic (bot→category,
    browser→family→engine→generic, os→family→generic, client→type, brand→device-type), plus
    convenience overloads accepting DeviceDetector.NET's own result types
    (GetBot(BotMatchResult), GetBrowser(BrowserMatchResult), etc.) and a one-shot
    GetIcons(DeviceDetectorResult) returning a DeviceIconPaths bundle
  • AddDeviceDetectorIcons(...) DI registration helper (IServiceCollection extension)
  • Pluggable FileExists override (e.g. to back it with an IFileProvider/CDN instead of raw disk)
  • Extensible NameReplacements table
  • Full README with usage examples and MIT attribution for the ported algorithm
  • Main README's "Icon packs" section now links to the new package
  • 42 tests: options defaults, construction/validation, every fallback chain, extension-priority
    ordering, name sanitization, result-type overloads, a FileExists override test, a
    NameReplacements extension test, DI registration, and 2 end-to-end tests against real parsed
    user agents (Chrome/Windows, Googlebot)

Test plan

  • dotnet test DeviceDetector.NET.Icons.Tests/DeviceDetector.NET.Icons.Tests.csproj — 42/42 passing
  • dotnet build DeviceDetector.NET.sln — builds clean across all target frameworks, 0 warnings/errors
  • DeviceDetector.NET.Tests baseline (206/206) confirmed clean before this branch's work started; no production code in the core DeviceDetector.NET project was touched by this PR

@totpero
totpero force-pushed the icon-integration branch from 0f51922 to 65307c5 Compare July 13, 2026 08:44
@totpero
totpero marked this pull request as ready for review July 13, 2026 08:45
@totpero
totpero force-pushed the icon-integration branch from 65307c5 to 414f1a2 Compare July 13, 2026 08:48
@totpero totpero self-assigned this Jul 13, 2026
@totpero
totpero merged commit 153c7c1 into master Jul 13, 2026
1 of 3 checks passed
totpero pushed a commit that referenced this pull request Jul 14, 2026
Resolved conflicts in DeviceDetector.NET.sln: kept both the new
DeviceDetector.NET.Cli project entries (local) and the
DeviceDetector.NET.Icons / DeviceDetector.NET.Icons.Tests entries
(origin, PR #103). Dropped one duplicated ProjectConfigurationPlatforms
block for the Web/Serilog-enricher GUIDs that was identical to content
already present elsewhere in the file.
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.

Icons integration

1 participant