@@ -9,36 +9,36 @@ namespace BatchImageProcessor.Model
99{
1010 public abstract class IoObject : INotifyPropertyChanged , IDisposable , IIoObject
1111 {
12- private readonly FileSystemWatcher _watcher ;
13- private string _path ;
12+ private readonly FileSystemWatcher _watcher ;
13+ private string _path ;
1414 private string _name ;
1515
1616 protected IoObject ( string path )
17- {
18- var file = System . IO . File . Exists ( path ) ;
19- if ( ! ( file || Directory . Exists ( path ) ) )
20- throw new FileNotFoundException ( $@ "File/folder at ""{ path } "" does not exist.") ;
17+ {
18+ var file = System . IO . File . Exists ( path ) ;
19+ if ( ! ( file || Directory . Exists ( path ) ) )
20+ throw new FileNotFoundException ( $@ "File/folder at ""{ path } "" does not exist.") ;
2121
22- IsFile = file ;
23- Path = path ;
22+ IsFile = file ;
23+ Path = path ;
2424
25- Name = GetName ( path ) ;
25+ Name = GetName ( path ) ;
2626
2727
28- var directoryInfo = new FileInfo ( Path ) . Directory ;
29- if ( directoryInfo != null )
30- _watcher = new FileSystemWatcher ( IsFile ? directoryInfo . FullName : Path ) ;
31- if ( IsFile )
32- _watcher . Filter = System . IO . Path . GetFileName ( path ) ;
28+ var directoryInfo = new FileInfo ( Path ) . Directory ;
29+ if ( directoryInfo != null )
30+ _watcher = new FileSystemWatcher ( IsFile ? directoryInfo . FullName : Path ) ;
31+ if ( IsFile )
32+ _watcher . Filter = System . IO . Path . GetFileName ( path ) ;
3333
34- _watcher . Renamed += watcher_Renamed ;
35- _watcher . Deleted += Watcher_Deleted ;
36- _watcher . EnableRaisingEvents = true ;
37- }
34+ _watcher . Renamed += watcher_Renamed ;
35+ _watcher . Deleted += Watcher_Deleted ;
36+ _watcher . EnableRaisingEvents = true ;
37+ }
3838
39- protected IoObject ( )
40- {
41- }
39+ protected IoObject ( )
40+ {
41+ }
4242
4343 public string Name
4444 {
@@ -47,33 +47,34 @@ public string Name
4747 }
4848
4949 public string Path
50- {
51- get { return _path ; }
52- set
53- {
54- _path = value ;
50+ {
51+ get { return _path ; }
52+ set
53+ {
54+ _path = value ;
55+ // ReSharper disable once ExplicitCallerInfoArgument
5556 PropChanged ( nameof ( Name ) ) ;
5657 PropChanged ( ) ;
57- }
58- }
58+ }
59+ }
5960
60- public bool IsFile { get ; set ; }
61+ public bool IsFile { get ; set ; }
6162
62- public void Dispose ( )
63- {
64- _watcher . Dispose ( ) ;
65- }
63+ public void Dispose ( )
64+ {
65+ _watcher . Dispose ( ) ;
66+ }
6667
67- private static void Watcher_Deleted ( object sender , FileSystemEventArgs e )
68- {
69- }
68+ private static void Watcher_Deleted ( object sender , FileSystemEventArgs e )
69+ {
70+ }
7071
71- private void watcher_Renamed ( object sender , RenamedEventArgs e )
72- {
73- if ( ! IsFile ) return ;
74- Path = e . FullPath ;
75- _watcher . Filter = e . Name ;
76- }
72+ private void watcher_Renamed ( object sender , RenamedEventArgs e )
73+ {
74+ if ( ! IsFile ) return ;
75+ Path = e . FullPath ;
76+ _watcher . Filter = e . Name ;
77+ }
7778 public static string GetName ( string path )
7879 {
7980 if ( Directory . Exists ( path ) &&
0 commit comments