0 votes
by (230 points)

Hi,

I have some code like:

private void VNotifier_DeleteCompleted(object sender, SingleNodeOperationEventArgs e)
{
    if ((!e.ResultNode.Exists()) && (!e.ResultNode.Name.StartsWith(".")) && ((Rebex.Net.Servers.ServerSession.Current.UserName == "XYZ")))
    {
        var vL4P = new Rebex.IO.FileSystem.FileNode(".ZZZ." + e.ResultNode.Name, e.ResultNode.Parent) { Context = e.ResultNode };

        if (vL4P.Exists())
        {
            vL4P.Delete();
        }

        vL4P = null;
    }
}

As you can see this is an event which is raised on deletion of a certain file... and inside that event handler a second file gets deleted. In this specific case the event handler is not called for the line vL4P.Delete() which is GOOD :-)

My question is:
Is it safe to assume that direct operations on Nodes inside filesystem event handlers do not raise themselves an event (which would avoid having to implement some reentry-sentinel logic all over the place)?

Thanks.

Best Regards
Yahia

Applies to: File Server, Rebex SFTP

1 Answer

0 votes
by (73.5k points)

Yes, the Preview and Completed events are raised only for top level ("root") operations = operations initiated from FileSystemProvider directly (not from other notifier events).

On the other hand, Surrogate events are raised always = even for "nested" operations initiated from other notifier events.

It is documented at https://www.rebex.net/doc/api/Rebex.IO.FileSystem.Notifications.FileSystemNotifier.html


I have just realized that there is a mistake in Remarks section. We will fix it ASAP.

Instead:

Preview and surrogate events are raised...

Should be:

Preview and Completed events are raised...

...