Table of Contents

Class XmlZipStorage

Namespace
OmegaEngine.Foundation.Storage
Assembly
OmegaEngine.Foundation.dll

Provides easy serialization to XML files wrapped in ZIP archives.

public static class XmlZipStorage
Inheritance
XmlZipStorage
Inherited Members

Methods

LoadXmlZip<T>(Stream, string?, params EmbeddedFile[])

Loads an object from an XML file embedded in a ZIP archive.

public static T LoadXmlZip<T>(Stream stream, string? password = null, params EmbeddedFile[] additionalFiles) where T : class

Parameters

stream Stream

The ZIP archive to load.

password string

The password to use for decryption; null for no encryption.

additionalFiles EmbeddedFile[]

Additional files stored alongside the XML file in the ZIP archive to be read.

Returns

T

The loaded object.

Type Parameters

T

The type of object the XML stream shall be converted into.

Exceptions

ZipException

A problem occurred while reading the ZIP data or if password is wrong.

InvalidDataException

A problem occurred while deserializing the XML data.

LoadXmlZip<T>(string, string?, params EmbeddedFile[])

Loads an object from an XML file embedded in a ZIP archive.

public static T LoadXmlZip<T>(string path, string? password = null, params EmbeddedFile[] additionalFiles) where T : class

Parameters

path string

The ZIP archive to load.

password string

The password to use for decryption; null for no encryption.

additionalFiles EmbeddedFile[]

Additional files stored alongside the XML file in the ZIP archive to be read.

Returns

T

The loaded object.

Type Parameters

T

The type of object the XML stream shall be converted into.

Remarks

Uses AtomicRead internally.

Exceptions

IOException

A problem occurred while reading the file.

UnauthorizedAccessException

Read access to the file is not permitted.

ZipException

A problem occurred while reading the ZIP data or if password is wrong.

InvalidDataException

A problem occurred while deserializing the XML data.

SaveXmlZip<T>(T, Stream, string?, params EmbeddedFile[])

Saves an object in an XML file embedded in a ZIP archive.

public static void SaveXmlZip<T>(this T data, Stream stream, string? password = null, params EmbeddedFile[] additionalFiles) where T : notnull

Parameters

data T

The object to be stored.

stream Stream

The ZIP archive to be written.

password string

The password to use for encryption; null for no encryption.

additionalFiles EmbeddedFile[]

Additional files to be stored alongside the XML file in the ZIP archive; can be null.

Type Parameters

T

The type of object to be saved in an XML stream.

SaveXmlZip<T>(T, string, string?, params EmbeddedFile[])

Saves an object in an XML file embedded in a ZIP archive.

public static void SaveXmlZip<T>(this T data, string path, string? password = null, params EmbeddedFile[] additionalFiles) where T : notnull

Parameters

data T

The object to be stored.

path string

The ZIP archive to be written.

password string

The password to use for encryption; null for no encryption.

additionalFiles EmbeddedFile[]

Additional files to be stored alongside the XML file in the ZIP archive; can be null.

Type Parameters

T

The type of object to be saved in an XML stream.

Remarks

Uses AtomicWrite internally.

Exceptions

IOException

A problem occurred while writing the file.

UnauthorizedAccessException

Write access to the file is not permitted.