feat: add conversion for v1 packs

This commit is contained in:
Anna 2022-11-02 16:36:21 -04:00
parent 6c125bace0
commit 42c157fff2
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
1 changed files with 18 additions and 0 deletions

View File

@ -1,5 +1,7 @@
use serde::{Deserialize, Serialize};
use crate::model::ModPack;
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "PascalCase")]
pub struct SimpleMod {
@ -14,3 +16,19 @@ pub struct SimpleMod {
#[serde(default)]
pub mod_pack_entry: Option<serde_json::Value>,
}
impl From<Vec<SimpleMod>> for ModPack {
fn from(mods: Vec<SimpleMod>) -> Self {
ModPack {
minimum_framework_version: Default::default(),
ttmp_version: Default::default(),
name: "TexTools Mod Pack".into(),
author: "TexTools Mod Author".into(),
version: "1.0.0".into(),
description: None,
url: None,
mod_pack_pages: None,
simple_mods_list: Some(mods),
}
}
}