implement image preview

This commit is contained in:
2019-05-09 20:13:15 +02:00
parent c7eff9080b
commit 89b2b480ce
3 changed files with 45 additions and 31 deletions

View File

@ -56,16 +56,9 @@ impl ProtocolHandler for ServerState {
) -> ProtocolResult<Vec<u8>> {
let mut data_store = self.data_store.write().unwrap();
match data_store.get_texture_preview(&hash, format) {
Ok(data) => Ok(data),
Err(TextureFileError::NotFound) => Err(ProtocolError::FileNotFound(
"Texture not found!".to_string(),
)),
Err(TextureFileError::ImageError(_)) => Err(ProtocolError::FileNotFound(
"Didn't Find valid Texture File".to_string(),
)),
Err(TextureFileError::IoError(err)) => Err(ProtocolError::InternalServerError(err)),
}
let preview = data_store.get_texture_preview(&hash, format)?;
Ok(preview)
}
fn replace_texture(