melenaos / FileSystemSafeWatcher

Extends the FileSystemWatcher to trigger the events only when the file is ready for read
Apache License 2.0
34 stars 13 forks source link

Support of the new Filters parameters #6

Closed ericcanadas closed 5 months ago

ericcanadas commented 5 months ago

It's possible to add the support of the new Filters parameter which allows to specify multiple extensions...

melenaos commented 5 months ago

Can you send a usage example? How would you use it in the original type?

melenaos commented 5 months ago

You can use the existing Filter property

        /// <summary>
        /// Gets or sets the filter string, used to determine what files are monitored in a directory.
        /// </summary>
        /// <value>The filter string. The default is "*.*" (Watches all files.)</value>
        public string Filter
        {
            get
            {
                return _fileSystemWatcher.Filter;
            }
            set
            {
                _fileSystemWatcher.Filter = value;
            }
        }
ericcanadas commented 5 months ago

Hi, I want to monitor multiple file extensions I see this thread in my search but your good implementation don't have this fonctionnality : https://stackoverflow.com/questions/6965184/how-to-set-filter-for-filesystemwatcher-for-multiple-file-types#answer-61145821

melenaos commented 5 months ago

I see. Have you tried setting all the filters into the Filter property?

Try watcher.Filter = "*.txt;*.csv"

If that doesn't work I will implement the Filters

Στάλθηκε από Outlook για Androidhttps://aka.ms/AAb9ysg


From: Eric CANADAS @.> Sent: Wednesday, April 10, 2024 10:37:03 AM To: melenaos/FileSystemSafeWatcher @.> Cc: melenaos @.>; Comment @.> Subject: Re: [melenaos/FileSystemSafeWatcher] Support of the new Filters parameters (Issue #6)

Hi, I want to monitor multiple file extensions I see this thread in my search but your good implementation don't have this fonctionnality : https://stackoverflow.com/questions/6965184/how-to-set-filter-for-filesystemwatcher-for-multiple-file-types#answer-61145821

— Reply to this email directly, view it on GitHubhttps://github.com/melenaos/FileSystemSafeWatcher/issues/6#issuecomment-2046745223, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABXJ2CCSPV2PQ3C7ZGFU6BDY4TTZ7AVCNFSM6AAAAABF6X3DHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBWG42DKMRSGM. You are receiving this because you commented.Message ID: @.***>

ericcanadas commented 5 months ago

Yes, I tried this but it's not working !

melenaos commented 5 months ago

You can get the new version now. I hope that helps!

ericcanadas commented 5 months ago

Great ! It works like a charm ! ;-) Thanks for the responsiveness !!

melenaos commented 5 months ago

Thanks for testing it!