DiagKit.FlashFiles
1.0.0
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package DiagKit.FlashFiles --version 1.0.0
NuGet\Install-Package DiagKit.FlashFiles -Version 1.0.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="DiagKit.FlashFiles" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DiagKit.FlashFiles" Version="1.0.0" />
<PackageReference Include="DiagKit.FlashFiles" />
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 DiagKit.FlashFiles --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DiagKit.FlashFiles, 1.0.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.
#:package DiagKit.FlashFiles@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DiagKit.FlashFiles&version=1.0.0
#tool nuget:?package=DiagKit.FlashFiles&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DiagKit.FlashFiles
An automotive diagnostic flash file parsing library, supporting Intel MCS-86 HEX (.hex) and Motorola S-Record (.s19/.s28/.s37) formats for ECU reflashing, UDS download flows, and flash data verification.
Installation
dotnet add package DiagKit.FlashFiles
Quick Start
using DiagKit.FlashFiles;
using DiagKit.FlashFiles.Define.Enumerates;
// Load from file path — auto-detects .hex/.s19/.s28/.s37 by extension
using var doc = FlashDocument.Load("firmware.hex", dataSize: 2);
// Load from Stream — format must be specified
using var fromStream = FlashDocument.Load(stream, FlashFileType.Intel_MCS_86, dataSize: 2);
// Load from in-memory bytes — format must be specified
using var fromBytes = FlashDocument.Load(data, FlashFileType.Motorola_S_Record, dataSize: 1);
Core API
doc.StartAddress // Start address
doc.EndAddress // End address
doc.ByteCount // Total bytes (ulong)
doc.AddressCount // Total addresses (ulong)
doc.DataSize // Bytes per address
doc.Blocks // IReadOnlyList<FlashBlock>
// O(log n) address lookup
var exists = doc.ContainsAddress(0x003E8500);
var word = doc.ReadAt(0x003E8500);
var range = doc.ReadRange(0x003E8500, 0x003E850F);
// Modify data
doc.WriteAt(0x003E8500, new byte[] { 0xAA, 0xBB });
doc.WriteRange(0x003E8500, 0x003E8501, new byte[] { 0xAA, 0xBB, 0xCC, 0xDD });
// UDS page filling
using var page = new FlashPage(addressCount: 0x100, dataSize: 2);
var hasData = doc.TryFillPage(page, doc.StartAddress);
// Enumerate pages — caller is responsible for disposing each FlashPage
foreach (var item in doc.EnumeratePages(0x100, doc.StartAddress, doc.EndAddress))
{
using (item)
{
// Process item.Data
}
}
// Filter blank pages
var pages = doc.EnumeratePages(0x100, doc.StartAddress, doc.EndAddress).ToList();
var filtered = FlashDocument.FilterPages(pages, skipLeadingBlank: true, skipMiddleBlank: true, skipTrailingBlank: true);
Save as Intel HEX
Intel MCS-86 HEX output is currently supported. Motorola S-Record writing is not yet implemented.
using var output = File.Create("firmware.hex");
doc.Save(output, FlashFileType.Intel_MCS_86);
doc.SaveToFile("firmware.hex");
CRC-32
using DiagKit.FlashFiles.Common.Utilities;
uint mpeg2 = UdsCrc32.Mpeg2.Compute(data);
uint standard = UdsCrc32.Standard.Compute(data);
uint posix = UdsCrc32.Posix.Compute(data);
uint autosar = UdsCrc32.AutoSar.Compute(data);
Build & Test
dotnet build .\src\DiagKit.FlashFiles\DiagKit.FlashFiles.csproj
dotnet test .\tests\DiagKit.FlashFiles.Tests\DiagKit.FlashFiles.Tests.csproj
dotnet pack .\src\DiagKit.FlashFiles\DiagKit.FlashFiles.csproj -c Release
Project Info
- Target frameworks:
net8.0,net10.0 - License: MIT
- Package ID:
DiagKit.FlashFiles - Dependencies: none
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
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.1.0-preview.2 | 39 | 5/21/2026 |
| 1.1.0-preview | 82 | 5/20/2026 |
| 1.0.0 | 88 | 5/13/2026 |
| 1.0.0-preview.1 | 49 | 5/13/2026 |
Complete refactoring: new Load API, thread-safe parsing, O(log n) address lookup, Stream support, fixed CRC32 refOut bug.