Initial commit
[mono.git] / mcs / class / referencesource / System / services / io / system / io / FileSystemEventArgs.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="FileSystemEventArgs.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>                                                                
5 //------------------------------------------------------------------------------
6
7 namespace System.IO {
8
9     using System.Diagnostics;
10     using System.Security.Permissions;
11
12     using System;
13
14     /// <devdoc>
15     /// <para>Provides data for the directory events: <see cref='System.IO.FileSystemWatcher.Changed'/>, <see cref='System.IO.FileSystemWatcher.Created'/>, <see cref='System.IO.FileSystemWatcher.Deleted'/>.</para>
16     /// </devdoc>
17     public class FileSystemEventArgs : EventArgs {
18         private WatcherChangeTypes changeType;
19         private string name;
20         private string fullPath;
21
22         /// <devdoc>
23         /// <para>Initializes a new instance of the <see cref='System.IO.FileSystemEventArgs'/> class.</para>
24         /// </devdoc>
25         public FileSystemEventArgs(WatcherChangeTypes changeType, string directory, string name)
26         {
27             this.changeType = changeType;
28             this.name = name;
29
30             // Ensure that the directory name ends with a "\"
31             if (!directory.EndsWith("\\", StringComparison.Ordinal)) {
32                 directory = directory + "\\";
33             }
34
35             this.fullPath = directory + name;
36         }
37
38         /// <devdoc>
39         ///    <para>
40         ///       Gets
41         ///       one of the <see cref='System.IO.WatcherChangeTypes'/>
42         ///       values.
43         ///    </para>
44         /// </devdoc>
45         public WatcherChangeTypes ChangeType {
46             get {
47                 return changeType;
48             }
49         }
50
51         /// <devdoc>
52         ///    <para>
53         ///       Gets
54         ///       the
55         ///       fully qualifed path of the affected file or directory.
56         ///    </para>
57         /// </devdoc>
58         public string FullPath {
59             get {
60                 return fullPath;
61             }
62         }
63
64
65         /// <devdoc>
66         ///    <para>
67         ///       Gets
68         ///       the name of the affected file or directory.
69         ///    </para>
70         /// </devdoc>
71         public string Name {
72             get {
73                 return name;
74             }
75         }
76     }
77
78 }