From 7f5d2c9b242ec01433df1de94f049fc6413d69ae Mon Sep 17 00:00:00 2001 From: morkt Date: Fri, 31 Aug 2018 04:41:02 +0400 Subject: [PATCH] (ImageFormatDecoder.Create): new static method. --- GameRes/ImageDecoder.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 () {