ShockwaveFlash 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ShockwaveFlash --version 1.0.0
                    
NuGet\Install-Package ShockwaveFlash -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="ShockwaveFlash" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ShockwaveFlash" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ShockwaveFlash" />
                    
Project file
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 ShockwaveFlash --version 1.0.0
                    
#r "nuget: ShockwaveFlash, 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 ShockwaveFlash@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=ShockwaveFlash&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ShockwaveFlash&version=1.0.0
                    
Install as a Cake Tool

ShockwaveFlash

A fast, allocation-light reader and writer for the SWF (Shockwave Flash) binary format, written for .NET 10.

Disassemble a .swf file into a strongly-typed tag tree, inspect or edit it in code, then assemble it back. Re-assembly is byte-identical to the input it was parsed from — validated by round-tripping a real corpus of production files.

Features

  • Reader and writer for the SWF container and its tag stream — every supported tag round-trips.
  • Byte-identical assembly: parse then assemble reproduces the original bytes exactly.
  • Broad tag coverage (shapes, fonts, text, sounds, bitmaps, sprites, buttons, morph shapes, video, ABC, filters, control tags). Unknown tags are preserved verbatim, so nothing is lost on round-trip.
  • Exact fixed-point types (Fixed16 16.16, Fixed8 8.8) — no lossy float conversions in the wire model.
  • Compression: reads FWS (uncompressed), CWS (zlib) and ZWS (LZMA); writes uncompressed and zlib.
  • Typed exceptions (SwfFormatException, SwfTruncatedException, SwfUnsupportedException, SwfCompressionException) for precise error handling on malformed input.
  • No unsafe in your code path, no Span plumbing — the public surface works over ReadOnlyMemory<byte>.

Install

dotnet add package ShockwaveFlash

Quick start

Read

using ShockwaveFlash;

var bytes = File.ReadAllBytes("movie.swf");
var swf = ShockwaveFlashFile.Disassemble(bytes);

Console.WriteLine($"SWF v{swf.Header.Version} ({swf.Header.Compression})");
Console.WriteLine($"Frame size : {swf.Header.FrameSize}");
Console.WriteLine($"Frame rate : {swf.Header.FrameRate.ToSingle()} fps");
Console.WriteLine($"Frames     : {swf.Header.FrameCount}");
Console.WriteLine($"Tags       : {swf.Tags.Count}");

foreach (var tag in swf.Tags)
    Console.WriteLine($"  {tag.Metadata.Code} ({tag.Metadata.Length} bytes)");

Write

ShockwaveFlashFile is an immutable record, so edits are expressed with with:

using ShockwaveFlash;
using ShockwaveFlash.Tags;

var swf = ShockwaveFlashFile.Disassemble(File.ReadAllBytes("movie.swf"));

var trimmed = swf with
{
    Tags = swf.Tags.Where(tag => tag.Metadata.Code is not TagCode.Metadata).ToList()
};

ReadOnlyMemory<byte> output = trimmed.Assemble();
File.WriteAllBytes("movie.trimmed.swf", output.ToArray());

Round-trip

var original = File.ReadAllBytes("movie.swf");
var rebuilt = ShockwaveFlashFile.Disassemble(original).Assemble();

// Reproduces the original bytes exactly.
bool identical = rebuilt.Span.SequenceEqual(original);

Error handling

Malformed input throws a SwfException (or one of its derived types) rather than corrupting state:

using ShockwaveFlash.Exceptions;

try
{
    var swf = ShockwaveFlashFile.Disassemble(bytes);
}
catch (SwfTruncatedException)
{
    // the buffer ended before a record was complete
}
catch (SwfFormatException)
{
    // the bytes are not a valid SWF
}

License

MIT © Aerafal

Product Compatible and additional computed target framework versions.
.NET 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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ShockwaveFlash:

Package Downloads
ShockwaveFlash.Avm1

AVM1 (ActionScript 1/2 bytecode) decoder, encoder and data evaluator for the ShockwaveFlash SWF library. Disassemble DoAction bytecode to a typed action model, evaluate data scripts to a value tree, and write edits back.

ShockwaveFlash.Rendering

Render SWF characters (shapes, sprites, timelines, images) parsed by ShockwaveFlash to SVG and to raster images (PNG/JPEG/WebP/GIF) through a native, cross-platform Skia backend.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.8.0 133 7/8/2026
1.7.0 122 7/7/2026
1.6.0 198 6/29/2026
1.5.0 122 6/29/2026
1.4.0 132 6/27/2026
1.3.0 130 6/27/2026
1.2.0 121 6/27/2026
1.1.0 110 6/26/2026
1.0.0 100 6/25/2026