Dibaca dalam bahasa Inggeris

Kongsi melalui


ArchiveFileEventArgsExtensions Class

Definition

C#
public static class 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

Produk Versi
MSBuild 17
MSBuild (.NET Core) 17