예제 #1
0
        //最简单的一个例子
        private void button1_Click(object sender, EventArgs e)
        {
            BonkerZip zip = new BonkerZip();

            zip.AddFile(@"C:\Documents and Settings\Administrator\桌面\入党\单位鉴定.docx");//此路径是绝对路径
            zip.AddFile(@"C:\Documents and Settings\Administrator\桌面\入党\入党转正申请书.docx");
            zip.AddFile(@"C:\Documents and Settings\Administrator\桌面\vchelp");
            bool result = zip.CompressionZip("什么时候吃饭.zip");//压缩后文件的绝对路径

            if (!result)
            {
                MessageBox.Show(zip.errorMsg);
            }
            else
            {
                MessageBox.Show("压缩成功!");
            }
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "C:\\";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                bonkerZip.AddFile(openFileDialog.FileName);
            }
        }