filesystemwatcher

WPF DependencyObject calling thread exception

拥有回忆 提交于 2019-12-20 03:12:53
问题 I have the following code which creates a temporary folder and uses a FileSystemWatcher to poll for files added to the folder on the Location property, and add them to a list: Scratchdisk.cs on Pastebin. The idea is to create a Scratchdisk object, and have FFmpeg extract video frames into it, the FileSystemWatcher builds a list of these files as FFmpeg creates them, and the list is presented as a DependencyObject that my UI binds to. I'm binding to the Scratchdisk object like so:

Getting notified when a file lock is released

北慕城南 提交于 2019-12-20 02:56:15
问题 [Using C# and Windows as platform] I have a camera that writes JPG files to a local folder in my PC. I want to load each file the camera drops, so I have a FileSystemWatcher that notifies me whenever a new picture is created, but the camera locks the file while it's being written , so if I try to load it just after being notified of its creation, I get an exception saying that the file is locked . Currently, I have a while loop (with a Thread.Sleep) that retries to load the image every 0.2

FileSystemWatcher with Samba on Linux

∥☆過路亽.° 提交于 2019-12-19 19:55:06
问题 I'm using a FileSystemWatcher on my C# application (running on Windows) in order to update in my app the files that I'm currently browsing. It's work well when I browse a local directory. I am notified when a file is renamed, deleted or added. But for example when I rename a file on the network drive the first time, the FileSystemWatcher notifies me of a rename action and then, when I rename the same file or another file, the FileSystemWatcher notifies me of an error : the specified server

C# - Predict file system events on folder delete

房东的猫 提交于 2019-12-19 19:47:16
问题 This is more a question about what's the best practice in implementing this. I have a FileSystemWatcher which should inform me about User's changes on files and folders. Also subdirs are watched. In the same directory my program does also sometimes changes. I don't want the FileSystemWatcher to detect events on these program changes. My first implementation was a list where I can add expected events. When I get a file system event I check the list and ignore it if it's there. This doesn't

Disposing of FileSystemWatcher

孤人 提交于 2019-12-19 04:10:00
问题 So my understanding is that whenever using a class that implements IDisposable, it's parent also needs to implement IDisposable interface. (FileWatcher using FileSystemWatcher) So when using FileSystemWatcher what is the proper way of disposing of FileSystemWatcher? I want FileWatcher not to be disposed/(watching) until application is closed. Would I use Responsible Owner Pattern?(try/finally) or something else? Should my FileWatcher also implement IDisposable? I won't be able to use using{}

Is it really that expensive to increase FileSystemWatcher.InternalBufferSize?

眉间皱痕 提交于 2019-12-18 19:32:27
问题 I'm using a FileSystemWatcher to monitor changes in a folder, but as soon as I have more than a few hundred modifications in a short time, I miss some of them because the internal buffer overflows. So I want to increase the InternalBufferSize (I know it won't really solve the problem, but it will make it less likely to occur), but I see this warning in the documentation: However, increasing buffer size is expensive, because it comes from non-paged memory that cannot be swapped out to disk ,

FileSystemWatcher does not report changes in a locked file

£可爱£侵袭症+ 提交于 2019-12-18 14:48:25
问题 I'm monitoring a folder using a FileSystemWatcher like this: watcher = new FileSystemWatcher(folder); watcher.NotifyFilter = NotifyFilters.Size; watcher.Changed += changedCallback; When I open a new file in notepad in that folder and save it, I get a notification. If I keep writing and then I save, I get a notification. If I close the file with saving it, I get a notification. Exactly what I wanted. However, it turns out that if I create a file in that folder and I set its sharing mode to

Using a FileSystemWatcher with Windows Service

假装没事ソ 提交于 2019-12-18 13:27:54
问题 I have a windows service which needs to monitor a directory for files and then move it to another directory. I am using a FileSystemWatcher to implement this. This is my main Service class. public partial class SqlProcessService : ServiceBase { public SqlProcessService() { InitializeComponent(); } protected override void OnStart(string[] args) { FileProcesser fp = new FileProcesser(ConfigurationManager.AppSettings["FromPath"]); fp.Watch(); } protected override void OnStop() { } } This is my

Get Username of an Accesed File

半腔热情 提交于 2019-12-18 09:48:05
问题 I would like to get the username of an accessed file (add, delete, rename,...). actually I use filesystemwatcher to monitor the file access and I have activated object access on an directory to get userinformation via eventlogs. This solution is not perfect, because there are a lot of file events and the eventlog messages are not so detailed. there is just one eventd id for write data. this it is used for add file, rename , move,... every write data. Additionally I had to crosscheck that the

FileSystemWatcher issues

蓝咒 提交于 2019-12-18 09:17:26
问题 I am trying to use the FileSystemWatcher - and am having some luck.. The goal is to MOVE the file that gets created, from the monitored folder, to a new folder. But... have hit 2 snags. Firstly, if I move 3 files into a folder at once (Select 3 files, ctrl+x, and then ctrl+c into my Monitor Folder), the monitor only triggers for the first file. The other 2 don't get processed. FileSystemWatcher fsw = new FileSystemWatcher(FolderToMonitor); fsw.Created += new FileSystemEventHandler(fsw_Created