/
text.go
35 lines (30 loc) · 988 Bytes
/
text.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package formatters
import (
"os"
"text/template"
"github.com/mroach/rom64/rom"
)
var textFormat = `File:
Name: {{.File.Name}}
Size: {{.File.Size}} MB
Format: {{.File.Format.Code}} ({{.File.Format.Description}})
Checksums:
MD5: {{if .File.MD5}}{{.File.MD5}}{{else}}Not Calculated{{end}}
SHA1: {{if .File.SHA1}}{{.File.SHA1}}{{else}}Not Calculated{{end}}
CRC 1: {{if .File.CRC1}}{{.File.CRC1}}{{else}}Not Calculated{{end}}
CRC 2: {{if .File.CRC2}}{{.File.CRC2}}{{else}}Not Calculated{{end}}
ROM:
ID: {{.Serial}}
Title: {{.ImageName}}
Media: {{.MediaFormat.Description}}
Region: {{.Region.Description}}
Video: {{.Region.VideoSystem}}
Version: 1.{{.Version}}
CIC: {{.CIC}}
CRC 1: {{.CRC1}}
CRC 2: {{.CRC2}}
`
func PrintText(info rom.RomFile) error {
var defaultTextTemplate = template.Must(template.New("rom").Parse(textFormat))
return defaultTextTemplate.Execute(os.Stdout, &info)
}