add method find OsSpecifics to java versions

This commit is contained in:
cyber-dream 2023-02-12 22:04:53 +03:00
parent 0dce90931c
commit 2b95a109c6

View File

@ -2,12 +2,23 @@ package domain
type JavaVersion struct {
VersionNums `json:"version"`
Specifics []struct {
Os string `json:"os"`
Arch string `json:"arch"`
URL string `json:"URL"`
Sha1 string `json:"SHA1"`
} `json:"specifics"`
Specifics []JavaVersionSpecifics `json:"specifics"`
}
type JavaVersionSpecifics struct {
Os string `json:"os"`
Arch string `json:"arch"`
URL string `json:"URL"`
Sha1 string `json:"SHA1"`
}
func (jv *JavaVersion) FindOs(os string, arch string) *JavaVersionSpecifics {
for _, s := range jv.Specifics {
if s.Os == os && s.Arch == arch {
return &s
}
}
return nil
}
type VersionNums struct {
@ -28,10 +39,11 @@ type Version struct {
ID string `json:"id"`
Libraries []Lib `json:"libraries"`
//ClientLog LogCfg
MainClass string `json:"mainClass"`
GameArgs []Argument
JVMArgs []Argument
Type string `json:"type"`
MainClass string `json:"mainClass"`
GameArgs []Argument
JVMArgs []Argument
Type string `json:"type"`
JavaVersion JavaVersion `json:"javaVersion"`
}
type AssetIndex struct {
@ -45,6 +57,11 @@ type AssetIndex struct {
// Rules []Rule `json:"rules"`
// }
type JavaVersionClientDistribution struct { //TODO Rename
Component string `json:"component"`
MajorVersion int `json:"majorVersion"`
}
type Rule struct {
Action RuleAct `json:"action" mapstructure:"action"`
// OS information. All fields are regexes.