예제 #1
0
        private void btnListZipFiles_Click(object sender, System.EventArgs e)
        {
            openFileDialog1.ShowDialog();
            string file = openFileDialog1.FileName;

            if (file == null | file == string.Empty)
            {
                return;
            }

            //Clear the DLL messages output area
            prgBar.Value     = prgBar.Minimum;
            lblProgress.Text = "";
            textBox1.Text    = "";

            //Instantiate the Unzip object
            m_Unzip = new Unzip();

            //NOTE:
            //There are many unzip options.  This sample just demonstrates basic unzip options.
            //Consult the InfoZip documentation for more option information.

            //Set the Unzip object properties
            m_Unzip.ZipFileName      = file;
            m_Unzip.HonorDirectories = HonorDirectoriesEnum.True;
            m_Unzip.ExtractOrList    = ExtractOrListEnum.ListContents;

            //Wire the event handlers to receive the events from the Unzip class
            m_Unzip.ReceivePrintMessage   += new UnZipDLLPrintMessageEventHandler(unZip_ReceivePrintMessage);
            m_Unzip.ReceiveServiceMessage += new UnZipDLLServiceMessageEventHandler(unZip_ReceiveServiceMessage);

            //Unzip the files
            ZipFileEntries zfes = m_Unzip.GetZipFileContents();

            //Show the file contents
            frmShowContents frm = new frmShowContents();

            frm.UnzippedFileCollection = zfes;

            //WORK AROUND:
            frm.Comment = m_Unzip.GetZipFileComment();

            frm.ShowDialog(this);

            //Examine the return code
            MessageBox.Show("Done.");
        }
예제 #2
0
		private void btnListZipFiles_Click(object sender, System.EventArgs e)
		{

			openFileDialog1.ShowDialog();
			string file = openFileDialog1.FileName;

			if (file == null | file == string.Empty) return;

			//Clear the DLL messages output area
			prgBar.Value = prgBar.Minimum;
			lblProgress.Text = "";
			textBox1.Text = "";

			//Instantiate the Unzip object
			m_Unzip = new Unzip();

			//NOTE:
			//There are many unzip options.  This sample just demonstrates basic unzip options.
			//Consult the InfoZip documentation for more option information.

			//Set the Unzip object properties
			m_Unzip.ZipFileName = file;
			m_Unzip.HonorDirectories = HonorDirectoriesEnum.True;
			m_Unzip.ExtractOrList = ExtractOrListEnum.ListContents;

			//Wire the event handlers to receive the events from the Unzip class
			m_Unzip.ReceivePrintMessage +=new UnZipDLLPrintMessageEventHandler(unZip_ReceivePrintMessage);
			m_Unzip.ReceiveServiceMessage +=new UnZipDLLServiceMessageEventHandler(unZip_ReceiveServiceMessage);

			//Unzip the files
			ZipFileEntries zfes = m_Unzip.GetZipFileContents();

			//Show the file contents
			frmShowContents frm = new frmShowContents();
			frm.UnzippedFileCollection = zfes;

			//WORK AROUND:
			frm.Comment = m_Unzip.GetZipFileComment();

			frm.ShowDialog(this);

			//Examine the return code
			MessageBox.Show("Done.");

		}
