C# Class Nexus.Client.Util.ThreadSafeSevenZipExtractor

A wrapper for the SevenZipExtractor class that makes using it thread safe.
Inheritance: IDisposable
Show file Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Ensures all used resources are released.

This terminates the thread upon which the SevenZipExtractor was created.

ExtractFile ( Int32 p_intIndex, Stream p_stmFile ) : void

Extracts the specified file to the given stream.

This wrapper property ensures the operation executes on the same thread in which the SevenZipExtractor was created.

ThreadSafeSevenZipExtractor ( Stream p_stmArchive ) : System

Creates a thread safe extractor for the given stream.

ThreadSafeSevenZipExtractor ( string p_strPath ) : System

Creates a thread safe extractor for the file at the given path.

Protected Methods

Method Description
ExecuteAction ( System.Action p_actAction ) : void

Executes the given action.

This method: 1) Enqueues the action in the work queue. 2) Notifies the extraction thread that there is work to do. 3) Waits to be notified that the action has completed. 4) Throws any exception that was raised while executing the action.

Init ( ) : void

Initializes the thread safe extractor.

RunThread ( ) : void

The run method of the thread on which the SevenZipExtractor is created.

This method creates a SevenZipExtractor and then watches for events to execute. Other methods signal the thread that an action needs to be taken, and this thread executes said actions.

Method Details

Dispose() public method

Ensures all used resources are released.
This terminates the thread upon which the SevenZipExtractor was created.
public Dispose ( ) : void
return void

ExecuteAction() protected method

Executes the given action.
This method: 1) Enqueues the action in the work queue. 2) Notifies the extraction thread that there is work to do. 3) Waits to be notified that the action has completed. 4) Throws any exception that was raised while executing the action.
protected ExecuteAction ( System.Action p_actAction ) : void
p_actAction System.Action The action to get the extractor to execute.
return void

ExtractFile() public method

Extracts the specified file to the given stream.
This wrapper property ensures the operation executes on the same thread in which the SevenZipExtractor was created.
public ExtractFile ( Int32 p_intIndex, Stream p_stmFile ) : void
p_intIndex System.Int32 The index of the file to extract from the archive.
p_stmFile Stream The stream to which to extract the file.
return void

Init() protected method

Initializes the thread safe extractor.
protected Init ( ) : void
return void

RunThread() protected method

The run method of the thread on which the SevenZipExtractor is created.
This method creates a SevenZipExtractor and then watches for events to execute. Other methods signal the thread that an action needs to be taken, and this thread executes said actions.
protected RunThread ( ) : void
return void

ThreadSafeSevenZipExtractor() public method

Creates a thread safe extractor for the given stream.
public ThreadSafeSevenZipExtractor ( Stream p_stmArchive ) : System
p_stmArchive Stream The stream for which to create an extractor.
return System

ThreadSafeSevenZipExtractor() public method

Creates a thread safe extractor for the file at the given path.
public ThreadSafeSevenZipExtractor ( string p_strPath ) : System
p_strPath string The path to the file for which to create an extractor.
return System