예제 #1
0
        //---------------------------------------------------------------------------
        #region ** main menu event handlers

        // create a new zip file
        void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // show dialog
            var sf = new SaveFileDialog();

            sf.DefaultExt = "zip";
            sf.Filter     = "Zip files (*.zip)|*.zip";
            if (sf.ShowDialog(this) == DialogResult.OK)
            {
                // create a new empty zip file
                _zipFile.Create(sf.FileName);

                // update user interface
                UpdateUI();
            }
        }
예제 #2
0
        // build list of images in resource directory, add them all to a zip file
        private void Form1_Load(object sender, System.EventArgs e)
        {
            // get app dir
            string s = Application.ExecutablePath;

            s = s.Substring(0, s.IndexOf(@"\bin")) + @"\resources";

            // create zip file
            _zip.Create(s + @"\images.zip");

            // populate zip file and list
            foreach (string f in Directory.GetFiles(s))
            {
                string fname = f.ToLower();
                if (fname.EndsWith("zip"))
                {
                    continue;                                // skip self
                }
                listBox1.Items.Add(Path.GetFileName(fname)); // add to list
                _zip.Entries.Add(fname);                     // add to zip file
            }
        }