Code Examples
  Home arrow Code Examples arrow Page 2 - Implementing the CompressedFolder Class
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CODE EXAMPLES

Implementing the CompressedFolder Class
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-03-19

    Table of Contents:
  • Implementing the CompressedFolder Class
  • More internal methods
  • Examining the Support Methods
  • Wrapping up

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Implementing the CompressedFolder Class - More internal methods


    (Page 2 of 4 )

    Private Function AddFiles(strFolder, varSource, blnKeepOriginal)

       If IsArray(varSource) Then

           For Each strPath In varSource

              AddFile strFolder, strPath, blnKeepOriginal

           Next

       Else

           Set colItems = objShell.NameSpace(strSource).Items

           intCount = .Items.Count

           Select Case CBool(blnKeepOriginal)

              Case True

                  objShell.NameSpace(strFolder).CopyHere colItems, 1548

              Case False

                  objShell.NameSpace(strFolder).MoveHere colItems, 1548

           End Select

           Do Until objShell.NameSpace(strFolder).Items.Count = intCount + colItems.Count

              Sleep 200

              If Not ShellBusy Then Exit Do

           Loop

       End If

    End Function

    The AddFiles method is mirrored by the public AddMultiple method.  It is basically a rewrite of the AddFile method you just saw, with the exception that you can add multiple files at one time from either an array or an existing folder.  It functions identically to the AddFile method, except that it works recursively through the provided object.

    Private Function ExtractAll(strZipFile, strFolder)

       If Not objFso.FolderExists(strFolder) Then objFso.CreateFolder(strFolder)

       intCount = objShell.NameSpace(strFolder).Items.Count

       Set colItems = objShell.NameSpace(strZipFile).Items

       objShell.NameSpace(strFolder).CopyHere colItems, 1548

       Do Until objShell.NameSpace(strFolder).Items.Count = intCount + colItems.Count

           Sleep 200

           If Not ShellBusy Then Exit Do

       Loop

    End Function

    Finally, the ExtractAll method is mirrored by the public Extract method.  This method is used to copy, or extract, files from an existing compressed folder.  Again, I’m basically just covering the use of the Shell Object.

    More Code Examples Articles
    More By Nilpo


     

    CODE EXAMPLES ARTICLES

    - Bipartite Graphs
    - Connectivity in Graphs
    - The Ford-Fulkerson Algorithm
    - Critical Paths
    - The Bellman-Ford and Roy-Floyd Algorithms
    - Shortest Path Algorithms in Graphs
    - Minimum Spanning Tree
    - Articulation Edges and Vertexes
    - Circles and Connectivity in Graphs
    - Depth-First Search in Graphs
    - Breadth-First Search in Graphs
    - The Prufer Code and the Floyd-Warshall Algor...
    - An Insight into Graphs
    - Coding a Custom Object with WSC
    - Creating a Custom Object with WSC





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek