This commit is contained in:
nuknal
2024-05-21 18:05:10 +08:00
parent b60095e5b9
commit faf285775f
4 changed files with 7 additions and 7 deletions

View File

@@ -28,6 +28,7 @@ var extractCmd = &cobra.Command{
for i, d := range dats {
e.SeprateAuxAndImgData(d, i)
}
e.Cleanup()
}
} else {
p := &extract.Params{
@@ -43,6 +44,7 @@ var extractCmd = &cobra.Command{
for i, d := range dats {
e.SeprateAuxAndImgData(d, i)
}
e.Cleanup()
}
},
}
@@ -58,7 +60,7 @@ func init() {
func params() []*extract.Params {
var params []*extract.Params
datas := []string{"051622", "051712", "051721",
"051813", "051821", "051823",
"051814", "051821", "051823",
"051921", "051922", "052022"}
for _, d := range datas {
params = append(params, &extract.Params{

View File

@@ -34,6 +34,9 @@ func (e Extractor) ExtractAux(auxfile, xlsxfile string) error {
row := 2
col := 1
for i := 0; i < len(data); i += 24 + 128 + 512 {
if i+24+128+512 > len(data) {
break
}
var head AuxFrameHead
head.Decode(data[i : i+24])
l0, _ := head.SaveXlsx(f, col, row)

View File

@@ -12,7 +12,7 @@ type Extractor struct {
func NewExtractor(params *Params) *Extractor {
os.MkdirAll(params.OutputPath, 0755)
os.MkdirAll(params.TempPath, 0755)
return &Extractor{params: params}
return &Extractor{params: params, Clean: true}
}
func (e *Extractor) Cleanup() error {

View File

@@ -59,9 +59,6 @@ func (p *Extractor) ExtractOriginalImageData(aosDataFile string) ([]string, erro
snRange := map[int][]uint32{}
datSet := map[int][]byte{}
fsn, _ := os.Create("demo/temp/tf_sn.txt")
defer fsn.Close()
var i int
for i < len(aosData) {
if i+4 > len(aosData) {
@@ -79,8 +76,6 @@ func (p *Extractor) ExtractOriginalImageData(aosDataFile string) ([]string, erro
tf.Decode(aosData[i : i+TransImageFrameLength])
fileno := int(tf.FileNo)
snRange[fileno] = append(snRange[fileno], tf.SNo)
fsn.WriteString(fmt.Sprintf("%d %d %d\n", i, tf.SNo, fileno))
if tf.SecretFlag == 0xAA {
log.Info("secret frame is not supported")
break