mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-23 08:55:16 +08:00
chore: establish development baseline
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
//! 资源领域对象
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// 资源类型
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
pub enum ResourceType {
|
||||
/// AssetBundle
|
||||
AssetBundle,
|
||||
/// Manifest
|
||||
Manifest,
|
||||
/// TableBundle
|
||||
TableBundle,
|
||||
/// 其他
|
||||
Other,
|
||||
}
|
||||
|
||||
/// 资源条目
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ResourceEntry {
|
||||
/// 资源路径
|
||||
pub path: String,
|
||||
/// 资源 Hash
|
||||
pub hash: String,
|
||||
/// 资源大小
|
||||
pub size: u64,
|
||||
/// 资源类型
|
||||
pub resource_type: ResourceType,
|
||||
}
|
||||
|
||||
/// 资源
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Resource {
|
||||
/// 资源 ID
|
||||
pub id: String,
|
||||
/// 本地路径
|
||||
pub local_path: PathBuf,
|
||||
/// 资源条目
|
||||
pub entry: ResourceEntry,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_resource_entry() {
|
||||
let entry = ResourceEntry {
|
||||
path: "test.bundle".to_string(),
|
||||
hash: "abc123".to_string(),
|
||||
size: 1024,
|
||||
resource_type: ResourceType::AssetBundle,
|
||||
};
|
||||
|
||||
assert_eq!(entry.path, "test.bundle");
|
||||
assert_eq!(entry.size, 1024);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user