swf go
1.0.0
Leitor de ondas de choque modular, analisador e decodificador em Go.
Comparado ao Kelvyne/SWF, ele também decodifica tipos e tags, incluindo sprites.
package example
import (
"errors"
"git.gammaspectra.live/WeebDataHoarder/swf-go"
"git.gammaspectra.live/WeebDataHoarder/swf-go/tag"
"io"
"os"
)
func main () {
f , err := os . Open ( "flash.swf" )
if err != nil {
panic ( err )
}
defer f . Close ()
reader , err := swf . NewReader ( f )
if err != nil {
panic ( err )
}
defer reader . Close ()
for {
t , err := reader . Tag ()
if err != nil {
if errors . Is ( err , tag . ErrUnknownTag ) {
//unknown tag, cannot decode
continue
}
if errors . Is ( err , io . EOF ) {
//file is completely read
panic ( "EOF reached without End tag" )
}
panic ( err )
}
//Handle tags
switch t .( type ) {
case * tag. End :
//end of file
break
}
}
}