1
0
mirror of https://github.com/garraflavatra/go-fmp.git synced 2025-07-15 02:34:05 +00:00
This commit is contained in:
2025-06-12 21:21:55 +02:00
parent f72d9510d4
commit 7fa7a3787d
7 changed files with 83 additions and 71 deletions

View File

@ -3,7 +3,6 @@ package fmp
import (
"fmt"
"os"
"strings"
)
func (f *FmpFile) ToDebugFile(fname string) {
@ -36,11 +35,18 @@ func (c *FmpChunk) String() string {
return fmt.Sprintf("<%v(%v)>", c.Type, c.Length)
}
func (dict *FmpDict) String() string {
func (dict *FmpDict) string(parentPath string) string {
s := ""
for k, v := range *dict {
ns := strings.ReplaceAll(v.Children.String(), "\n", "\n\t")
s += fmt.Sprintf("%v: %v\n%v\n", k, string(v.Value), ns)
s += fmt.Sprintf("%v%v: %v\n", parentPath, k, string(v.Value))
if v.Children != nil {
s += v.Children.string(fmt.Sprintf("%v%v.", parentPath, k))
}
}
return s
}
func (dict *FmpDict) String() string {
return dict.string("")
}