1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//---------------------------------------------------------------------------//
// Copyright (c) 2017-2024 Ismael Gutiérrez González. All rights reserved.
//
// This file is part of the Rusted PackFile Manager (RPFM) project,
// which can be found here: https://github.com/Frodo45127/rpfm.
//
// This file is licensed under the MIT license, which can be found here:
// https://github.com/Frodo45127/rpfm/blob/master/LICENSE.
//---------------------------------------------------------------------------//
//! Module containing tests for decoding/encoding `BmdVegetation` files.
use ;
use File;
use crateReadBytes;
use crate*;
use BmdVegetation;
/*
#[test]
fn test_encode_bmd_vegetation_to_layer() {
let path_1 = "../test_files/fastbin/test_prefab_with_vegetation.bmd.vegetation";
let path_2 = "../test_files/fastbin/test_prefab_with_vegetation.layer";
let mut reader = BufReader::new(File::open(path_1).unwrap());
let decodeable_extra_data = DecodeableExtraData::default();
let data = BmdVegetation::decode(&mut reader, &Some(decodeable_extra_data)).unwrap();
let layer = data.to_layer().unwrap();
dbg!(&layer);
let mut writer = BufWriter::new(File::create(path_2).unwrap());
writer.write_all(layer.as_bytes()).unwrap();
}*/
/*
#[test]
fn test_mass_decode() {
let folder_path = "/home/frodo45127/Proyectos/rpfm_test_files2/prefabs/";
let paths = files_from_subdir(&PathBuf::from(folder_path), true).unwrap();
let mut failures = 0;
let mut heigh_modes = HashSet::new();
let decodeable_extra_data = Some(DecodeableExtraData::default());
for path in &paths {
//println!("{}", path.to_string_lossy());
let mut reader = BufReader::new(File::open(path).unwrap());
match Bmd::decode(&mut reader, &decodeable_extra_data) {
Ok(data) => {
for building in data.battlefield_building_list().buildings() {
heigh_modes.insert(building.height_mode().to_owned());
}
for prop in data.prop_list().props() {
heigh_modes.insert(prop.height_mode().to_owned());
}
},
Err(error) => {
println!("\t{}", error);
failures += 1;
}
}
}
println!("Total errors: {}", failures);
dbg!(heigh_modes);
}
*/