Delphi Database, Delphi Components from ComponentAce
Products Download Order Contact us

Search Example

Top 

The following example shows how to search files stored within the archive:

 

flexCompress1.FileName = "C:\\TEST\\test.fxc";

flexCompress1.OpenArchive();

ComponentAce.Compression.Archiver.ArchiveItem archiveItem =

       new ComponentAce.Compression.Archiver.ArchiveItem();

if (flexCompress1.FindFirst("*.*", ref archiveItem))

{

       do

     {

            ListViewItem listItem = new ListViewItem();

           listItem.Text = archiveItem.FileName;

           ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem(listItem,

                       archiveItem.LastWriteTime.ToShortDateString() + " " +

                       archiveItem.LastWriteTime.ToShortTimeString());

           listItem.SubItems.Add(subItem);

           subItem = new ListViewItem.ListViewSubItem(listItem,

                       archiveItem.UncompressedSize.ToString());

           listItem.SubItems.Add(subItem);                   

           subItem = new ListViewItem.ListViewSubItem(listItem,

                       archiveItem.CompressedSize.ToString());

           listItem.SubItems.Add(subItem);

           subItem = new ListViewItem.ListViewSubItem(listItem,

                       archiveItem.CompressionRate.ToString());

           listItem.SubItems.Add(subItem);

           subItem = new ListViewItem.ListViewSubItem(listItem,

                      ((uint)archiveItem.CRC).ToString());

           listItem.SubItems.Add(subItem);

           subItem = new ListViewItem.ListViewSubItem(listItem,

                       archiveItem.StoredPath);

           listItem.SubItems.Add(subItem);                   

           listView1.Items.Add(listItem);

      }

               while (flexCompress1.FindNext(ref archiveItem));

}

flexCompress1.CloseArchive();

 

[VB.NET]

flexCompress1.FileName = "C:\TEST\test.fxc";

flexCompress1.OpenArchive()

Dim archiveItem As ComponentAce.Compression.Archiver.ArchiveItem = New ComponentAce.Compression.Archiver.ArchiveItem()

If flexCompress1.FindFirst("*.*", archiveItem) Then

Do               

       Dim listItem As ListViewItem = New ListViewItem()

     listItem.Text = archiveItem.FileName

     Dim subItem As ListViewItem.ListViewSubItem = New ListViewItem.ListViewSubItem(listItem,

               archiveItem.LastWriteTime.ToShortDateString() + " " +

               archiveItem.LastWriteTime.ToShortTimeString())

       listItem.SubItems.Add(subItem)

     subItem = New ListViewItem.ListViewSubItem(listItem, archiveItem.UncompressedSize.ToString())

     listItem.SubItems.Add(subItem)

     subItem = New ListViewItem.ListViewSubItem(listItem, archiveItem.CompressedSize.ToString())

     listItem.SubItems.Add(subItem)

     subItem = New ListViewItem.ListViewSubItem(listItem, archiveItem.CompressionRate.ToString())

     listItem.SubItems.Add(subItem)

     subItem = New ListViewItem.ListViewSubItem(listItem, (CType(archiveItem.CRC,

               System.UInt32)).ToString())

       listItem.SubItems.Add(subItem)

     subItem = New ListViewItem.ListViewSubItem(listItem, archiveItem.StoredPath)

     listItem.SubItems.Add(subItem)

     listView1.Items.Add(listItem)

Loop While flexCompress1.FindNext(archiveItem)

End If

flexCompress1.CloseArchive()

        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Apr 23, 2024