forked from TestableIO/System.IO.Abstractions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileSystemWatcherBase.cs
119 lines (92 loc) · 3.87 KB
/
FileSystemWatcherBase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using System.ComponentModel;
namespace System.IO.Abstractions
{
/// <inheritdoc cref="FileSystemWatcher"/>
[Serializable]
public abstract class FileSystemWatcherBase : IFileSystemWatcher
{
/// <inheritdoc cref="FileSystemWatcher.IncludeSubdirectories"/>
public abstract bool IncludeSubdirectories { get; set; }
/// <inheritdoc cref="FileSystemWatcher.EnableRaisingEvents"/>
public abstract bool EnableRaisingEvents { get; set; }
/// <inheritdoc cref="FileSystemWatcher.Filter"/>
public abstract string Filter { get; set; }
#if FEATURE_FILE_SYSTEM_WATCHER_FILTERS
/// <inheritdoc cref="FileSystemWatcher.Filters"/>
public abstract System.Collections.ObjectModel.Collection<string> Filters { get; }
#endif
/// <inheritdoc cref="FileSystemWatcher.InternalBufferSize"/>
public abstract int InternalBufferSize { get; set; }
/// <inheritdoc cref="FileSystemWatcher.NotifyFilter"/>
public abstract NotifyFilters NotifyFilter { get; set; }
/// <inheritdoc cref="FileSystemWatcher.Path"/>
public abstract string Path { get; set; }
/// <inheritdoc cref="FileSystemWatcher.Site"/>
public abstract ISite Site { get; set; }
/// <inheritdoc cref="FileSystemWatcher.SynchronizingObject"/>
public abstract ISynchronizeInvoke SynchronizingObject { get; set; }
/// <inheritdoc cref="FileSystemWatcher.Changed"/>
public virtual event FileSystemEventHandler Changed;
/// <inheritdoc cref="FileSystemWatcher.Created"/>
public virtual event FileSystemEventHandler Created;
/// <inheritdoc cref="FileSystemWatcher.Deleted"/>
public virtual event FileSystemEventHandler Deleted;
/// <inheritdoc cref="FileSystemWatcher.Error"/>
public virtual event ErrorEventHandler Error;
/// <inheritdoc cref="FileSystemWatcher.Renamed"/>
public virtual event RenamedEventHandler Renamed;
/// <inheritdoc cref="FileSystemWatcher.BeginInit"/>
public abstract void BeginInit();
/// <inheritdoc />
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <inheritdoc cref="FileSystemWatcher.EndInit"/>
public abstract void EndInit();
/// <inheritdoc cref="FileSystemWatcher.WaitForChanged(WatcherChangeTypes)"/>
public abstract WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType);
/// <inheritdoc cref="FileSystemWatcher.WaitForChanged(WatcherChangeTypes,int)"/>
public abstract WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, int timeout);
/// <inheritdoc />
public static implicit operator FileSystemWatcherBase(FileSystemWatcher watcher)
{
if (watcher == null)
{
return null;
}
return new FileSystemWatcherWrapper(watcher);
}
/// <inheritdoc />
public virtual void Dispose(bool disposing)
{
// do nothing
}
/// <inheritdoc />
protected void OnCreated(object sender, FileSystemEventArgs args)
{
Created?.Invoke(sender, args);
}
/// <inheritdoc />
protected void OnChanged(object sender, FileSystemEventArgs args)
{
Changed?.Invoke(sender, args);
}
/// <inheritdoc />
protected void OnDeleted(object sender, FileSystemEventArgs args)
{
Deleted?.Invoke(sender, args);
}
/// <inheritdoc />
protected void OnRenamed(object sender, RenamedEventArgs args)
{
Renamed?.Invoke(sender, args);
}
/// <inheritdoc />
protected void OnError(object sender, ErrorEventArgs args)
{
Error?.Invoke(sender, args);
}
}
}