diff --git a/GameRes/ImageDecoder.cs b/GameRes/ImageDecoder.cs index f1d6ffa9..60d5e23f 100644 --- a/GameRes/ImageDecoder.cs +++ b/GameRes/ImageDecoder.cs @@ -87,6 +87,23 @@ namespace GameRes Info = info; } + /// + /// Create instance of ImageFormatDecoder from input binary stream. + /// In case of error input stream is disposed. + /// + public static ImageFormatDecoder Create (IBinaryStream input) + { + try + { + return new ImageFormatDecoder (input); + } + catch + { + input.Dispose(); + throw; + } + } + bool m_disposed = false; public void Dispose () {