Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET How to populate a large zip archive and add to listview

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19724 |

    Hi,

    i have a large zip file, it contains over 3000 files in it. My aim is to create a program that able to read and display zip contents similar or close to Winzip speed (less than 5 secs).

    I want my program to get the zip archive contains and display it to the listview control and let the user choose which file(s) to extract or do whatever with it.

    Does anyone have any idea how to achieve this?

    PS. Oh i already tried Listview.VirtualMode = true, but there is limitation with this feature such as i can’t sort or get the selecteditems while in virtualmode.

    Looking forward to any help or suggestion, i think i have enough with it as i am already speed the last two weeks trying to solve the same problem – i am just not getting anywhere 🙁

    Imported from legacy forums. Posted by khmer (had 2586 views)

    User (Old forums)
    Member
    Post count: 23064

    The problem may be the Listview itself. I have tested a similar senario to what you describe, using our grid control, and a 3100+ archive loads within a 1 1/2 second.

    Here is the code I used, assuming the grid is dropped on a form with 2 columns for name and size, and the form has a menu item to open a file with the help of the OpenFileDialog control (also dropped on the form) :
    <i>
    private void Form1_Load(object sender, System.EventArgs e)
    {
    gridControl1.SortedColumns.Add( “File Name” );
    }

    private void menuItem2_Click(object sender, System.EventArgs e)
    {
    if( openFileDialog1.ShowDialog( this ) == DialogResult.OK )
    {
    DateTime time1 = DateTime.Now;
    string name = openFileDialog1.FileName;
    AbstractFile zip = new DiskFile( name );
    ZipArchive archive = new ZipArchive( zip );

    AbstractFile[] files = archive.GetFiles( true );

    foreach( AbstractFile file in files )
    {
    Xceed.Grid.DataRow row = gridControl1.DataRows.AddNew();
    row.Cells[ “File Name” ].Value = file.FullName;
    row.Cells[ “File Size” ].Value = file.Size;
    }
    gridControl1.Columns[ “File Name” ].Width = gridControl1.Columns[ “File Name” ].GetFittedWidth();
    gridControl1.Columns[ “File Size” ].Width = gridControl1.Columns[ “File Size” ].GetFittedWidth();
    DateTime time2 = DateTime.Now;

    System.Diagnostics.Debug.WriteLine( ( time1 – time2 ).ToString() );
    }
    }
    </i>
    Here is the time result :

    00:00:01.4686748 sec for 3120 files

    Imported from legacy forums. Posted by André (had 179 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Andre,

    Thanks for the codes, tried your codes out it works great however it takes 12 seconds on my work pc to load 3000+ records into the grid, but when i tested it on my home pc which is just recently purchased only take 4/10 of a second.

    Maybe my pc at work is just old and slow that all.

    Imported from legacy forums. Posted by khmer (had 3646 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.