You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support all .ms10..ms19 files + content-based format detection
The decoder was hardcoded to two extensions (.ewprj, .ms14) with the
matching headers baked into decode.ts. Replace that with a content-driven
approach: the file's magic bytes determine the format, so any compressed
EW file decodes regardless of filename.
- New `src/formats.ts` is the single source of truth: a `FORMATS` table
with one entry per container variant (key, label, header, extension
pattern), plus helpers (`detectFormatByHeader`, `formatForExtension`,
`formatByKey`, `knownFormatsList`).
- `decode.ts` now reads the longest known header up front, identifies
the format from the bytes, and rewinds the file position if the actual
match is shorter than the read.
- `encode.ts`: `encode()` takes an options object with an optional
`format` override; `headerFor` is kept as a thin wrapper for tests.
`ewe` exposes the override as `--format <key>` (e.g. for renamed files
or unconventional extensions).
- Coverage: Multisim 10 through 19 are recognized by extension; .ms13
and .ms14 are content-verified, the rest are extrapolated. Out-of-range
versions still work via `--format multisim`.
Verified end-to-end: decoded a real DanceDongle.ms13 (Multisim 13
schema 66) and round-tripped it byte-identical. 43 tests pass across
3 files, biome+tsc clean.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0 commit comments