Vue>> mpq>> 返回
项目作者: icza

项目描述 :
Decoder/parser of Blizzard's MPQ archive file format
高级语言: Go
项目地址: git://github.com/icza/mpq.git
创建时间: 2016-07-25T11:17:40Z
项目社区:https://github.com/icza/mpq

开源协议:Apache License 2.0

下载


mpq

Build Status
Go Reference
Go Report Card
codecov

Package mpq is a decoder/parser of Blizzard’s MPQ archive file format.

This is not a full MPQ implementation. It is primarily intended to parse StarCraft II replay files (*.SC2Replay),
but that is fully supported.

Usage

Usage is simple. Opening an MPQ archive file:

  1. m, err := mpq.NewFromFile("myreplay.SC2Replay")
  2. if err != nil {
  3. // Handle error
  4. return
  5. }
  6. defer m.Close()

Getting a named file from the archive:

  1. // Access a file inside the MPQ archive.
  2. // Usually there is a file called "(listfile)" containing the list of other files:
  3. if data, err := m.FileByName("(listfile)"); err == nil {
  4. fmt.Println("Files inside archive:")
  5. fmt.Println(string(data))
  6. } else {
  7. // handle error
  8. }

If you already have the MPQ data in memory:

  1. mpqdata := []byte{} // MPQ data in memory
  2. m, err := mpq.New(bytes.NewReader(mpqdata)))

Information sources

Example projects using this

License

Open-sourced under the Apache License 2.0.