server/admin/sync/exercice_defines.go

31 lines
681 B
Go
Raw Normal View History

package sync
import (
"path"
"github.com/BurntSushi/toml"
)
2018-03-09 18:07:08 +00:00
// ExerciceHintParams holds EHint definition infomation.
type ExerciceHintParams struct {
Filename string
Cost int64
Title string
}
2018-03-09 18:07:08 +00:00
// ExerciceParams contains values parsed from defines.txt.
type ExerciceParams struct {
Gain int64
Hints []ExerciceHintParams `toml:"hint"`
}
2018-03-09 18:07:08 +00:00
// parseExerciceParams reads challenge definitions from defines.txt and extract usefull data to set up the challenge.
func parseExerciceParams(i Importer, exPath string) (p ExerciceParams, err error) {
var defs string
defs, err = getFileContent(i, path.Join(exPath, "defines.txt"))
_, err = toml.Decode(defs, &p)
return
}