private void LookIn(string path) { _status = "Looking in " + path; string[] gifs; try { gifs = Directory.GetFiles(path, "*.gif"); foreach (string gif in gifs) { _status = "Decoding " + gif; try { GifDecoder decoder = new GifDecoder(gif); decoder.Dispose(); } catch (Exception) { WriteMessage("Exception while decoding " + gif); throw; } } string[] folders = Directory.GetDirectories(path); foreach (string folder in folders) { LookIn(folder); } } catch (UnauthorizedAccessException) { // suppress } }
/// <summary> /// Disposes resources used by this class. /// </summary> /// <param name="disposing"> /// Indicates whether this method is being called by the class's Dispose /// method (true) or by the garbage collector (false). /// </param> protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { // dispose-only, i.e. non-finalizable logic _decoder.Dispose(); _lsd.Dispose(); } // new shared cleanup logic _disposed = true; } // Uncomment if the base type also implements IDisposable // base.Dispose( disposing ); }
public void Dispose() { _stream?.Dispose(); _gifDecoder?.Dispose(); _targetBitmap?.Dispose(); }
private void LookIn( string path ) { _status = "Looking in " + path; string[] gifs; try { gifs = Directory.GetFiles( path, "*.gif" ); foreach( string gif in gifs ) { _status = "Decoding " + gif; try { GifDecoder decoder = new GifDecoder( gif ); decoder.Dispose(); } catch( Exception ) { WriteMessage( "Exception while decoding " + gif ); throw; } } string[] folders = Directory.GetDirectories( path ); foreach( string folder in folders ) { LookIn( folder ); } } catch( UnauthorizedAccessException ) { // suppress } }