private void StoreToFile(DcmParser parser, DataSet ds, FileInfo file, DcmEncodeParam encParam) { Stream outputStream = OpenOutputStream(file); try { ds.WriteFile(outputStream, encParam); if (parser.ReadTag == Tags.PixelData) { ds.WriteHeader(outputStream, encParam, parser.ReadTag, parser.ReadVR, parser.ReadLength); Copy(parser.InputStream, outputStream); } } finally { try { outputStream.Close(); } catch (IOException ignore) { Logger.Error(ignore); } } }