Skip to content

Class ZipSource

Namespace: Apogee.Content.FileSystem
Assembly: Apogee.Content.dll

A zip file, for mods that ship as one. The directory is read when it is opened; entries whose names are not valid paths (.., absolute, a backslash that does not make a valid path) are skipped with a warning, so that no entry can name a place outside the zip. Files are inflated on read, whole.

public sealed class ZipSource : IFileSource, IDisposable

Inheritance

object ← ZipSource

Implements

IFileSource, IDisposable

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

ZipSource(string)

Opens the zip file at path.

public ZipSource(string path)

Parameters

path string

ZipSource(Stream, string)

Opens a zip from a stream (which this takes over: it is closed with the source).

public ZipSource(Stream stream, string description)

Parameters

stream Stream

description string

Properties

Description

What the source is, for messages: a folder's path, a zip's file name.

public string Description { get; }

Property Value

string

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Kind(string)

public FileKind Kind(string path)

Parameters

path string

Returns

FileKind

List(string, List<(string Name, FileKind Kind)>)

Adds the entries directly inside directory to into: their names and kinds, in any order (a source may list entries).

public void List(string directory, List<(string Name, FileKind Kind)> into)

Parameters

directory string

into List<(string Name, FileKind Kind)>

OpenRead(string)

public Stream OpenRead(string path)

Parameters

path string

Returns

Stream

Exceptions

FileNotFoundException

There is no such file.

ReadAllBytes(string)

public byte[] ReadAllBytes(string path)

Parameters

path string

Returns

byte[]

Exceptions

FileNotFoundException

There is no such file.