d2common

package
v0.0.0-...-c8cfab0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTextDictionary

func LoadTextDictionary(fileProvider d2interface.FileProvider)

func SetBuildInfo

func SetBuildInfo(branch, commit string)

SetBuildInfo is called at the start of the application to generate the global BuildInfo value

func TranslateString

func TranslateString(key string) string

Types

type BitMuncher

type BitMuncher struct {
	Offset   int
	BitsRead int
	// contains filtered or unexported fields
}

func CopyBitMuncher

func CopyBitMuncher(source *BitMuncher) *BitMuncher

func CreateBitMuncher

func CreateBitMuncher(data []byte, offset int) *BitMuncher

func (*BitMuncher) GetBit

func (v *BitMuncher) GetBit() uint32

func (*BitMuncher) GetBits

func (v *BitMuncher) GetBits(bits int) uint32

func (*BitMuncher) GetByte

func (v *BitMuncher) GetByte() byte

func (*BitMuncher) GetInt32

func (v *BitMuncher) GetInt32() int32

func (*BitMuncher) GetSignedBits

func (v *BitMuncher) GetSignedBits(bits int) int

func (*BitMuncher) GetUInt32

func (v *BitMuncher) GetUInt32() uint32

func (*BitMuncher) MakeSigned

func (v *BitMuncher) MakeSigned(value uint32, bits int) int32

func (*BitMuncher) SkipBits

func (v *BitMuncher) SkipBits(bits int)

type BitStream

type BitStream struct {
	// contains filtered or unexported fields
}

BitStream is a utility class for reading groups of bits from a stream

func CreateBitStream

func CreateBitStream(newData []byte) *BitStream

CreateBitStream creates a new BitStream

func (*BitStream) EnsureBits

func (v *BitStream) EnsureBits(bitCount int) bool

EnsureBits ensures that the specified number of bits are available

func (*BitStream) PeekByte

func (v *BitStream) PeekByte() int

PeekByte returns the current byte without adjusting the position

func (*BitStream) ReadBits

func (v *BitStream) ReadBits(bitCount int) int

ReadBits reads the specified number of bits and returns the value

func (*BitStream) WasteBits

func (v *BitStream) WasteBits(bitCount int)

WasteBits dry-reads the specified number of bits

type BuildInfoRecord

type BuildInfoRecord struct {
	// Branch is the branch this build is based on (or 'Local' if built locally)
	Branch string
	// Commit is the commit hash of the build (or blank if built locally)
	Commit string
}

BuildInfoRecord is the structure used to hold information about the current build

var BuildInfo BuildInfoRecord

BuildInfo contains information about the build currently being ran

type CalcString

type CalcString string

type DataDictionary

type DataDictionary struct {
	FieldNameLookup map[string]int
	Data            [][]string
}

DataDictionary represents a data file (Excel)

func LoadDataDictionary

func LoadDataDictionary(text string) *DataDictionary

func (*DataDictionary) GetNumber

func (v *DataDictionary) GetNumber(fieldName string, index int) int

func (*DataDictionary) GetString

func (v *DataDictionary) GetString(fieldName string, index int) string

type Path

type Path struct {
	X      int32
	Y      int32
	Action int32
}

type Rectangle

type Rectangle struct {
	Left   int
	Top    int
	Width  int
	Height int
}

func (*Rectangle) Bottom

func (v *Rectangle) Bottom() int

func (*Rectangle) IsInRect

func (v *Rectangle) IsInRect(x, y int) bool

func (*Rectangle) Right

func (v *Rectangle) Right() int

type StreamReader

type StreamReader struct {
	// contains filtered or unexported fields
}

StreamReader allows you to read data from a byte array in various formats

func CreateStreamReader

func CreateStreamReader(source []byte) *StreamReader

CreateStreamReader creates an instance of the stream reader

func (*StreamReader) Eof

func (v *StreamReader) Eof() bool

func (*StreamReader) GetByte

func (v *StreamReader) GetByte() byte

GetByte returns a byte from the stream

func (*StreamReader) GetInt16

func (v *StreamReader) GetInt16() int16

GetInt16 returns a int16 word from the stream

func (*StreamReader) GetInt32

func (v *StreamReader) GetInt32() int32

GetInt32 returns an int32 dword from the stream

func (*StreamReader) GetInt64

func (v *StreamReader) GetInt64() int64

GetInt64 returns a uint64 qword from the stream

func (*StreamReader) GetPosition

func (v *StreamReader) GetPosition() uint64

GetPosition returns the current stream position

func (*StreamReader) GetSize

func (v *StreamReader) GetSize() uint64

GetSize returns the total size of the stream in bytes

func (*StreamReader) GetUInt16

func (v *StreamReader) GetUInt16() uint16

GetUInt16 returns a uint16 word from the stream

func (*StreamReader) GetUInt32

func (v *StreamReader) GetUInt32() uint32

GetUInt32 returns a uint32 dword from the stream

func (*StreamReader) GetUint64

func (v *StreamReader) GetUint64() uint64

GetUint64 returns a uint64 qword from the stream

func (*StreamReader) Read

func (v *StreamReader) Read(p []byte) (n int, err error)

Read implements io.Reader

func (*StreamReader) ReadByte

func (v *StreamReader) ReadByte() (byte, error)

ReadByte implements io.ByteReader

func (*StreamReader) ReadBytes

func (v *StreamReader) ReadBytes(count int) ([]byte, error)

ReadBytes reads multiple bytes

func (*StreamReader) SetPosition

func (v *StreamReader) SetPosition(newPosition uint64)

func (*StreamReader) SkipBytes

func (v *StreamReader) SkipBytes(count int)

type StreamWriter

type StreamWriter struct {
	// contains filtered or unexported fields
}

StreamWriter allows you to create a byte array by streaming in writes of various sizes

func CreateStreamWriter

func CreateStreamWriter() *StreamWriter

CreateStreamWriter creates a new StreamWriter instance

func (*StreamWriter) GetBytes

func (v *StreamWriter) GetBytes() []byte

GetBytes returns the the byte slice of the underlying data

func (*StreamWriter) PushByte

func (v *StreamWriter) PushByte(val byte)

PushByte writes a byte to the stream

func (*StreamWriter) PushInt16

func (v *StreamWriter) PushInt16(val int16)

PushInt16 writes a int16 word to the stream

func (*StreamWriter) PushInt64

func (v *StreamWriter) PushInt64(val int64)

PushInt64 writes a uint64 qword to the stream

func (*StreamWriter) PushUint16

func (v *StreamWriter) PushUint16(val uint16)

PushUint16 writes an uint16 word to the stream

func (*StreamWriter) PushUint32

func (v *StreamWriter) PushUint32(val uint32)

PushUint32 writes a uint32 dword to the stream

func (*StreamWriter) PushUint64

func (v *StreamWriter) PushUint64(val uint64)

PushUint64 writes a uint64 qword to the stream

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL