Class SgaFile
- Namespace
- OpenCompote.SGA
- Assembly
- OpenCompote.dll
Represents a file within a SGA archive.
public class SgaFile : SgaEntry
- Inheritance
-
SgaFile
- Inherited Members
Properties
CompressedSize
Gets the compressed size in bytes, of the file in the archive.
public uint CompressedSize { get; }
Property Value
Crc
Get the CRC(Cyclic redundant check) of the opened file. Only loaded when present in the archive. If the crc in newly open archive this property will be null. CRC is automatically calculated for sga versions which are using CRCs. CRCs are not automatically check when file is opened, but you can check the your self by opening the file.
public uint? Crc { get; }
Property Value
- uint?
Exceptions
- ObjectDisposedException
The archive for this file has been disposed.
Modified
Gets or sets the last write time of the file in the archive. When setting this property, the DateTime will be converted to the 32-bit unix timestamp format. This property could be null when opening SGA V2 archive without file metadata present. Modified is automatically set to the current date and time when new file is created or changed file content stream is closed.
public DateTimeOffset? Modified { get; set; }
Property Value
Exceptions
- ObjectDisposedException
The archive for this file has been disposed.
- InvalidOperationException
The archive is opened in read-only mode.
Size
Gets the uncompressed size in bytes, of the file in the archive.
public uint Size { get; }
Property Value
StorageType
Gets or sets the file's storage type.
public StorageType StorageType { get; set; }
Property Value
Exceptions
- ObjectDisposedException
The archive for this file has been disposed.
- InvalidOperationException
The archive is opened in read-only mode or the file is currently open."
Methods
ExtractToFile(string, bool)
Extracts this sgaFile in the archive to a file.
public void ExtractToFile(string destination, bool overwrite = false)
Parameters
destinationstringThe path of the folder to which will this file be exported.
overwriteboolif true, it overwrites an existing file; otherwise, it throws an exception when the file already exists.
Exceptions
- ArgumentException
Destination is null or whitespace.
- ObjectDisposedException
The SGA archive for this file has been disposed, or this file is deleted.
- IOException
The entry is currently open for writing.
- InvalidOperationException
Archive SgaMode value is invalid.
Open()
Opens the file and gets the file contents.
public Stream Open()
Returns
- Stream
A stream with the file contents.
Exceptions
- ObjectDisposedException
The SGA archive for this file has been disposed, or this file is deleted.
- IOException
The entry is currently open for writing.
- InvalidOperationException
Archive SgaMode value is invalid.