resource

package
v0.1.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRes

func GetRes(infos []ResInfo, dest string) error

GetRes gets the resources to specified destination directory.

func GetResVersion

func GetResVersion() (string, error)

GetResVersion gets the current resource version.

Types

type AbInfo

type AbInfo struct {
	Name      string `json:"name"`
	Hash      string `json:"hash"`
	Md5       string `json:"md5"`
	TotalSize int    `json:"totalSize"`
	AbSize    int    `json:"abSize"`
	Cid       int    `json:"cid"`
	Pid       string `json:"pid,omitempty"`
	Type      string `json:"type,omitempty"`
}

type FullPack

type FullPack struct {
	TotalSize int    `json:"totalSize"`
	AbSize    int    `json:"abSize"`
	Type      string `json:"type"`
	Cid       int    `json:"cid"`
}

type PackInfo

type PackInfo struct {
	Name      string `json:"name"`
	Hash      string `json:"hash"`
	Md5       string `json:"md5"`
	TotalSize int    `json:"totalSize"`
	AbSize    int    `json:"abSize"`
	Cid       int    `json:"cid"`
}

type ResInfo

type ResInfo struct {
	Name       string
	Hash       string
	ResVersion string
}

ResInfo represents an abstraction of AbInfo and PackInfo.

func FilterResInfos

func FilterResInfos(infos []ResInfo, predicate func(i ResInfo) bool) []ResInfo

FilterResInfos returns a slice containing all ResInfo matching the specified predicate.

func FilterResInfosRegexp

func FilterResInfosRegexp(infos []ResInfo, regexp *regexp.Regexp) []ResInfo

FilterResInfosRegexp returns a slice containing all ResInfo matching the specified regexp.

func GetResInfos

func GetResInfos(resVersion string) ([]ResInfo, error)

GetResInfos gets the resource infos of specified resource version.

func (ResInfo) Equals

func (i ResInfo) Equals(j ResInfo) bool

Equals tests if two ResInfo are equal. Iff the two ResInfo have the same Name and Hash, they are equal.

func (ResInfo) GetUrl

func (i ResInfo) GetUrl() string

GetUrl gets the URL for downloading this ResInfo.

type Resources

type Resources struct {
	FullPack        FullPack   `json:"fullPack"`
	VersionId       string     `json:"versionId"`
	AbInfos         []AbInfo   `json:"abInfos"`
	CountOfTypedRes int        `json:"countOfTypedRes"`
	PackInfos       []PackInfo `json:"packInfos"`
}

Resources represents a raw response of ".../hot_update_list.json"

func GetRawResources

func GetRawResources(resVersion string) (Resources, error)

GetRawResources gets the raw response of Arknights resource API with specified resource version.

type Version

type Version struct {
	ResVersion    string `json:"resVersion"`
	ClientVersion string `json:"clientVersion"`
}

Version represents a raw response of "https://ak-conf.hypergryph.com/config/prod/official/Android/version".

func GetRawVersion

func GetRawVersion() (Version, error)

GetRawVersion gets the raw response from Arknights version API.

Jump to

Keyboard shortcuts

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