xml report

This commit is contained in:
nuknal
2024-05-22 11:31:08 +08:00
parent 0634b0106e
commit eb6e0bc95a
6 changed files with 93 additions and 8 deletions

View File

@@ -12,15 +12,15 @@ var (
ReferenceTime2000 = 946728000
)
func (e Extractor) ExtractAux(auxfile, xlsxfile string) error {
func (e *Extractor) ExtractAux(auxfile, xlsxfile string) ([]*AuxFrameHead, []*AuxFocalBox, []*AuxPlatform, error) {
os.Remove(xlsxfile)
if err := createAuxXlsx(xlsxfile); err != nil {
return err
return nil, nil, nil, err
}
f, err := excelize.OpenFile(xlsxfile)
if err != nil {
return err
return nil, nil, nil, err
}
defer f.Close()
@@ -28,9 +28,13 @@ func (e Extractor) ExtractAux(auxfile, xlsxfile string) error {
data, err := os.ReadFile(auxfile)
if err != nil {
log.Println("read aux data from", auxfile, "error:", err.Error())
return err
return nil, nil, nil, err
}
var afh []*AuxFrameHead
var afb []*AuxFocalBox
var aps []*AuxPlatform
row := 2
col := 1
for i := 0; i < len(data); i += 24 + 128 + 512 {
@@ -40,17 +44,21 @@ func (e Extractor) ExtractAux(auxfile, xlsxfile string) error {
var head AuxFrameHead
head.Decode(data[i : i+24])
l0, _ := head.SaveXlsx(f, col, row)
afh = append(afh, &head)
var box AuxFocalBox
box.Decode(data[i+24 : i+24+128])
l1, _ := box.SaveXlsx(f, col+l0, row)
afb = append(afb, &box)
var plat AuxPlatform
plat.Decode(data[i+24+128 : i+24+128+512])
plat.SaveXlsx(f, col+l0+l1, row)
aps = append(aps, &plat)
row++
}
return f.Save()
err = f.Save()
return afh, afb, aps, err
}