Reusable generic Directory Poller utility class for .NET (blog.troyd.net)

submitted by powerrushpowerrush(3873) 3 years, 11 months ago

Free reusable generic Directory Poller utility class for .NET

5 comments |category: |Views: 46

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by yesthatmcgurkyesthatmcgurk(4063) 3 years, 11 months ago 0

You've got to be joking. Are we back in the world of VB6??? Any time I hear the word "polling" shivers run up and down my spine.

FileSystemWatcher FTW!

Reply

posted by powerrushpowerrush(3873) 3 years, 11 months ago 0

Lack of RegEx support was why I skimmed over FileSystemWatcher to begin with.

I had a quick deadline on getting this functionality out for work and I didn't consider using FSW in the same manner. Indeed, it would be more efficient to re-write the code using FSW at the core.

Never coded in VB6, personally.

Reply

posted by yesthatmcgurkyesthatmcgurk(4063) 3 years, 11 months ago 0

public class RegexFileSystemWatcher : FileSystemWatcher
{
public override OnFileSystemChangedLolWhatever(FileSystemChangedEventArgs e) { if(!MyRegexLol.Match(e.Filename)) return; base(e); }
}

I loev regex. I hate polling.

The vb6 ref comes from just about every VB 6 program I've ever seen polling something. Polling the filesystem, polling databases, polling poles... Yech.

Reply

posted by yesthatmcgurkyesthatmcgurk(4063) 3 years, 11 months ago 0

I take the first part back. The fsw isn't designed to be extended. You'd have to wrap it instead. Pity.

Reply

posted by powerrushpowerrush(3873) 3 years, 11 months ago 0

I also forgot to mention that another reason I skimmed over FileSystemWatcher is because I wasn't just looking for the Creation of a file, I was looking for the EXISTENCE of a file.

This is more fail-safe for my needs. For instance, if the FSW wasn't running when the file was created, then the event wouldn't be triggered ever again. I was looking for something more fail safe.

Reply

information Login or create an account to comment on this story