Initial commit
This commit is contained in:
commit
7d47a10acf
18 changed files with 1545 additions and 0 deletions
24
examples/decode_blueprint.rs
Normal file
24
examples/decode_blueprint.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use clap::Parser;
|
||||
use factorio_blueprint::blueprint;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
struct Args {
|
||||
blueprint: PathBuf,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
let s = std::fs::read_to_string(args.blueprint).unwrap();
|
||||
|
||||
let raw = blueprint::decode(s.trim_end());
|
||||
// println!("{}", &raw);
|
||||
|
||||
let bp = serde_json::from_str::<blueprint::structs::BlueprintString>(&raw).unwrap();
|
||||
|
||||
dbg!(&bp);
|
||||
|
||||
// let reencode = encode(&raw);
|
||||
// println!("{}", &reencode);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue