다음을 통해 공유


ArchiveFileEventArgsExtensions Class

Definition

public ref class ArchiveFileEventArgsExtensions abstract sealed
public static class ArchiveFileEventArgsExtensions
type ArchiveFileEventArgsExtensions = class
Public Module ArchiveFileEventArgsExtensions
Inheritance
ArchiveFileEventArgsExtensions

Methods

ToArchiveFileHandler(Action<StringReadEventArgs>)

Helper method that allows to subscribe to ArchiveFileEncountered event via StringReadDone event handler.

This applies only when subscriber is OK with greedy reading entire content of the file and is interested only in the individual strings (e.g. for sensitive data redaction purposes), without distinction what each individual string means (e.g. they do not care about distinction between path and content or between individual files - they just need all textual data).

private void OnStringReadDone(StringReadEventArgs e)
{
    e.StringToBeUsed = e.StringToBeUsed.Replace("foo", "bar");
}

private void SubscribeToEvents()
{
    reader.StringReadDone += OnStringReadDone;
    reader.ArchiveFileEncountered += ((Action<StringReadEventArgs>)OnStringReadDone).ToArchiveFileHandler();
}

Applies to