helpers

package
v0.0.0-...-21f6cc7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IgnoreDefaults = []string{
	".git/**",
	".gitattributes",
	".gitignore",
	".DS_Store",
	"/*.zip",
	"*.mrpack",
	"packwiz.exe",
	"packwiz",
}

Functions

func Dedupe

func Dedupe[K comparable](slice []K) []K

func DownloadFile

func DownloadFile(filepath string, url string) (err error)

func Exists

func Exists(file string) bool

func ReadGitignore

func ReadGitignore(path string) (*gitignore.GitIgnore, bool)

func Refresh

func Refresh() error

func Serve

func Serve() error

func Setup

func Setup()

func SetupUpdaters

func SetupUpdaters()

Types

type HashStringer

type HashStringer interface {
	hash.Hash
	HashToString([]byte) string
}

func GetHashImpl

func GetHashImpl(hashType string) (HashStringer, error)

type HexStringer

type HexStringer struct {
	hash.Hash
}

func (HexStringer) HashToString

func (HexStringer) HashToString(data []byte) string

type Index

type Index struct {
	HashFormat string
	Files      IndexFiles
	IndexFile  string
	PackRoot   string
}

func GetPack

func GetPack() (*core.Pack, *Index, error)

func LoadIndex

func LoadIndex(pack core.Pack) (Index, error)

func LoadIndexFile

func LoadIndexFile(indexFile string) (Index, error)

func (Index) GetAllMods

func (in Index) GetAllMods() []string

func (Index) LoadAllMods

func (in Index) LoadAllMods() ([]*Mod, error)

func (*Index) Refresh

func (in *Index) Refresh() error

func (*Index) RelIndexPath

func (in *Index) RelIndexPath(p string) (string, error)

func (Index) ResolveIndexPath

func (in Index) ResolveIndexPath(p string) string

func (*Index) UpdateFile

func (in *Index) UpdateFile(path string) error

func (*Index) UpdateFileHashGiven

func (in *Index) UpdateFileHashGiven(path, format, hash string, markAsMetaFile bool) error

func (*Index) Write

func (in *Index) Write() error

type IndexFile

type IndexFile struct {
	File       string `toml:"file"`
	Hash       string `toml:"hash,omitempty"`
	HashFormat string `toml:"hash-format,omitempty"`
	Alias      string `toml:"alias,omitempty"`
	MetaFile   bool   `toml:"metafile,omitempty"`
	Preserve   bool   `toml:"preserve,omitempty"`
	// contains filtered or unexported fields
}

func (*IndexFile) IsMetaFile

func (i *IndexFile) IsMetaFile() bool

func (*IndexFile) MarkFound

func (i *IndexFile) MarkFound()

func (*IndexFile) MarkMetaFile

func (i *IndexFile) MarkMetaFile()

func (*IndexFile) MarkedFound

func (i *IndexFile) MarkedFound() bool

func (*IndexFile) UpdateHash

func (i *IndexFile) UpdateHash(hash string, format string)

type IndexFileMultipleAlias

type IndexFileMultipleAlias map[string]IndexFile

func (*IndexFileMultipleAlias) IsMetaFile

func (i *IndexFileMultipleAlias) IsMetaFile() bool

func (*IndexFileMultipleAlias) MarkFound

func (i *IndexFileMultipleAlias) MarkFound()

func (*IndexFileMultipleAlias) MarkMetaFile

func (i *IndexFileMultipleAlias) MarkMetaFile()

func (*IndexFileMultipleAlias) MarkedFound

func (i *IndexFileMultipleAlias) MarkedFound() bool

func (*IndexFileMultipleAlias) UpdateHash

func (i *IndexFileMultipleAlias) UpdateHash(hash string, format string)

type IndexFiles

type IndexFiles map[string]IndexPathHolder

func (*IndexFiles) ToTomlRep

func (*IndexFiles) UpdateFileEntry

func (f *IndexFiles) UpdateFileEntry(path string, format string, hash string, markAsMetaFile bool)

type IndexFilesTomlRepresentation

type IndexFilesTomlRepresentation []IndexFile

func (IndexFilesTomlRepresentation) ToMemoryRep

func (rep IndexFilesTomlRepresentation) ToMemoryRep() IndexFiles

type IndexPathHolder

type IndexPathHolder interface {
	UpdateHash(hash string, format string)
	MarkFound()
	MarkMetaFile()
	MarkedFound() bool
	IsMetaFile() bool
}

type IndexTomlRepresentation

type IndexTomlRepresentation struct {
	HashFormat string                       `toml:"hash-format"`
	Files      IndexFilesTomlRepresentation `toml:"files"`
}

type LengthHasher

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

func (*LengthHasher) BlockSize

func (h *LengthHasher) BlockSize() int

func (*LengthHasher) Reset

func (h *LengthHasher) Reset()

func (*LengthHasher) Size

func (h *LengthHasher) Size() int

func (*LengthHasher) Sum

func (h *LengthHasher) Sum(b []byte) []byte

func (*LengthHasher) Write

func (h *LengthHasher) Write(p []byte) (n int, err error)

type Mod

type Mod struct {
	MetaFile   string
	Name       string                            `toml:"name"`
	FileName   string                            `toml:"filename"`
	Side       string                            `toml:"side,omitempty"`
	Download   core.ModDownload                  `toml:"download"`
	Update     map[string]map[string]interface{} `toml:"update"`
	UpdateData map[string]interface{}
	Option     *core.ModOption `toml:"option,omitempty"`
}

func LoadMod

func LoadMod(modFile string) (Mod, error)

func (Mod) GetParsedUpdateData

func (m Mod) GetParsedUpdateData(updaterName string) (interface{}, bool)

type Number32As64Stringer

type Number32As64Stringer struct {
	hash.Hash
}

func (Number32As64Stringer) HashToString

func (Number32As64Stringer) HashToString(data []byte) string

type Number64Stringer

type Number64Stringer struct {
	hash.Hash
}

func (Number64Stringer) HashToString

func (Number64Stringer) HashToString(data []byte) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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