Documentation ¶
Index ¶
Constants ¶
const ( // PackingMethodUncompressed defines the file as uncompressed PackingMethodUncompressed PackingMethod = 0x00000000 // PackingMethodPacked defines the file as "packed" (compressed) PackingMethodPacked = 0x43707273 // PackingMethodProductEntry defines the entry as product entry // and is usually found at the very start of the pbo file. PackingMethodProductEntry = 0x56657273 )
Variables ¶
var ( // ErrInvalidProductEntry is returned when no valid product entry // could be found. ErrInvalidProductEntry = errors.New("invalid product entry") // ErrFileCorrupted is returned when the sha1 stored in the pbo doesn't matched // the calculated ones of this package. ErrFileCorrupted = errors.New("file seems corrupted") )
Functions ¶
Types ¶
type File ¶
type File struct { Path string // Path contains the path to the current PBO file. Files []*FileEntry // Files contains all files within the PBO file. Headers map[string]string // Headers contains all header fields of the PBO file. // contains filtered or unexported fields }
File contains methods to handle PBO files.
func (*File) CacheEnabled ¶
CacheEnabled returns true if file caching is enabled.
func (*File) Close ¶
func (f *File) Close()
Close closes the file stream and clears the file cache. You can't read any files after this anymore!
func (*File) ToggleCache ¶
ToggleCache enables/disables the file caching mechanism according to enable.
type FileEntry ¶
type FileEntry struct { Filename string // Filename contains the name of the file. Packing PackingMethod // Packing contains the packing method. OriginalSize uint32 // OriginalSize contains the filesize before it has been packed. Reserved uint32 // Reserved contains no useful information. Timestamp time.Time // Timestamp contains the last modification time. DataSize uint32 // DataSize contains the actual size within the pbo. // contains filtered or unexported fields }
FileEntry contains informations for a PBO file entry.
func NewEmptyEntry ¶
func NewEmptyEntry() *FileEntry
NewEmptyEntry returns an empty *FileEntry which can be used as last file entry for pbos.
func NewProductEntry ¶
func NewProductEntry() *FileEntry
NewProductEntry returns an empty *FileEntry with Packing set to PackingMethodProductEntry.
func (*FileEntry) IsProductEntry ¶
IsProductEntry returns true if Packing is equals PackingMethodProductEntry
type InvalidPackingMethod ¶
type InvalidPackingMethod struct {
Packing PackingMethod // Packing contains the unknown packing method.
}
InvalidPackingMethod is returned when the packing method is unknown.
func (*InvalidPackingMethod) Error ¶
func (i *InvalidPackingMethod) Error() string
Error returns a user readable error string.
type PackingMethod ¶
type PackingMethod uint32
PackingMethod describes the packing method used to store the file in the pbo.