GithubHelp home page GithubHelp logo

freadblangks / pycasclib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wowdev/pycasclib

0.0 1.0 0.0 3.31 MB

Python object-oriented bindings for Ladislav Zezula's CASCLib (https://github.com/ladislav-zezula/CascLib)

License: MIT License

Python 18.96% Cython 81.04%

pycasclib's Introduction

pyCASCLib

Python object-oriented bindings for Ladislav Zezula's CASCLib (https://github.com/ladislav-zezula/CascLib)

pyCASCLib is a minimalistic Cython based wrapper for CASCLib. Currently not all the lib features are suported, but support for additional functions will be added in the future. Contributions are welcome.

Building

Cython is required to build this project as a Python module.

After installing Cython run python3 setup.py build_ext --inplace to build the Python module. Once the building is finished, the library is ready to use in Python.

The build script should build CascLib automatically and link against it. Build parameteres are set in setup.py script file. On Linux/Mac you may be required to have BZip2 installed into your system.

Example usage

The Python API of the library is documented in the code with docstrings and type hints.

from CASC import CASCHandler, FileOpenFlags, LocaleFlags

# As a context manager
with CASCHandler('/Volumes/something/World of Warcraft/', LocaleFlags.CASC_LOCALE_ENUS, False) as casc:
    flags = FileOpenFlags.CASC_OPEN_BY_FILEID  # load file by FileDataID

    with casc.read_file(189077, flags) as file:  # CASCFile can also be opened as a context manager
        print(file.data) # get raw file bytes, lazy loading is supported
        print(file.info.file_data_id)  # get file's info, lazy loading is supported
        
    print(casc.file_exists(189077, flags))  # check if file exists
    
# Usage with manual closing
casc = CASCHandler('/Volumes/something/World of Warcraft/', LocaleFlags.CASC_LOCALE_ENUS, False)
print(('world/arttest/boxtest/xyz.m2', FileOpenFlags.CASC_OPEN_BY_NAME) in casc)  # check if file exists
casc.close()

pycasclib's People

Contributors

skarndev avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.