예제 #3
0
		private void btnUnzipArchive_Click(object sender, System.EventArgs e)
		{
			openFileDialog1.ShowDialog();
			string file = openFileDialog1.FileName;

			if (file == null | file == string.Empty) return;

			//Clear the DLL messages output area
			m_CurrentSize = 0;
			prgBar.Value = prgBar.Minimum;
			lblProgress.Text = "";
			textBox1.Text = "";

			//Instantiate the Unzip object
			m_Unzip = new Unzip();

			//NOTE:
			//There are many unzip options.  This sample just demonstrates basic unzip options.
			//Consult the InfoZip documentation for more option information.

			//Set the Unzip object properties
			m_Unzip.ZipFileName = file;
			m_Unzip.HonorDirectories = HonorDirectoriesEnum.True;
			m_Unzip.ExtractOrList = ExtractOrListEnum.Extract;

			//This option sets the DLL to display only the archive comment and
			//then exit immediately.
			//m_Unzip.DisplayComment = DisplayCommentEnum.True;

			//This option switches the DLL into "verbose ZipInfo" mode. The
			//DLL extracts nothing, but instead prints out a verbose technical list
			//of the content of the Zip archive central directory.
			//This option works now, but gets terribly slow when applied to archives
			//with a large number of entries.
			//m_Unzip.VerboseZI = VerboseZIEnum.True;

			if (chkOverwriteAll.Checked)
			{
				m_Unzip.OverWriteFiles = OverWriteFilesEnum.True;
				m_Unzip.PromptToOverWrite = PromptToOverWriteEnum.NotRequired;
			}
			else
			{
				m_Unzip.OverWriteFiles = OverWriteFilesEnum.False;
				m_Unzip.PromptToOverWrite = PromptToOverWriteEnum.Required;
			}

			//NOTE:
			//Directory where the unzipped files are stored.  Change this as appropriate
			m_Unzip.ExtractDirectory = @"c:\temp\unzip";

			//Wire the event handlers to receive the events from the Unzip class
			m_Unzip.ReceivePrintMessage +=new UnZipDLLPrintMessageEventHandler(unZip_ReceivePrintMessage);
			m_Unzip.ReceiveServiceMessage +=new UnZipDLLServiceMessageEventHandler(unZip_ReceiveServiceMessage);

			//Unzip the files
			int ret = m_Unzip.UnZipFiles();

			//Examine the return code
			MessageBox.Show("Done.  Return Code: " + ret.ToString());
		}
예제 #4
0
        private void btnUnzipArchive_Click(object sender, System.EventArgs e)
        {
            openFileDialog1.ShowDialog();
            string file = openFileDialog1.FileName;

            if (file == null | file == string.Empty)
            {
                return;
            }

            //Clear the DLL messages output area
            m_CurrentSize    = 0;
            prgBar.Value     = prgBar.Minimum;
            lblProgress.Text = "";
            textBox1.Text    = "";

            //Instantiate the Unzip object
            m_Unzip = new Unzip();

            //NOTE:
            //There are many unzip options.  This sample just demonstrates basic unzip options.
            //Consult the InfoZip documentation for more option information.

            //Set the Unzip object properties
            m_Unzip.ZipFileName      = file;
            m_Unzip.HonorDirectories = HonorDirectoriesEnum.True;
            m_Unzip.ExtractOrList    = ExtractOrListEnum.Extract;

            //This option sets the DLL to display only the archive comment and
            //then exit immediately.
            //m_Unzip.DisplayComment = DisplayCommentEnum.True;

            //This option switches the DLL into "verbose ZipInfo" mode. The
            //DLL extracts nothing, but instead prints out a verbose technical list
            //of the content of the Zip archive central directory.
            //This option works now, but gets terribly slow when applied to archives
            //with a large number of entries.
            //m_Unzip.VerboseZI = VerboseZIEnum.True;

            if (chkOverwriteAll.Checked)
            {
                m_Unzip.OverWriteFiles    = OverWriteFilesEnum.True;
                m_Unzip.PromptToOverWrite = PromptToOverWriteEnum.NotRequired;
            }
            else
            {
                m_Unzip.OverWriteFiles    = OverWriteFilesEnum.False;
                m_Unzip.PromptToOverWrite = PromptToOverWriteEnum.Required;
            }

            //NOTE:
            //Directory where the unzipped files are stored.  Change this as appropriate
            m_Unzip.ExtractDirectory = @"c:\temp\unzip";

            //Wire the event handlers to receive the events from the Unzip class
            m_Unzip.ReceivePrintMessage   += new UnZipDLLPrintMessageEventHandler(unZip_ReceivePrintMessage);
            m_Unzip.ReceiveServiceMessage += new UnZipDLLServiceMessageEventHandler(unZip_ReceiveServiceMessage);

            //Unzip the files
            int ret = m_Unzip.UnZipFiles();

            //Examine the return code
            MessageBox.Show("Done.  Return Code: " + ret.ToString());
        }