2018-01-10 02:45:56 +00:00
|
|
|
package sync
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path"
|
|
|
|
|
|
|
|
"github.com/BurntSushi/toml"
|
|
|
|
)
|
|
|
|
|
2018-01-10 03:42:50 +00:00
|
|
|
type ExerciceHintParams struct {
|
|
|
|
Filename string
|
|
|
|
Cost int64
|
|
|
|
Title string
|
|
|
|
}
|
|
|
|
|
2018-01-10 02:45:56 +00:00
|
|
|
type ExerciceParams struct {
|
|
|
|
Gain int64
|
2018-01-10 03:42:50 +00:00
|
|
|
Hints []ExerciceHintParams `toml:"hint"`
|
2018-01-10 02:45:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|