{
  "WorkItem": {
    "AffectedComponent": {
      "Name": "",
      "DisplayName": ""
    },
    "ClosedComment": "not a bug",
    "ClosedDate": "2008-09-05T10:44:08.99-07:00",
    "CommentCount": 0,
    "Custom": null,
    "Description": "Here're code in the library in c# that increases length of library. Could you please somehow remove it?\n \n    using System;\n    using System.Reflection;\n    using System.IO;\n    using System.Windows.Forms;\n \n \n    public partial class WinFormsSelfExtractorStub : Form\n    {\n        //const string IdString = \"DotNetZip Self Extractor, see http://www.codeplex.com/DotNetZip\";\n        const string DllResourceName = \"Ionic.Utils.Zip.dll\";\n        public WinFormsSelfExtractorStub()\n        {\n            InitializeComponent();\n            txtExtractDirectory.Text = Environment.GetFolderPath(Environment.SpecialFolder.Personal);\n \n            Stream s = GetZipStream();\n            try\n            {\n                using (global::Ionic.Utils.Zip.ZipFile zip = global::Ionic.Utils.Zip.ZipFile.Read(s))\n                {\n                    if ((zip.Comment != null) && (zip.Comment != \"\"))\n                    {\n                        txtComment.Text = zip.Comment;\n                    }\n                    else\n                    {\n                        //label2.Text = \"\";\n                        //txtComment.Text = \"\";\n                        label2.Visible= false;\n                        txtComment.Visible = false;\n                        this.Size = new System.Drawing.Size(this.Width, this.Height - 113);\n                    }\n                }\n            }\n            catch\n            {\n                label2.Visible = false;\n                txtComment.Visible= false;\n                this.Size = new System.Drawing.Size(this.Width, this.Height - 113);\n            }\n        }\n \n        static WinFormsSelfExtractorStub()\n        {\n            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Resolver);\n        }\n \n        static System.Reflection.Assembly Resolver(object sender, ResolveEventArgs args)\n        {\n            Assembly a1 = Assembly.GetExecutingAssembly();\n            Assembly a2 = null;\n \n            Stream s = a1.GetManifestResourceStream(DllResourceName);\n            int n = 0;\n            int totalBytesRead = 0;\n            byte[] bytes = new byte[1024];\n            do\n            {\n                n = s.Read(bytes, 0, bytes.Length);\n                totalBytesRead += n;\n            }\n            while (n > 0);\n \n            byte[] block = new byte[totalBytesRead];\n            s.Seek(0, System.IO.SeekOrigin.Begin);\n            s.Read(block, 0, block.Length);\n \n            a2 = Assembly.Load(block);\n \n            return a2;\n        }\n \n \n \n        private void btnDirBrowse_Click(object sender, EventArgs e)\n        {\n            FolderBrowserDialog folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();\n            // Default to the My Documents folder.\n            folderBrowserDialog1.RootFolder = Environment.SpecialFolder.Personal;\n            folderBrowserDialog1.SelectedPath = txtExtractDirectory.Text;\n            folderBrowserDialog1.ShowNewFolderButton = true;\n \n            folderBrowserDialog1.Description = \"Select the directory for the extracted files.\";\n \n            // Show the FolderBrowserDialog.\n            DialogResult result = folderBrowserDialog1.ShowDialog();\n            if (result == DialogResult.OK)\n            {\n                txtExtractDirectory.Text = folderBrowserDialog1.SelectedPath;\n            }\n        }\n \n        private void btnExtract_Click(object sender, EventArgs e)\n        {\n            string targetDirectory = txtExtractDirectory.Text;\n            bool WantOverwrite = chk_Overwrite.Checked;\n            bool extractCancelled = false;\n            string currentPassword = null;\n \n            Stream s = GetZipStream();\n \n            try\n            {\n                using (global::Ionic.Utils.Zip.ZipFile zip = global::Ionic.Utils.Zip.ZipFile.Read(s))\n                {\n                    foreach (global::Ionic.Utils.Zip.ZipEntry entry in zip)\n                    {\n                        if (entry.Encryption == global::Ionic.Utils.Zip.EncryptionAlgorithm.None)\n                            try\n                            {\n                                entry.Extract(targetDirectory, WantOverwrite);\n                            }\n                            catch (Exception ex1)\n                            {\n                                DialogResult result = MessageBox.Show(String.Format(\"Failed to extract entry {0} -- {1}\", entry.FileName, ex1.Message.ToString()),\n                                     String.Format(\"Error Extracting {0}\", entry.FileName), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);\n \n                                if (result == DialogResult.Cancel)\n                                {\n                                    extractCancelled = true;\n                                    break;\n                                }\n                            }\n                        else\n                        {\n                            while ((currentPassword == null) || (currentPassword == \"\"))\n                            {\n                                currentPassword = PromptForPassword(entry.FileName);\n                            }\n \n                            try\n                            {\n                                entry.ExtractWithPassword(currentPassword, WantOverwrite, targetDirectory);\n                            }\n                            catch (Exception ex2)\n                            {\n                                // TODO: probably want a retry here in the case of bad password.\n                                DialogResult result = MessageBox.Show(String.Format(\"Failed to extract the password-encrypted entry {0} -- {1}\", entry.FileName, ex2.Message.ToString()),\n                                    String.Format(\"Error Extracting {0}\", entry.FileName), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);\n \n                                if (result == DialogResult.Cancel)\n                                {\n                                    extractCancelled = true;\n                                    break;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n            catch (Exception)\n            {\n                MessageBox.Show(\"The self-extracting zip file is corrupted.\",\n                    \"Error Extracting\", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);\n                Application.Exit();\n            }\n \n            if (extractCancelled) return;\n \n            btnExtract.Text = \"Extracted.\";\n            btnExtract.Enabled = false;\n            btnCancel.Text = \"Quit\";\n \n            if (chk_OpenExplorer.Checked)\n            {\n                string w = System.Environment.GetEnvironmentVariable(\"WINDIR\");\n                if (w == null) w = \"c:\\\\windows\";\n                try\n                {\n                    System.Diagnostics.Process.Start(Path.Combine(w, \"explorer.exe\"), targetDirectory);\n                }\n                catch { }\n            }\n            //Application.Exit();\n \n        }\n \n        private static Stream GetZipStream()\n        {\n            // There are only two embedded resources.\n            // One of them is the zip dll.  The other is the zip archive.\n            // We load the resouce that is NOT the DLL, as the zip archive.\n            Assembly a = Assembly.GetExecutingAssembly();\n            string[] x = a.GetManifestResourceNames();\n            Stream s = null;\n            foreach (string name in x)\n            {\n                if ((name != DllResourceName) && (name.EndsWith(\".zip\")))\n                {\n                    s = a.GetManifestResourceStream(name);\n                    break;\n                }\n            }\n \n            if (s == null)\n            {\n                MessageBox.Show(\"No Zip archive found.\",\n                       \"Error Extracting\", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);\n                Application.Exit();\n            }\n            return s;\n        }\n \n \n        private string PromptForPassword(string entryName)\n        {\n            PasswordDialog dlg1 = new PasswordDialog();\n            dlg1.EntryName = entryName;\n            dlg1.ShowDialog();\n            return dlg1.Password;\n        }\n \n        private void btnCancel_Click(object sender, EventArgs e)\n        {\n            Application.Exit();\n        }\n    }\n \n \n \n    class WinFormsSelfExtractorStubProgram\n    {\n        /// <summary>\n        /// The main entry point for the application.\n        /// </summary>\n        [STAThread]\n        static void Main()\n        {\n            Application.EnableVisualStyles();\n            Application.SetCompatibleTextRenderingDefault(false);\n            Application.Run(new WinFormsSelfExtractorStub());\n        }\n    }\n}",
    "LastUpdatedDate": "2013-05-16T05:32:39.58-07:00",
    "PlannedForRelease": "",
    "ReleaseVisibleToPublic": false,
    "Priority": {
      "Name": "Low",
      "Severity": 50,
      "Id": 1
    },
    "ProjectName": "DotNetZip",
    "ReportedDate": "2008-09-05T07:18:56.35-07:00",
    "Status": {
      "Name": "Closed",
      "Id": 4
    },
    "ReasonClosed": {
      "Name": "Unassigned"
    },
    "Summary": "Strange code inside the library",
    "Type": {
      "Name": "Issue",
      "Id": 3
    },
    "VoteCount": 1,
    "Id": 6047
  },
  "FileAttachments": [],
  "Comments": [
    {
      "Message": "That \"strange code\" is for the Self-Extracting support.   It is the stub of the winforms app that runs when a self-extracting zip created by DotNetZip, is executed.\r\n\r\nWhen I added the self-extractor feature, I realized that it would inflate the size of the library significantly. \r\nWithout the self-extractor, the library is around 50k I think.  And with the self-extractor, it is over 200k.  \r\n\r\nI'm considering how to best strike the balance.  One way may for me to produce 2 versions of the library - one with the self-extractor feature, and one without. \r\n\r\nSo far you are the first one who complained.  And you didn't even complain about the size of the library, you just complained because you didn't understand the code.  So at this point I am leaning to doing nothing. \r\n\r\n\r\n",
      "PostedDate": "2008-09-05T10:41:59.32-07:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2008-09-05T10:44:08.99-07:00",
      "Id": -2147483648
    },
    {
      "Message": "As for me it's not very comfortable because when i'm searching something in solution - sharp develop often points to this code in this library.\r\n\r\nMy idea is to zip this code as internal data field and to unzip when creating sfx",
      "PostedDate": "2008-09-07T08:22:47.07-07:00",
      "Id": -2147483648
    },
    {
      "Message": "I agree, one would want to use only the zipping functionality without creating self exracting files. Distributing data through ZIP files is much better than through EXE fiels. I cannot see why one would want to create EXE files programmatically! Would not be much use for emailing or web. Creating ZIP files programatically to archive would take less space than EXE.\r\n\r\nA separate unitility or library that converts a standard ZIP file into a self-extracting EXE would be more useful.\r\n\r\nI hope that these comments would encourage the removal of the 'strange code' from the LIB to make it a little smaller.",
      "PostedDate": "2008-09-07T08:29:18.05-07:00",
      "Id": -2147483648
    },
    {
      "Message": "> And you didn't even complain about the size of the library, you just complained because you didn't understand the code\r\n\r\nNo. i was talking not about the sense of your code.\r\nWhen i create a new solution in SharpDevelop and add your library to project(include its binary)\r\nand then searching for some string in my source code, SharpDevelop also finds some code from code in your compiled library.\r\n\r\nHowever i don't use SD now so its not important for me now",
      "PostedDate": "2010-04-23T11:50:44.143-07:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2013-02-21T18:44:41.667-08:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2013-05-16T05:32:39.58-07:00",
      "Id": -2147483648
    }
  ]
}