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 {
Specifics []JavaVersionSpecifics `json:"specifics"`
}
type JavaVersionSpecifics struct {
Os string `json:"os"`
Arch string `json:"arch"`
URL string `json:"URL"`
Sha1 string `json:"SHA1"`
} `json:"specifics"`
}
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 {
@ -32,6 +43,7 @@ type Version struct {
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.