using System; using System.Collections.Generic; using System.Text; using System.Collections; using System.IO; using ICSharpCode.SharpZipLib.Zip; namespace sharpreleaser { public class ZipCommand : Command { private string source; private string filter; public string Source { get { return source; } set { source = value; } } public string Filter { get { return filter; } set { filter = value; } } public ZipCommand() : base() { Type = CommandType.ZIP; } public override void Execute(Project project) { try { string sourcePath = project.ParseVariables(source); string destPath = project.ParseVariables(CommandText); FastZip zip = new FastZip(); zip.CreateEmptyDirectories = true; zip.CreateZip(destPath, sourcePath, true, string.Empty); Output = "Created archive: " + destPath; } catch (Exception ex) { Error = ex.ToString(); } } public override string ToString() { return Type + ": " + Source + " (" + Filter + ")" + " -> " + CommandText; } } }