ShockwaveFlash 1.2.0
See the version list below for details.
dotnet add package ShockwaveFlash --version 1.2.0
NuGet\Install-Package ShockwaveFlash -Version 1.2.0
<PackageReference Include="ShockwaveFlash" Version="1.2.0" />
<PackageVersion Include="ShockwaveFlash" Version="1.2.0" />
<PackageReference Include="ShockwaveFlash" />
paket add ShockwaveFlash --version 1.2.0
#r "nuget: ShockwaveFlash, 1.2.0"
#:package ShockwaveFlash@1.2.0
#addin nuget:?package=ShockwaveFlash&version=1.2.0
#tool nuget:?package=ShockwaveFlash&version=1.2.0
ShockwaveFlash
A fast, allocation-light reader and writer for the SWF (Shockwave Flash) binary format, for .NET 10.
Disassemble a .swf into a strongly-typed tag tree, inspect or edit it in code, then assemble it back — the round-trip is lossless: byte-identical for canonically-encoded SWFs and byte-stable on re-encode, validated on a real corpus of production files.
Install
dotnet add package ShockwaveFlash
Read
using ShockwaveFlash;
var swf = ShockwaveFlashFile.Disassemble(File.ReadAllBytes("movie.swf"));
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($"Tags : {swf.Tags.Count}");
foreach (var tag in swf.Tags)
Console.WriteLine($" {tag.Metadata.Code} ({tag.Metadata.Length} bytes)");
Edit & write
The movie and its tags are mutable, so edit them in place — Tags is a List<Tag> and every tag exposes settable properties:
using ShockwaveFlash;
using ShockwaveFlash.Tags;
var swf = ShockwaveFlashFile.Disassemble(File.ReadAllBytes("movie.swf"));
swf.Tags.RemoveAll(tag => tag.Metadata.Code is TagCode.Metadata);
File.WriteAllBytes("movie.trimmed.swf", swf.Assemble().ToArray());
Round-trip
var original = File.ReadAllBytes("movie.swf");
var rebuilt = ShockwaveFlashFile.Disassemble(original).Assemble();
// true for canonically-encoded SWFs; always byte-stable on a second pass.
bool identical = rebuilt.Span.SequenceEqual(original);
Error handling
Malformed input throws a typed SwfException rather than corrupting state:
using ShockwaveFlash.Exceptions;
try
{
var swf = ShockwaveFlashFile.Disassemble(bytes);
}
catch (SwfTruncatedException) { /* buffer ended mid-record */ }
catch (SwfFormatException) { /* not a valid SWF */ }
Notes
- Coverage — shapes, fonts, text, sounds, bitmaps, sprites, buttons, morph shapes, video, ABC, filters and control tags. Unknown tags are preserved verbatim, so nothing is lost on round-trip.
- Exact wire model — fixed-point types (
Fixed1616.16,Fixed88.8); no lossyfloatconversions. - Compression —
FWS(uncompressed),CWS(zlib) andZWS(LZMA), all read and write. - No
unsafe, noSpanplumbing — the public surface works overReadOnlyMemory<byte>.
Part of the ShockwaveFlash project · MIT © Aerafal
| Product | Versions 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. |
-
net10.0
- SharpCompress (>= 0.39.0)
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.