Xceed .NET Libraries Documentation
Xceed.GZip Assembly / Xceed.GZip Namespace / GZippedFile Class / GZippedFile Constructor / GZippedFile Constructor(FileSystemEvents,Object,AbstractFile)
A Xceed.FileSystem.FileSystemEvents object that will be used to raise events. Cannot be a null reference (Nothing in Visual Basic).
Opaque data that will be passed back to the event handler when an event is raised.
Xceed.FileSystem.AbstractFile object that represents the gzip file to access.
Example


In This Topic
    GZippedFile Constructor(FileSystemEvents,Object,AbstractFile)
    In This Topic
    Initializes a new instance of the GZippedFile class for accessing the first file in the GZip archive and enabling event notifications while the object is being created.
    Syntax
    'Declaration
     
    Public Function New( _
       ByVal events As FileSystemEvents, _
       ByVal userData As Object, _
       ByVal gzipFile As AbstractFile _
    )
    'Usage
     
    Dim events As FileSystemEvents
    Dim userData As Object
    Dim gzipFile As AbstractFile
     
    Dim instance As New GZippedFile(events, userData, gzipFile)
    public GZippedFile( 
       FileSystemEvents events,
       object userData,
       AbstractFile gzipFile
    )

    Parameters

    events
    A Xceed.FileSystem.FileSystemEvents object that will be used to raise events. Cannot be a null reference (Nothing in Visual Basic).
    userData
    Opaque data that will be passed back to the event handler when an event is raised.
    gzipFile
    Xceed.FileSystem.AbstractFile object that represents the gzip file to access.
    Example
    When the host file (gzipFile) is empty, calling this ctor returns a new reference on a file whose filename is deduced from the host file's filename, but does not create the item. Thus, calling this ctor twice in a row will return different filenames. Once an item is created, calling this ctor always returns that item. This outputs: file1: hello False file2: hello.2 False file1: hello False file2: hello.2 True file3: hello.2 True
    AbstractFile hostFile = new DiskFile( @"d:\hello.gz" );
    
    AbstractFile file1 = new GZippedFile( hostFile );
    //Calling the constructor a second time when passing a host file that is empty will return a DIFFERENT filename.
    AbstractFile file2 = new GZippedFile( hostFile );
    
    Console.WriteLine( "file1: {0}   {1}", file1.Name, file1.Exists );
    Console.WriteLine( "file2: {0}   {1}", file2.Name, file2.Exists );
    
    //The item is created by calling the Create method.
    file2.Create();
    
    //Once the Create method has been called to create an item, calling the ctor always returns that item.
    AbstractFile file3 = new GZippedFile( hostFile );
    
    Console.WriteLine( "file1: {0}   {1}", file1.Name, file1.Exists );
    Console.WriteLine( "file2: {0}   {1}", file2.Name, file2.Exists );
    Console.WriteLine( "file3: {0}   {1}", file3.Name, file3.Exists );
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also