it converts!!

This commit is contained in:
Alex Janka 2021-07-10 14:49:13 +10:00
parent 3f778cd3ab
commit 37090d6945
3 changed files with 22 additions and 10 deletions

View file

@ -1,9 +1,11 @@
use ableton_rack_converter::{self, fixers};
fn main() {
let file_load = String::from(".\\validation\\Utility10.adg");
let file_save = String::from(".\\exported_files\\Utility10_save.xml");
let file_load = String::from(".\\validation\\Utility11.adg");
let xml_save = String::from(".\\exported_files\\Utility11_save.xml");
let file_save = String::from(".\\exported_files\\Utility11_save.adg");
let mut device = ableton_rack_converter::load_adg(&file_load);
fixers::traverse_children(&mut device);
ableton_rack_converter::save_uncompressed(&device, &file_save);
ableton_rack_converter::save_uncompressed(&device, &xml_save);
ableton_rack_converter::save_adg(&device, &file_save);
}

View file

@ -1,6 +1,20 @@
use xml_dom::level2::{Element, Node, RefNode};
use xml_dom::level2::{Attribute, Node, RefNode};
pub fn traverse_children(node: &mut RefNode) {
if node.node_name().to_string() == "Ableton" {
for (name, mut attribute) in node.attributes() {
println!("{}: {}", name, attribute);
match name.to_string().as_str() {
"MajorVersion" => attribute.set_value("5").unwrap(),
"MinorVersion" => attribute.set_value("10.0_370").unwrap(),
"Revision" => attribute
.set_value("5ae7d4938908194888f90ed5411dc3def59687f2")
.unwrap(),
"Creator" => attribute.set_value("Ableton Live 10.0.3").unwrap(),
_ => (),
}
}
}
match node.node_name().to_string().as_str() {
"OverwriteProtectionNumber" => fix_overwrite_protection(node),
_ => {
@ -11,8 +25,4 @@ pub fn traverse_children(node: &mut RefNode) {
}
}
fn fix_overwrite_protection(node: &mut RefNode) {
node.set_attribute("Value", "FINDABLE")
.expect("couldnt set node value");
println!("{}", node);
}
fn fix_overwrite_protection(node: &mut RefNode) {}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Ableton MajorVersion="5" MinorVersion="11.0_433" Creator="Ableton Live 11.0.2" Revision="5b7f2a59a5595b4710f933f4c0063b9dc398917e">
<Ableton MajorVersion="5" MinorVersion="10.0_377" SchemaChangeCount="5" Creator="Ableton Live 10.1.35" Revision="a4cc5da58a12b2430753133883a25ad12aa979b7">
<GroupDevicePreset>
<OverwriteProtectionNumber Value="2817" />
<Device>