Something went wrong. Try again.
Project Zomboid workshop update cli checker, designed to be used in bash scripts (old and ugly code)
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243use crate::Result;use serde::Deserialize;use std::collections::BTreeMap;use std::path::PathBuf;use std::fs;
// Used https://github.com/WilliamVenner/steamlocate-rs/blob/master/src/app.rs#L60// as an example// I use to use pest to manually parse the ACF file, but ^ is smarter and simpler :3#[derive(Deserialize, Clone, Debug, PartialEq)]#[non_exhaustive]#[serde(rename_all = "PascalCase")]pub struct AppWorkshop { #[serde(rename = "appid")] pub app_id: u32,
pub size_on_disk: Option<u64>, pub needs_update: Option<bool>, pub needs_download: Option<bool>,
pub time_last_updated: Option<u64>, pub time_last_app_ran: Option<u64>,
#[serde(default)] pub workshop_items_installed: BTreeMap<u64, WorkshopItem>,}
impl AppWorkshop { pub fn new(acf: &PathBuf) -> Result<Self> { let file = fs::read_to_string(acf)?; Ok(keyvalues_serde::from_str(&file)?) }}
#[derive(Deserialize, Clone, Debug, PartialEq)]#[non_exhaustive]pub struct WorkshopItem { pub size: u64, #[serde(rename = "timeupdated")] pub time_updated: Option<u64>, pub manifest: u64,}