modified: outdb

modified:   src/main.rs
This commit is contained in:
Michael Wain 2025-02-08 03:53:16 +03:00
parent 4b07a48a08
commit 34bf440691
2 changed files with 9 additions and 8 deletions

BIN
outdb

Binary file not shown.

View File

@ -473,8 +473,8 @@ fn to_bytes(xdb: XDatabase) -> Vec<u8> {
}
let h = bincode::serialize(&ChunkHeader {
chunk_type: ChunkType::StringTypes.into(),
end_of_chunk: 60,
children_count: 60 + (4 * xpl.v.len() as u32)
end_of_chunk: 72,
children_count: 72 + (4 * xpl.v.len() as u32)
}).unwrap();
b = [h, b, v].concat();
return b;
@ -487,8 +487,8 @@ fn to_bytes(xdb: XDatabase) -> Vec<u8> {
}
let h = bincode::serialize(&ChunkHeader {
chunk_type: ChunkType::StringTypes.into(),
end_of_chunk: 28,
children_count: 28 + (12 * xjump.v.len() as u32)
end_of_chunk: 40,
children_count: 40 + (12 * xjump.v.len() as u32)
}).unwrap();
b = [h, b, v].concat();
return b;
@ -557,15 +557,16 @@ fn main() {
.filter(None, LevelFilter::Info)
.init();
let mut f = File::open("D:\\Documents\\iTunes\\iTunesDB").unwrap(); // D:\\Documents\\iTunes\\iTunesDB
// /Users/michael/Documents/ipod/iTunes/iTunesDB
let mut f = File::open("outdb").unwrap(); // D:\\Documents\\iTunes\\iTunesDB
let mut buf = Vec::new();
match f.read_to_end(&mut buf) {
Ok(n) => {
let data = &buf[..n];
let xdb = parse_bytes(data);
info!("XDB: {:?}", xdb);
let mut op = File::create("outdb").unwrap();
info!("Write res: {:?}", op.write(&to_bytes(xdb)));
//info!("XDB: {:?}", xdb);
//let mut op = File::create("outdb").unwrap();
//info!("Write res: {:?}", op.write(&to_bytes(xdb)));
},
Err(e) => {
error!("Error: {}",e);