reckfellENGINE

ZipReader

Read ZIP entries into memory without automatic disk extraction.

On this page
class ZipReaderReckfellSharpInherits RefCounted

Create an owned ZipReader, check Open, then use GetFiles/FileExists/ReadFile and explicit Close. A RefCounted object rather than Resource; dispose after use. Open replaces a previous archive by closing it before the next attempt: failure does not preserve the old session.

GetFiles returns a flat list of actual records including slash-terminated directories and duplicate names. Virtual parent directories are not synthesized. ReadFile loads the whole decompressed entry into byte[] rather than a stream; an empty result can mean an empty file or a diagnosed failure. The method creates no files on disk.

ReadFile uses engine Unicode path lookup while FileExists/GetCompressionLevel use minizip lookup, so Unicode case-insensitive matching can differ. Use exact names from GetFiles. Duplicate names are not versions: ReadFile selects the first match. GetCompressionLevel derives a category from ZIP flags rather than recovering the original packer setting.

Windows headless checks and independent Python reads covered our small archives. Corrupt/huge/ZIP64 input, disk extraction, memory limits and cross-platform behavior were not accepted. Names from an external archive are not ready-made safe destination paths for a custom extractor.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

ZipReaderConstructor
# ZipReader
C#
public ZipReader();

Creates an owned closed reader without an open file. Use entry operations after successful Open; check Close explicitly, then dispose the object.

Methods6

CloseError
# Close
C#
public Error Close();

Closes a successfully opened archive. Check Error.Ok; closing an already closed object produces a diagnostic rather than an idempotent success. Does not dispose the RefCounted object.

Returns Error

Error.Ok on success; otherwise a stage error rather than a guarantee of unchanged file contents.

FileExistsbool
# FileExists
C#
public bool FileExists(string path, bool caseSensitive = true);

Tests locating and opening an entry rather than content integrity. Case-sensitive by default; a directory requires its actual slash-terminated name. caseSensitive=false uses minizip lookup and can disagree with ReadFile for Unicode.

Parameters
NameTypeDefault
pathstring—
caseSensitivebooltrue
path

Exact internal ZIP name, normally relative with /; not a local destination or source-data path.

caseSensitive

true is case-sensitive by default. false uses different Unicode lookup implementations in ReadFile versus FileExists/GetCompressionLevel; prefer exact GetFiles names.

Returns bool

true when an entry can be located and opened; not CRC validation.

GetCompressionLevelint
# GetCompressionLevel
C#
public int GetCompressionLevel(string path, bool caseSensitive = true);

Returns a minizip header-flag category, typically 1, 2, 6 or 9, or -1 when unavailable. Not the original packer setting: our level-0 or level-3 records return 6. caseSensitive=false uses the FileExists lookup path rather than ReadFile.

Parameters
NameTypeDefault
pathstring—
caseSensitivebooltrue
path

Exact internal ZIP name, normally relative with /; not a local destination or source-data path.

caseSensitive

true is case-sensitive by default. false uses different Unicode lookup implementations in ReadFile versus FileExists/GetCompressionLevel; prefer exact GetFiles names.

Returns int

ZIP flag category rather than exact original level; -1 when unavailable.

GetFilesstring[]
# GetFiles
C#
public string[] GetFiles();

Returns a new string[] of actual record names in archive traversal order including slash-terminated directories and duplicates. Extracts no files and synthesizes no missing parent records. Array edits change no archive.

Returns string[]

New array of actual entry names including directories and duplicates.

OpenError
# Open
C#
public Error Open(string path);

Opens a ZIP file through FileAccess for reading. Closes a previous archive first; a new failure does not preserve it. Returns Error.Ok/Failed and does not validate every entry CRC at open time.

Parameters
NameTypeDefault
pathstring—
path

FileAccess archive path; writing requires a writable existing directory. Not an internal ZIP record name.

Returns Error

Error.Ok on success; otherwise a stage error rather than a guarantee of unchanged file contents.

ReadFilebyte[]
# ReadFile
C#
public byte[] ReadFile(string path, bool caseSensitive = true);

Reads the entire decompressed entry into an independent byte[]. Checks read errors and completion CRC; failure returns an empty array with a diagnostic. An empty entry also returns an empty array. Allocates from declared size; the code checks INT_MAX but large/ZIP64 archives were not accepted in this review. Extracts nothing to disk. Selects the first duplicate name.

Parameters
NameTypeDefault
pathstring—
caseSensitivebooltrue
path

Exact internal ZIP name, normally relative with /; not a local destination or source-data path.

caseSensitive

true is case-sensitive by default. false uses different Unicode lookup implementations in ReadFile versus FileExists/GetCompressionLevel; prefer exact GetFiles names.

Returns byte[]

New decompressed byte array; empty for an empty record or a diagnosed failure.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.