Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当新文件添加到Google Drive时,FileSystemWatcher不会收到通知_C#_.net_Filesystemwatcher - Fatal编程技术网

C# 当新文件添加到Google Drive时,FileSystemWatcher不会收到通知

C# 当新文件添加到Google Drive时,FileSystemWatcher不会收到通知,c#,.net,filesystemwatcher,C#,.net,Filesystemwatcher,我正在使用以下代码检查特定文件夹中的新文件/更改,但当我正在检查的文件夹位于Google Drive a中且文件显示在我的文件夹中时,它不会引发事件。在其侦听的文件夹中自己创建文件会引发事件 FileSystemWatcher watcher = new FileSystemWatcher() { Path = Google Drive path, NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite

我正在使用以下代码检查特定文件夹中的新文件/更改,但当我正在检查的文件夹位于Google Drive a中且文件显示在我的文件夹中时,它不会引发事件。在其侦听的文件夹中自己创建文件会引发事件

FileSystemWatcher watcher = new FileSystemWatcher() {
    Path = Google Drive path,
    NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName,
    Filter = "*.txt",
    EnableRaisingEvents = true
};

watcher.Changed += new FileSystemEventHandler(ActionChecker.FileFound);
这是我的watcher的问题,还是Google Drive的制作方式有问题?

正如我所指出的,我应该也在收听
watcher.Created


这段代码最初是为Dropbox编写的,Dropbox会创建文件,然后再添加文件内容,但Google Drive的功能有所不同

您正在收听的是更改后的事件。如果你想知道新文件已经创建,你当然应该使用created Event!这最初是为Dropbox设计的,Dropbox创建文件,然后附加文件内容。谷歌硬盘似乎在创建后不会对其进行修改。