mirror of
https://github.com/garraflavatra/go-fmp.git
synced 2025-07-17 19:44:06 +00:00
Table parsing (WIP)
This commit is contained in:
@ -39,7 +39,11 @@ type FmpDictEntry struct {
|
||||
Children *FmpDict
|
||||
}
|
||||
|
||||
func (dict *FmpDict) get(path []uint16) []byte {
|
||||
type FmpTable struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
func (dict *FmpDict) get(path []uint16) *FmpDictEntry {
|
||||
for i, key := range path {
|
||||
_, ok := (*dict)[key]
|
||||
if !ok {
|
||||
@ -47,7 +51,7 @@ func (dict *FmpDict) get(path []uint16) []byte {
|
||||
}
|
||||
|
||||
if i == len(path)-1 {
|
||||
return (*dict)[key].Value
|
||||
return (*dict)[key]
|
||||
} else {
|
||||
dict = (*dict)[key].Children
|
||||
}
|
||||
@ -55,6 +59,14 @@ func (dict *FmpDict) get(path []uint16) []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dict *FmpDict) getValue(path []uint16) []byte {
|
||||
ent := dict.get(path)
|
||||
if ent != nil {
|
||||
return ent.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dict *FmpDict) set(path []uint16, value []byte) {
|
||||
for i, key := range path {
|
||||
_, ok := (*dict)[key]
|
||||
|
Reference in New Issue
Block a user