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.3.1.tar.gz (111.8 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.3.1-py3-none-any.whl (113.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: phi_save_codec-0.3.1.tar.gz
  • Upload date:
  • Size: 111.8 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.3.1.tar.gz
Algorithm Hash digest
SHA256 11bc1c20284680ffc07cc79a708a63ce450fc08396ec3736cc3c88893b37ce84
MD5 1a5f851f3687fa84c8b78b9ada653f3b
BLAKE2b-256 8220304aafc229764811c1317619cc0b30f9a6b0ebd87006f38347d489e30ee4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phi_save_codec-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 113.1 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a0f3ef519f3f2ef50a65454decf9df069ab191208b1ca9d8ee174697fb89655
MD5 90f92913e070961b71afa15abb22663c
BLAKE2b-256 da5bbee4e86cfba7586c8619839d8177ac0dbaf3555c3e0e686dbb89a450db85

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