Compartir a través de


ArchiveFileEventArgsExtensions.ToArchiveFileHandler Method

Definition

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();
}
public:
[System::Runtime::CompilerServices::Extension]
 static Action<Microsoft::Build::Logging::ArchiveFileEventArgs ^> ^ ToArchiveFileHandler(Action<Microsoft::Build::Logging::StringReadEventArgs ^> ^ stringHandler);
public static Action<Microsoft.Build.Logging.ArchiveFileEventArgs> ToArchiveFileHandler (this Action<Microsoft.Build.Logging.StringReadEventArgs> stringHandler);
static member ToArchiveFileHandler : Action<Microsoft.Build.Logging.StringReadEventArgs> -> Action<Microsoft.Build.Logging.ArchiveFileEventArgs>
<Extension()>
Public Function ToArchiveFileHandler (stringHandler As Action(Of StringReadEventArgs)) As Action(Of ArchiveFileEventArgs)

Parameters

stringHandler
Action<StringReadEventArgs>

Returns

Applies to