backtrip 0.1.4

A decompiler in Rust — turns .NET assemblies (.dll/.exe) into C# and JVM class files (.class) into Java, with IL/javap-style disassembly and round-trip verification
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::decompile::DecompiledType;
use crate::error::{Error, Result};
use std::path::Path;

/// Write decompiled types to a directory, one file per type.
/// Returns the number of files written.
pub fn write_types(out_dir: &Path, types: &[DecompiledType]) -> Result<usize> {
    std::fs::create_dir_all(out_dir)
        .map_err(Error::Io)?;
    let mut count = 0;
    for t in types {
        let path = out_dir.join(&t.file_name);
        std::fs::write(&path, &t.source).map_err(Error::Io)?;
        count += 1;
    }
    Ok(count)
}