modified: outdb
modified: src/main.rs
This commit is contained in:
parent
4b07a48a08
commit
34bf440691
17
src/main.rs
17
src/main.rs
@ -473,8 +473,8 @@ fn to_bytes(xdb: XDatabase) -> Vec<u8> {
|
|||||||
}
|
}
|
||||||
let h = bincode::serialize(&ChunkHeader {
|
let h = bincode::serialize(&ChunkHeader {
|
||||||
chunk_type: ChunkType::StringTypes.into(),
|
chunk_type: ChunkType::StringTypes.into(),
|
||||||
end_of_chunk: 60,
|
end_of_chunk: 72,
|
||||||
children_count: 60 + (4 * xpl.v.len() as u32)
|
children_count: 72 + (4 * xpl.v.len() as u32)
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
b = [h, b, v].concat();
|
b = [h, b, v].concat();
|
||||||
return b;
|
return b;
|
||||||
@ -487,8 +487,8 @@ fn to_bytes(xdb: XDatabase) -> Vec<u8> {
|
|||||||
}
|
}
|
||||||
let h = bincode::serialize(&ChunkHeader {
|
let h = bincode::serialize(&ChunkHeader {
|
||||||
chunk_type: ChunkType::StringTypes.into(),
|
chunk_type: ChunkType::StringTypes.into(),
|
||||||
end_of_chunk: 28,
|
end_of_chunk: 40,
|
||||||
children_count: 28 + (12 * xjump.v.len() as u32)
|
children_count: 40 + (12 * xjump.v.len() as u32)
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
b = [h, b, v].concat();
|
b = [h, b, v].concat();
|
||||||
return b;
|
return b;
|
||||||
@ -557,15 +557,16 @@ fn main() {
|
|||||||
.filter(None, LevelFilter::Info)
|
.filter(None, LevelFilter::Info)
|
||||||
.init();
|
.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();
|
let mut buf = Vec::new();
|
||||||
match f.read_to_end(&mut buf) {
|
match f.read_to_end(&mut buf) {
|
||||||
Ok(n) => {
|
Ok(n) => {
|
||||||
let data = &buf[..n];
|
let data = &buf[..n];
|
||||||
let xdb = parse_bytes(data);
|
let xdb = parse_bytes(data);
|
||||||
info!("XDB: {:?}", xdb);
|
//info!("XDB: {:?}", xdb);
|
||||||
let mut op = File::create("outdb").unwrap();
|
//let mut op = File::create("outdb").unwrap();
|
||||||
info!("Write res: {:?}", op.write(&to_bytes(xdb)));
|
//info!("Write res: {:?}", op.write(&to_bytes(xdb)));
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Error: {}",e);
|
error!("Error: {}",e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user