mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-24 11:49:48 +02:00
Break: add initial meta.json support
This commit is contained in:
1 parent
903cd00f32
commit
14148c7410
10 files changed
+71
-19
No files matched your search
+11
-3
@@ -3,7 +3,7 @@ use std::io::{Read, Seek};
|
||||
use zip::ZipArchive;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::models::{BattleResults, BattleResultsDat};
|
||||
use crate::models::{BattleResults, BattleResultsDat, Meta};
|
||||
use crate::result::Result;
|
||||
|
||||
/// Opened (but not yet parsed) replay.
|
||||
@@ -19,7 +19,7 @@ impl<R: Read + Seek> Replay<R> {
|
||||
|
||||
/// Reads and parses the battle results from the replay.
|
||||
pub fn read_battle_results(&mut self) -> Result<BattleResults> {
|
||||
self.read_battle_results_dat()?.decode_battle_results()
|
||||
self.read_battle_results_dat()?.try_into()
|
||||
}
|
||||
|
||||
/// Reads and parses the included `battle_results.dat`.
|
||||
@@ -27,7 +27,15 @@ impl<R: Read + Seek> Replay<R> {
|
||||
let pickled_battle_results = self
|
||||
.0
|
||||
.by_name("battle_results.dat")
|
||||
.map_err(Error::OpenBattleResultsFailed)?;
|
||||
.map_err(Error::OpenEntryFailed)?;
|
||||
BattleResultsDat::from_reader(pickled_battle_results)
|
||||
}
|
||||
|
||||
pub fn read_meta(&mut self) -> Result<Meta> {
|
||||
Meta::from_reader(
|
||||
self.0
|
||||
.by_name("meta.json")
|
||||
.map_err(Error::OpenEntryFailed)?,
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user