From f5dcdfff1b52a819adb4354960213d7472978c7f Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 14 Jun 2018 16:21:16 +0200 Subject: add support for reading zipped logs --- src/raw/mod.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/raw/mod.rs') diff --git a/src/raw/mod.rs b/src/raw/mod.rs index 7cbe483..7a079a1 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -6,6 +6,8 @@ //! functions whenever possible. mod types; +use zip::ZipArchive; + pub use self::types::{ Agent, CbtActivation, CbtBuffRemove, CbtCustomSkill, CbtEvent, CbtResult, CbtStateChange, Language, Skill, IFF, @@ -13,4 +15,13 @@ pub use self::types::{ pub mod parser; -pub use self::parser::{parse_file, Evtc, ParseError}; +pub use self::parser::{parse_file, Evtc, ParseError, ParseResult}; + +use std::io::{Read, Seek}; + +/// Parse a complete log that was compressed as a zip file. +pub fn parse_zip(input: &mut T) -> ParseResult { + let mut archive = ZipArchive::new(input)?; + let mut file = archive.by_index(0)?; + parse_file(&mut file) +} -- cgit v1.2.3