Click or drag to resize
DigitalRuneIStorage Interface
Provides access to files.

Namespace: DigitalRune.Storages
Assembly: DigitalRune (in DigitalRune.dll) Version: 1.20.0.0 (1.20.1.14552)
Syntax
public interface IStorage : IDisposable

The IStorage type exposes the following members.

Methods
  NameDescription
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.)
Public methodGetRealPath
Gets the real path and name of the specified file.
Public methodOpenFile
Opens the specified file for reading.
Top
Remarks
Important note Important

DigitalRune.Storages currently only provides read access to files! Full read/write access, as well as support for additional platforms, will be added in a future version.

The IStorage interface provides a common API to access files from different sources. The following implementations provide access to physical file systems on different platforms:

  • FileSystemStorage - provides access to the file system of the operating system.
  • TitleStorage - provides access to title storage on Xbox 360.
  • (Not yet implemented) UserStorage - provides access to user storage on Xbox 360.
  • (Not yet implemented) IsolatedStorage - provides access to isolated storage in Silverlight.
  • (Not yet implemented) WindowsStorage - provides access to storage folders in Windows Store apps.

Some storages are built on top of other storages. For example:

  • VfsStorage - maps existing storages into a virtual file system. Different storage devices and locations can be treated as one directory hierarchy.
  • ZipStorage - provides access to files stored in a ZIP archive. The ZIP archive can be read from any of the existing storages.

Case-Sensitivity:
File retrieval is case-sensitive if the storage provider (e.g. the platform OS) is case-sensitive. It is recommended to assume case-sensitivity to ensure that applications can be ported to non-Windows platforms.

Directory Separator:
Storages accepts '\' and '/' as directory separators. Internally, paths are normalized to use '/'.

Possible Extensions:
The IStorage concept is highly extensible. Developers can provide custom IStorage implementations to add support for new platforms or manipulate existing storages. Here are just a few features that could be implemented on top of IStorage:

  • Access control - A storage may wrap another storage and implement access control to restrict user access or filter certain files. For example, a "ReadOnlyStorage" may prevent write access to an existing location.
  • Archives - Storages can be added to support other package formats, such as 7-Zip, BZIP2, PAK.
  • Caching ("CachedStorage") - Files from another storage could be cached in memory for faster access.
  • Cloud storage - A storage may access data in the cloud, such as OneDrive.
  • Encryption ("EncryptedStorage") - Data could be encrypted and decrypted when accessing files in an existing storage.
  • Mapping ("RedirectStorage") - Directories can transparently be mapped to different location.
  • Redundancy ("MirroredStorage") - File access could be mirrored across different storages.
  • Ad-hoc storage - Instead of accessing files on an existing devices or locations, files can be stored in custom data structures (DBs, BLOBs, ...).
See Also