-
Notifications
You must be signed in to change notification settings - Fork 8
/
image.go
46 lines (37 loc) · 898 Bytes
/
image.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
36
37
38
39
40
41
42
43
44
45
46
package wz
type WZImage struct {
*WZSimpleNode // heh
Properties WZProperty
Parsed bool
parseFuncInfo func()
}
func NewWZImage(name string, parent *WZSimpleNode) *WZImage {
node := new(WZImage)
node.WZSimpleNode = NewWZSimpleNode(name, parent)
node.Parsed = false
return node
}
func (m *WZImage) Parse(file *WZFileBlob, offset int64) {
if m.Parsed {
return
}
if file.Debug {
m.debug(file, "> WZImage::Parse")
defer func() { m.debug(file, "< WZImage::Parse") }()
}
file.seek(offset)
typename := file.readDeDuplicatedWZString(m.GetPath(), offset, true)
parsedObject := ParseObject(m.Name, typename, m.WZSimpleNode, file, offset)
objResult, isOK := parsedObject.(WZProperty)
if !isOK {
panic("Expected object to be WZProperty")
}
m.Properties = objResult
m.Parsed = true
}
func (m *WZImage) StartParse() {
if m.Parsed {
return
}
m.parseFuncInfo()
}