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
//! This is a simple way to decrypt the ncm file.
//!
//! # Install
//!
//! You can add this to your `Cargo.toml`:
//!
//! ```toml
//! ncmdump = "0.5.0"
//! ```
//!
//! Also, you can use this command to install this crate,
//! if you installed [cargo-edit](https://github.com/killercup/cargo-edit)
//!
//! ```shell
//! cargo add ncmdump
//! ```
//!
//! # Usage
//!
//! ```rust
//! use std::fs::File;
//! use std::io::Write;
//! use std::path::Path;
//!
//! use anyhow::Result;
//! use ncmdump::Ncmdump;
//!
//! fn main() -> Result<()> {
//!
//!     let file = File::open("tests/test.ncm")?;
//!     let mut ncm = Ncmdump::from_reader(file)?;
//!     let music = ncm.get_data()?;
//!     let mut target = File::options()
//!         .create(true)
//!         .write(true)
//!         .open("tests/test.flac")?;
//!     target.write_all(&music)?;
//!     Ok(())
//! }
//! ```
//!
#[cfg(feature = "ncmdump")]
mod ncmdump;
#[cfg(feature = "qmcdump")]
mod qmcdump;

pub mod error;
#[cfg(feature = "utils")]
pub mod utils;

#[cfg(feature = "ncmdump")]
pub use crate::ncmdump::NcmInfo;
#[cfg(feature = "ncmdump")]
pub use crate::ncmdump::Ncmdump;

#[cfg(feature = "qmcdump")]
pub use crate::qmcdump::QmcDump;