Merge pull request #1304 from slluis/mac-proxy-autoconfig
[mono.git] / mcs / class / Microsoft.Build.Framework / Microsoft.Build.Framework / BuildEventArgs.cs
1 //
2 // BuildEventArgs.cs: Provides data for the Microsoft.Framework.IEventSource.
3 // AnyEventRaised event.
4 //
5 // Author:
6 //   Marek Sieradzki (marek.sieradzki@gmail.com)
7 // 
8 // (C) 2005 Marek Sieradzki
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
29 using System;
30 using System.Threading;
31
32 namespace Microsoft.Build.Framework
33 {
34         [Serializable]          
35         public abstract class BuildEventArgs : System.EventArgs {
36         
37                 string  helpKeyword;
38                 string  message;
39                 string  senderName;
40                 int     threadId;
41                 DateTime        timestamp;
42 #if NET_3_5
43                 BuildEventContext context;
44 #endif
45
46                 protected BuildEventArgs ()
47                         : this (null, null, null)
48                 {
49                 }
50
51                 protected BuildEventArgs (string message, string helpKeyword,
52                                           string senderName)
53                         : this (message, helpKeyword, senderName, DateTime.Now)
54                 {
55                 }
56
57 #if NET_4_0
58                 protected
59 #endif
60                 BuildEventArgs (string message, string helpKeyword,
61                                 string senderName, DateTime eventTimestamp)
62                 {
63                         this.message = message;
64                         this.helpKeyword = helpKeyword;
65                         this.senderName = senderName;
66                         this.threadId = Thread.CurrentThread.GetHashCode ();
67                         this.timestamp = eventTimestamp;
68 #if NET_3_5
69                         this.context = BuildEventContext.NewInstance ();
70 #endif
71                 }
72
73                 public string HelpKeyword {
74                         get {
75                                 return helpKeyword;
76                         }
77                 }
78
79 #if NET_4_0
80                 virtual
81 #endif
82                 public string Message {
83                         get {
84                                 return message;
85                         }
86 #if NET_4_0                     
87                         protected set {
88                                 message = value;
89                         }
90 #endif
91                 }
92
93                 public string SenderName {
94                         get {
95                                 return senderName;
96                         }
97                 }
98                 // Gets the integer hash code value of the thread that raised
99                 // the event
100                 public int ThreadId {
101                         get {
102                                 return threadId;
103                         }
104                 }
105                 // Time when event was fired
106                 public DateTime Timestamp {
107                         get {
108                                 return timestamp;
109                         }
110                 }
111
112 #if NET_3_5
113                 public BuildEventContext BuildEventContext {
114                         get { return context; }
115                         set {
116                                 if (value == null)
117                                         throw new ArgumentNullException ("value");
118                                 context = value;
119                         }
120                 }
121 #endif
122         }
123 }
124