mirror of
https://github.com/garraflavatra/go-fmp.git
synced 2025-06-27 20:15:11 +00:00
Table looping (WIP)
This commit is contained in:
@ -2,14 +2,43 @@ package fmp
|
||||
|
||||
func (ctx *FmpFile) Tables() []*FmpTable {
|
||||
tables := make([]*FmpTable, 0)
|
||||
metaDict := ctx.Dictionary.get([]uint64{4, 1, 7})
|
||||
if metaDict == nil {
|
||||
return tables
|
||||
}
|
||||
for _, meta := range *metaDict.Children {
|
||||
name := decodeByteSeq(meta.Children.get([]uint64{16}).Value)
|
||||
table := &FmpTable{Name: name}
|
||||
tables = append(tables, table)
|
||||
|
||||
for _, chunk := range ctx.Chunks {
|
||||
if chunk.Key != 3 || chunk.Type != FMP_CHUNK_SIMPLE_KEY_VALUE {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, chunk = range ctx.Chunks {
|
||||
if chunk.Key != 16 {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, chunk = range ctx.Chunks {
|
||||
if chunk.Key != 5 {
|
||||
continue
|
||||
}
|
||||
|
||||
for tablePath, chunk := range ctx.Chunks {
|
||||
if chunk.Key >= 128 {
|
||||
continue
|
||||
}
|
||||
|
||||
// Found a table!
|
||||
println("Found one at", tablePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// metaDict := ctx.Dictionary.get([]uint64{4, 1, 7})
|
||||
// if metaDict == nil {
|
||||
// return tables
|
||||
// }
|
||||
// for _, meta := range *metaDict.Children {
|
||||
// name := decodeByteSeq(meta.Children.get([]uint64{16}).Value)
|
||||
// table := &FmpTable{Name: name}
|
||||
// tables = append(tables, table)
|
||||
// }
|
||||
|
||||
return tables
|
||||
}
|
||||
|
Reference in New Issue
Block a user