mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-07 21:38:58 +08:00
Add import support for escude list
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
use crate::types::*;
|
||||
use anyhow::Result;
|
||||
use std::io::{Read, Seek};
|
||||
use std::io::{Read, Seek, Write};
|
||||
|
||||
pub trait ReadSeek: Read + Seek + std::fmt::Debug {}
|
||||
|
||||
pub trait WriteSeek: Write + Seek {}
|
||||
|
||||
impl<T: Read + Seek + std::fmt::Debug> ReadSeek for T {}
|
||||
|
||||
impl<T: Write + Seek> WriteSeek for T {}
|
||||
|
||||
pub trait ScriptBuilder: std::fmt::Debug {
|
||||
fn default_encoding(&self) -> Encoding;
|
||||
|
||||
@@ -114,6 +118,29 @@ pub trait Script: std::fmt::Debug {
|
||||
))
|
||||
}
|
||||
|
||||
fn custom_import(
|
||||
&self,
|
||||
_custom_filename: &str,
|
||||
_file: Box<dyn WriteSeek>,
|
||||
_encoding: Encoding,
|
||||
_output_encoding: Encoding,
|
||||
) -> Result<()> {
|
||||
Err(anyhow::anyhow!(
|
||||
"This script type does not support custom import."
|
||||
))
|
||||
}
|
||||
|
||||
fn custom_import_filename(
|
||||
&self,
|
||||
custom_filename: &str,
|
||||
filename: &str,
|
||||
encoding: Encoding,
|
||||
output_encoding: Encoding,
|
||||
) -> Result<()> {
|
||||
let f = std::fs::File::create(filename)?;
|
||||
self.custom_import(custom_filename, Box::new(f), encoding, output_encoding)
|
||||
}
|
||||
|
||||
fn is_archive(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user