Skip to main content

Phigros Cloud Save Codec Library

Project description

Phi-Save-Codec-Bind-Python

Phi-Save-Codec 的 Python 绑定,用于解析和构建 Phigros 的云端存档格式。

安装

pip install phi_save_codec

使用

from phi_save_codec import PhiSaveCodec, PhiSaveCodecError

# 初始化编解码器
codec = PhiSaveCodec()

# 解析二进制数据
try:
    user_data = codec.parse_user(binary_data)
    print(user_data)
except PhiSaveCodecError as e:
    print(f"解析失败: {e}")

# 构建二进制数据
try:
    binary_data = codec.build_user(user_dict)
except PhiSaveCodecError as e:
    print(f"构建失败: {e}")

支持的操作

  • parse_user() / build_user() - 用户数据
  • parse_summary() / build_summary() - 摘要数据
  • parse_game_record() / build_game_record() - 游戏记录
  • parse_game_progress() / build_game_progress() - 游戏进度
  • parse_game_key() / build_game_key() - 游戏密钥
  • parse_settings() / build_settings() - 设置数据

异常处理

所有 API 方法在错误时抛出 PhiSaveCodecError 异常:

try:
    data = codec.parse_user(binary_data)
except PhiSaveCodecError as e:
    # 获取详细的错误信息
    print(f"错误: {e}")

内存管理

该库自动处理与 WASM 模块之间的内存管理,包括:

  • 分配和释放内存
  • 获取和清空错误信息
  • 确保在函数调用前后正确管理临时内存

依赖

  • msgpack - 数据序列化
  • wasmtime - WASM 运行时支持

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phi_save_codec-0.4.0.tar.gz (123.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phi_save_codec-0.4.0-py3-none-any.whl (125.5 kB view details)

Uploaded Python 3

File details

Details for the file phi_save_codec-0.4.0.tar.gz.

File metadata

  • Download URL: phi_save_codec-0.4.0.tar.gz
  • Upload date:
  • Size: 123.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.9 CPython/3.14.0 Windows/11

File hashes

Hashes for phi_save_codec-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5d27dd4ef9e32d9e9c6393e22cade885266eafe81d307b54dece9e57d7c96f58
MD5 2b6aef463ae46f5dddf39d35e8d201cc
BLAKE2b-256 a9f1299716f2b52b0e5ba435ff3a1a7b392c0e145ecbe2bff4b1467cc2861ee4

See more details on using hashes here.

File details

Details for the file phi_save_codec-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: phi_save_codec-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 125.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.9 CPython/3.14.0 Windows/11

File hashes

Hashes for phi_save_codec-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac4556f047e3a32e72ee1a94d065eb6b2ff466155c71521007885af640ddd587
MD5 e2137caca49a8c779346380a60f282f5
BLAKE2b-256 6a0ae1963c689b63ea1373ec311db9fe219d0e6a6f84de970ca3ebf9de435497

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page