Class SgaArchiveFile
- Namespace
- OpenCompote.SGA
- Assembly
- OpenCompote.dll
Provides static methods for opening, creating, and extracting SGA archives.
public class SgaArchiveFile
- Inheritance
-
SgaArchiveFile
- Inherited Members
Methods
Create(Stream, SgaVersion, bool)
Creates new SGA archive from existing stream, in the specified SgaVersion.
public static SgaArchive Create(Stream existingStream, SgaVersion version, bool leaveOpen)
Parameters
existingStreamStreamEmpty Stream for the archive.
versionSgaVersionVersion of the new SGA archive.
leaveOpenbooltrueto leave theexistingStreamopen after sgaArchive is disposed.falseto close theexistingStreamwhen the archive is disposed.
Returns
- SgaArchive
The newly opened SGA archive.
Remarks
The new existingStream is always created with mode set to Create.
When you set the version to null or any other undefined value ArgumentException is thrown.
Not all version of Sga archive file are supported. For more info see status page.
The existingStream must be empty and support reading, writing and seeking. If the existingStream does not meet this criteria an ArgumentException is thrown.
Create(string, SgaVersion, bool)
Creates a new SGA archive at the path specified by sourceFileName in the specified version.
public static SgaArchive Create(string sourceFileName, SgaVersion version, bool overwrite = false)
Parameters
sourceFileNamestringThe path to the new SGA archive, specified as a relative or absolute path. Relative path is relative to the current working directory.
versionSgaVersionVersion of the new SGA archive.
overwriteboolIf true, it overwrites an existing file; otherwise, it throws an exception when the file already exists.
Returns
- SgaArchive
The newly opened SGA archive.
Remarks
The new 'SgaArchive' is always created with mode set to Create.
When you set the version to null or any other undefined value ArgumentException is thrown.
Not all version of Sga archive file are supported. For more info see status page.
Open(Stream, SgaMode, bool)
Opens a SGA archive from existing stream, in the specified 'SgaMode' mode.
public static SgaArchive Open(Stream existingStream, SgaMode mode, bool leaveOpen = false)
Parameters
existingStreamStreamStream containing the SGA archive.
modeSgaModeOne of the enumeration values that specifies the actions that are allowed on the opened archive.
leaveOpenbooltrueto leave theexistingStreamopen after sgaArchive is disposed.falseto close theexistingStreamwhen the archive is disposed.
Returns
- SgaArchive
The opened SGA archive.
Remarks
existingStream must support reading and seeking and if the mode is set to Write also reading. If the existingStream does not meet this criteria an ArgumentException is thrown.
This function cannot be used with mode set to Create. For creating a new archive use the Create(Stream, SgaVersion, bool) function. When you set the mode to Create an ArgumentException is thrown.
When you set the mode to null or any other undefined value ArgumentException is thrown.
When you set the mode to Read or Write, the archive is opened with Open from the FileMode enumeration as the file mode value. If the archive does not exist, a FileNotFoundException exception is thrown.
If the mode is Write, the archive entries can be modified.
If the mode is Read, you can only read the archive entries. Attempt to write to the archive will cause NotSupportedException exception.
The archive SgaVersion is automatically detected based on the input file. If the version cannot be detected, a InvalidDataException is thrown.
Open(string, SgaMode)
Opens a SGA Archive at the specific source path, in the specified mode.
public static SgaArchive Open(string sourceFileName, SgaMode mode)
Parameters
sourceFileNamestringThe path to the SGA archive to open, specified as a relative or absolute path. Relative path is relative to the current working directory.
modeSgaModeOne of the enumeration values that specifies the actions that are allowed on the opened archive.
Returns
- SgaArchive
The opened SGA archive.
Remarks
This function cannot be used with mode set to Create. For creating a new archive use the Create(string, SgaVersion, bool) function. When you set the mode to Create an ArgumentException is thrown.
When you set the mode to null or any other undefined value ArgumentException is thrown.
When you set the mode to Read or Write, the archive is opened with Open from the FileMode enumeration as the file mode value. If the archive does not exist, a FileNotFoundException exception is thrown.
If the mode is Write, the archive entries can be modified.
If the mode is Read, you can only read the archive entries. Attempt to write to the archive will cause NotSupportedException exception.
The archive SgaVersion is automatically detected based on the input file. If the version cannot be detected, a InvalidDataException is thrown.