1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-05-07 02:57:46 +00:00

Add EXD::get_row function

This commit is contained in:
Joshua Goins 2025-04-28 23:36:51 -04:00
parent 257f286990
commit 5efa3c9663

View file

@ -185,7 +185,7 @@ pub struct EXD {
pub rows: Vec<ExcelRow>, pub rows: Vec<ExcelRow>,
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub enum ColumnData { pub enum ColumnData {
String(String), String(String),
Bool(bool), Bool(bool),
@ -200,12 +200,12 @@ pub enum ColumnData {
UInt64(u64), UInt64(u64),
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct ExcelSingleRow { pub struct ExcelSingleRow {
pub columns: Vec<ColumnData>, pub columns: Vec<ColumnData>,
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub enum ExcelRowKind { pub enum ExcelRowKind {
SingleRow(ExcelSingleRow), SingleRow(ExcelSingleRow),
SubRows(Vec<ExcelSingleRow>), SubRows(Vec<ExcelSingleRow>),
@ -222,6 +222,16 @@ impl EXD {
EXD::read_args(&mut Cursor::new(&buffer), (exh,)).ok() EXD::read_args(&mut Cursor::new(&buffer), (exh,)).ok()
} }
pub fn get_row(&self, row_id: u32) -> Option<ExcelRowKind> {
for row in &self.rows {
if row.row_id == row_id {
return Some(row.kind.clone());
}
}
return None;
}
fn read_data_raw<T: Read + Seek, Z: BinRead<Args<'static> = ()>>(cursor: &mut T) -> Option<Z> { fn read_data_raw<T: Read + Seek, Z: BinRead<Args<'static> = ()>>(cursor: &mut T) -> Option<Z> {
Z::read_options(cursor, Endian::Big, ()).ok() Z::read_options(cursor, Endian::Big, ()).ok()
} }