-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCustomEvents.cs
158 lines (131 loc) · 4.39 KB
/
CustomEvents.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
RMLib: Nonvisual support classes used by multiple R&M Software programs
Copyright (C) Rick Parrish, R&M Software
This file is part of RMLib.
RMLib is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
RMLib is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with RMLib. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Diagnostics;
namespace RandM.RMLib
{
public class CommandLineParameterEventArgs : EventArgs
{
public char Key { get; set; }
public string Value { get; set; }
public CommandLineParameterEventArgs(char key, string value)
{
Key = key;
Value = value;
}
}
public class ConnectionAcceptedEventArgs : EventArgs
{
public string LocalIP { get; set; }
public int LocalPort { get; set; }
public string RemoteIP { get; set; }
public int RemotePort { get; set; }
public ConnectionAcceptedEventArgs(string localIP, int localPort, string remoteIP, int remotePort)
{
this.LocalIP = localIP;
this.LocalPort = localPort;
this.RemoteIP = remoteIP;
this.RemotePort = remotePort;
}
public static void Raise(object sender, EventHandler<ConnectionAcceptedEventArgs> Handler, string localIP, int localPort, string remoteIP, int remotePort)
{
EventHandler<ConnectionAcceptedEventArgs> LocalHandler = Handler;
if (LocalHandler != null) LocalHandler(sender, new ConnectionAcceptedEventArgs(localIP, localPort, remoteIP, remotePort));
}
}
public class ExceptionEventArgs : EventArgs
{
public Exception Exception { get; set; }
public string Message { get; set; }
public ExceptionEventArgs(string message, Exception exception)
{
Message = message;
Exception = exception;
}
}
public class FtpUploadProgressEventArgs : EventArgs
{
public long BytesSent { get; set; }
public long TotalBytesToSend { get; set; }
public FtpUploadProgressEventArgs(long totalBytesToSend)
{
BytesSent = 0;
TotalBytesToSend = totalBytesToSend;
}
}
public class IntEventArgs : EventArgs
{
public int Value { get; set; }
public IntEventArgs(int value)
{
Value = value;
}
}
public class RMLogEventArgs : EventArgs
{
public LogLevel Level { get; set; }
public string Message { get; set; }
public string ExceptionDetails { get; set; }
public RMLogEventArgs(LogLevel level, string message)
{
this.Level = level;
this.Message = message;
}
public RMLogEventArgs(LogLevel level, string message, string exceptionDetails)
{
this.Level = level;
this.Message = message;
this.ExceptionDetails = exceptionDetails;
}
public void Raise(object sender, EventHandler<RMLogEventArgs> Handler)
{
EventHandler<RMLogEventArgs> LocalHandler = Handler;
if (LocalHandler != null) LocalHandler(sender, this);
}
}
public class RMProcessStartAndWaitEventArgs : EventArgs
{
public bool Stop { get; set; }
public RMProcessStartAndWaitEventArgs()
{
Stop = false;
}
}
public class CharEventArgs : EventArgs
{
public char Character { get; set; }
public CharEventArgs(char character)
{
Character = character;
}
}
public class StringEventArgs : EventArgs
{
public string Text { get; set; }
public StringEventArgs(string text)
{
Text = text;
}
}
public class ProcessStartEventArgs : EventArgs
{
public int ProcessId { get; set; }
public ProcessStartEventArgs(int processId)
{
ProcessId = processId;
}
}
}