use crate::utils::ISO_SECTOR_SIZE;
use std::collections::HashMap;
use std::path::PathBuf;
#[derive(Clone, Debug)]
pub struct IsoFile {
pub path: PathBuf,
pub size: u64,
pub lba: u32,
}
pub struct IsoDirectory {
pub children: HashMap<String, IsoFsNode>,
pub lba: u32,
pub size: u32,
}
impl Default for IsoDirectory {
fn default() -> Self {
Self::new()
}
}
impl IsoDirectory {
pub fn new() -> Self {
Self {
children: HashMap::new(),
lba: 0,
size: ISO_SECTOR_SIZE as u32,
}
}
}
pub enum IsoFsNode {
File(IsoFile),
Directory(IsoDirectory),
}
impl IsoFsNode {
pub fn lba(&self) -> u32 {
match self {
IsoFsNode::File(file) => file.lba,
IsoFsNode::Directory(dir) => dir.lba,
}
}
pub fn size(&self) -> u64 {
match self {
IsoFsNode::File(file) => file.size,
IsoFsNode::Directory(dir) => dir.size as u64,
}
}
}