Show / Hide Table of Contents

Class BsaFile

Connects to a Daggerfall BSA file and extracts records as binary data.

Inheritance
Object
BsaFile
Namespace: DaggerfallConnect.Arena2
Assembly: Assembly-CSharp.dll
Syntax
public class BsaFile

Constructors

| Improve this Doc View Source

BsaFile()

Default constructor.

Declaration
public BsaFile()
| Improve this Doc View Source

BsaFile(String, FileUsage, Boolean)

Load constructor.

Declaration
public BsaFile(string filePath, FileUsage usage, bool readOnly)
Parameters
Type Name Description
String filePath

Absolute path to BSA file.

FileUsage usage

Specify if file will be accessed from disk, or loaded into RAM.

Boolean readOnly

File will be read-only if true, read-write if false.

Properties

| Improve this Doc View Source

Count

Number records in the loaded BSA file.

Declaration
public int Count { get; }
Property Value
Type Description
Int32
| Improve this Doc View Source

DirectoryType

Type of directory used for this BSA file.

Declaration
public BsaFile.DirectoryTypes DirectoryType { get; }
Property Value
Type Description
BsaFile.DirectoryTypes

Methods

| Improve this Doc View Source

GetRecordBytes(Int32)

Retrieves a record as a byte array.

Declaration
public byte[] GetRecordBytes(int record)
Parameters
Type Name Description
Int32 record

Index of record.

Returns
Type Description
Byte[]

Byte array containing record data.

| Improve this Doc View Source

GetRecordId(Int32)

Gets ID of a number record. This method is valid only for BSA files with a number-based directory.

Declaration
public uint GetRecordId(int record)
Parameters
Type Name Description
Int32 record

Index of record.

Returns
Type Description
UInt32

ID of record.

| Improve this Doc View Source

GetRecordIndex(String)

Finds index of a named record.

Declaration
public int GetRecordIndex(string name)
Parameters
Type Name Description
String name

Name to search for.

Returns
Type Description
Int32

Index of name, or -1 if not found.

| Improve this Doc View Source

GetRecordLength(Int32)

Gets length of a record in bytes.

Declaration
public int GetRecordLength(int record)
Parameters
Type Name Description
Int32 record

Index of record.

Returns
Type Description
Int32

Length of records in bytes.

| Improve this Doc View Source

GetRecordName(Int32)

Gets name of a record as a string. This method is valid for BSA files with either a number or name-based directory.

Declaration
public string GetRecordName(int record)
Parameters
Type Name Description
Int32 record

Name of record.

Returns
Type Description
String

Name of record as string.

| Improve this Doc View Source

GetRecordPosition(Int32)

Get position (offset) of record in BSA file.

Declaration
public long GetRecordPosition(int record)
Parameters
Type Name Description
Int32 record

Index of record

Returns
Type Description
Int64
| Improve this Doc View Source

Load(String, FileUsage, Boolean, PatchList)

Load BSA file.

Declaration
public bool Load(string filePath, FileUsage usage, bool readOnly, PatchList filePatch = null)
Parameters
Type Name Description
String filePath

Absolute path to BSA file.

FileUsage usage

Specify if file will be accessed from disk, or loaded into RAM.

Boolean readOnly

File will be read-only if true, read-write if false.

PatchList filePatch

An optional list of patches to apply to file memory buffer.

Returns
Type Description
Boolean

True if successful, otherwise false.

| Improve this Doc View Source

RewriteRecord(Int32, Byte[])

Save new record data back to BSA file. WARNING: This will modify the BSA file. Ensure you have backups. BSA file must have been opened with ReadOnly flag disabled.

Declaration
public void RewriteRecord(int record, byte[] buffer)
Parameters
Type Name Description
Int32 record

The record to save back.

Byte[] buffer

The data to save back. This must be the same length as record data.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX