- Joined
- Jan 9, 2008
- Messages
- 818
- Reaction score
- 847
This is a golang WZ library. It only supports reading (for now).
You need to use casting to deserialize objects.
Sourcecode is here:
Basically, run go get -d github.com/diamondo25/go-wz to download the library. Then, import the library using import "github.com/diamondo25/go-wz" in your sourcecode.
Because of the use of multithreading and workpooling, it is able to load all data of Data.wz (v.3) in 4 seconds (tested on an Macbook Pro w/ i7, 16 GB RAM and 500GB SSD). You can also disable this system and use lazyloading instead (set LazyLoading of the WZFile to false).
Todo:
Example:
You need to use casting to deserialize objects.
Sourcecode is here:
You must be registered to see links
Basically, run go get -d github.com/diamondo25/go-wz to download the library. Then, import the library using import "github.com/diamondo25/go-wz" in your sourcecode.
Because of the use of multithreading and workpooling, it is able to load all data of Data.wz (v.3) in 4 seconds (tested on an Macbook Pro w/ i7, 16 GB RAM and 500GB SSD). You can also disable this system and use lazyloading instead (set LazyLoading of the WZFile to false).
Todo:
You must be registered to see links
Example:
Code:
package main
import (
"bufio"
"flag"
"fmt"
"github.com/diamondo25/go-wz"
"os"
)
func main() {
base, err := wz.NewFile("Data.wz")
if err != nil {
panic(err)
}
// base.Debug = true
flag.BoolVar(&base.Debug, "debug", false, "Toggles debugging mode")
flag.BoolVar(&base.LazyLoading, "lazyloading", true, "If disabled, all data will be loaded in memory")
flag.Parse()
fmt.Println("Loading ", base.Filename)
base.Parse()
base.WaitUntilLoaded()
fmt.Println("Loaded!")
fmt.Println("Smap: ", base.GetFromPath("smap.img"))
fmt.Println("Falling tomb thing z value: ", base.GetFromPath("Effect/Tomb.img/fall/0/z"))
fmt.Println("Falling tomb thing origin X: ", base.GetFromPath("Effect/Tomb.img/fall/0/origin/X"))
reader := bufio.NewReader(os.Stdin)
reader.ReadString('\n')
fmt.Println("Shutting Down")
}