public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, object transaction) { bool b = false; componentEvents.FireInformation(1, "UnZip SSIS", "Start 1", null, 0, ref b); componentEvents.FireInformation(1, "UnZip SSIS", "Start process file: '" + _folderDest + _fileZip + "'.", null, 0, ref b); if (_typeOperation == Type_Operation.Please_Select) { componentEvents.FireError(1, "UnZip SSIS", "Please select type operation (De/Compress).", null, 0); throw new Exception("Please select type operation (De/Compress)."); } ICSharpCode.SharpZipLib.Zip.FastZip fz = new ICSharpCode.SharpZipLib.Zip.FastZip(); if (!_folderSource.EndsWith("\\")) { _folderSource = _folderSource + "\\"; } if (!_folderDest.EndsWith("\\")) { _folderDest = _folderDest + "\\"; } if (!string.IsNullOrEmpty(_password)) { fz.Password = _password; } try { if (!System.IO.Directory.Exists(_folderDest)) { componentEvents.FireInformation(1, "UnZip SSIS", "Create Folder: '" + _folderDest + "'.", null, 0, ref b); System.IO.Directory.CreateDirectory(_folderDest); } if (_typeOperation == Type_Operation.Compress) { fz.CreateZip(_folderDest + _fileZip, _folderSource, _Recurse, _FileFilter); if ((_testarchive) || (!string.IsNullOrEmpty(_comment))) { ICSharpCode.SharpZipLib.Zip.ZipFile zipFile = new ICSharpCode.SharpZipLib.Zip.ZipFile(_folderDest + _fileZip); if (_testarchive) { componentEvents.FireInformation(1, "UnZip SSIS", "Start verify file ZIP (" + _fileZip + ")", null, 0, ref b); if (!zipFile.TestArchive(true)) { throw new Exception("Verify file zip: " + _fileZip + " failed."); } } if (!string.IsNullOrEmpty(_comment)) { componentEvents.FireInformation(1, "UnZip SSIS", "Set Comment.", null, 0, ref b); zipFile.BeginUpdate(); zipFile.SetComment(_comment); zipFile.CommitUpdate(); } } } else { if (_testarchive) { ICSharpCode.SharpZipLib.Zip.ZipFile zipFile = new ICSharpCode.SharpZipLib.Zip.ZipFile(_folderSource + _fileZip); componentEvents.FireInformation(1, "UnZip SSIS", "Start verify file ZIP (" + _fileZip + ")", null, 0, ref b); if (!zipFile.TestArchive(true)) { throw new Exception("Verify file zip: " + _fileZip + " failed."); } } fz.ExtractZip(_folderSource + _fileZip, _folderDest, _FileFilter); } } catch (Exception ex) { throw; } componentEvents.FireInformation(1, "UnZip SSIS", "End process file: '" + _folderDest + _fileZip + "'.", null, 0, ref b); return(DTSExecResult.Success); }