Expand description
§ESP字符串提取工具库
这是一个用于处理Bethesda游戏引擎(ESP/ESM/ESL)文件的Rust库。 支持字符串提取、翻译应用和文件结构调试。
§主要功能
- 字符串提取:从ESP/ESM/ESL文件中提取可翻译的字符串
- 翻译应用:将翻译后的字符串写回到游戏文件中
- 文件结构调试:提供详细的文件结构分析和对比工具
- 压缩记录支持:正确处理压缩和未压缩的记录
- 多编码支持:支持UTF-8、GBK、ASCII等编码格式
§使用示例
use esp_extractor::{LoadedPlugin, PluginEditor, DefaultEspWriter};
use std::path::PathBuf;
// 智能自动加载插件(推荐)
let loaded = LoadedPlugin::load_auto(PathBuf::from("example.esp"), Some("english"))?;
// 提取字符串
let strings = loaded.extract_strings();
println!("提取到 {} 个字符串", strings.len());
// 准备翻译数据
let translated_strings = strings; // 这里应该是你的翻译数据
// 使用编辑器应用翻译
let plugin = loaded.into_plugin();
let mut editor = PluginEditor::new(plugin);
editor.apply_translations(translated_strings)?;
// 保存到文件
let writer = DefaultEspWriter;
editor.save(&writer, PathBuf::from("output.esp").as_ref())?;Re-exports§
pub use plugin::Plugin;pub use plugin::PluginStats;pub use record::Record;pub use group::Group;pub use group::GroupChild;pub use group::GroupType;pub use subrecord::Subrecord;pub use string_types::ExtractedString;pub use string_file::StringFile;pub use string_file::StringFileType;pub use string_file::StringEntry;pub use string_file::StringFileSet;pub use string_file::StringFileStats;pub use datatypes::RecordFlags;pub use datatypes::RawString;pub use utils::is_valid_string;pub use utils::EspError;pub use special_records::SpecialRecordHandler;pub use io::EspReader;pub use io::EspWriter;pub use io::StringFileReader;pub use io::StringFileWriter;pub use io::RawEspData;pub use io::DefaultEspReader;pub use io::DefaultEspWriter;pub use editor::PluginEditor;pub use editor::TranslationDelta;pub use editor::RecordChange;pub use editor::RecordId;pub use localized_context::LocalizedPluginContext;pub use plugin_loader::LoadedPlugin;pub use string_routes::StringRouter;pub use string_routes::DefaultStringRouter;pub use debug::EspDebugger;
Modules§
- bsa
- BSA (Bethesda Archive) 文件访问模块
- datatypes
- debug
- editor
- group
- io
- localized_
context - plugin
- plugin_
loader - record
- special_
records - 记录类型索引说明
- string_
file - string_
routes - 字符串路由模块
- string_
types - subrecord
- utils
Constants§
- SUPPORTED_
EXTENSIONS - 支持的文件扩展名
- VERSION
- 库版本信息
Functions§
- apply_
translations_ to_ file - 快速应用翻译到文件
- extract_
strings_ from_ file - 快速提取文件中的字符串
- is_
supported_ file - 验证文件是否为支持的ESP格式
Type Aliases§
- Result
- 库的主要错误类型