1 /*
2  *
3  * SmartIrc4net - the IRC library for .NET/C# <http://smartirc4net.sf.net>
4  *
5  * Copyright (c) 2008-2009 Thomas Bruderer <apophis@apophis.ch> <http://www.apophis.ch>
6  *
7  * Full LGPL License: <http://www.gnu.org/licenses/lgpl.txt>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 
24 using System;
25 using System.Collections.Generic;
26 
27 namespace Meebey.SmartIrc4net
28 {
29 
30     /// <summary>
31     /// Base DCC Event Arguments
32     /// </summary>
33     public class DccEventArgs : EventArgs
34     {
35 
36         private DccConnection _dcc;
37 
38         public DccConnection dcc {
39             get {
40                 return _dcc;
41             }
42         }
43 
44         /// <summary>
45         ///
46         /// </summary>
47         /// <param name="dccClient"></param>
48         /// <param name="stream">If there are multiple streams on a DCC (a channel DCC) this identifies the stream</param>
DccEventArgs(DccConnection dcc)49         internal DccEventArgs(DccConnection dcc)
50         {
51             this._dcc = dcc;
52         }
53     }
54 
55     /// <summary>
56     /// Dcc Event Args Involving Lines of Text
57     /// </summary>
58     public class DccChatEventArgs : DccEventArgs
59     {
60         private string _Message;
61 
62         public string Message {
63             get {
64                 return _Message;
65             }
66         }
67 
68         private string[] _MessageArray;
69 
70         public string[] MessageArray {
71             get {
72                 return _MessageArray;
73             }
74         }
75 
DccChatEventArgs(DccConnection dcc, string messageLine)76         internal DccChatEventArgs(DccConnection dcc, string messageLine) : base(dcc)
77         {
78             char[] whiteSpace = {' '};
79             this._Message = messageLine;
80             this._MessageArray = messageLine.Split(new char[] {' '});
81         }
82     }
83 
84     /// <summary>
85     /// Dcc Event Args involving Packets of Bytes
86     /// </summary>
87     public class DccSendEventArgs : DccEventArgs
88     {
89         private byte[] _Package;
90 
91         public byte[] Package {
92             get {
93                 return _Package;
94             }
95         }
96 
97         private int _PackageSize;
98 
99         public int PackageSize {
100             get {
101                 return _PackageSize;
102             }
103         }
104 
DccSendEventArgs(DccConnection dcc, byte[] package, int packageSize)105         internal DccSendEventArgs(DccConnection dcc,  byte[] package, int packageSize) : base(dcc)
106         {
107             this._Package = package;
108             this._PackageSize = packageSize;
109         }
110     }
111 
112     /// <summary>
113     /// Special DCC Event Arg for Receiving File Requests
114     /// </summary>
115     public class DccSendRequestEventArgs : DccEventArgs
116     {
117         private string _Filename;
118         public string Filename {
119             get {
120                 return _Filename;
121             }
122         }
123 
124         private long _Filesize;
125         public long Filesize {
126             get {
127                 return _Filesize;
128             }
129         }
130 
DccSendRequestEventArgs(DccConnection dcc, string filename, long filesize)131         internal DccSendRequestEventArgs(DccConnection dcc, string filename, long filesize) : base(dcc)
132         {
133             this._Filename = filename;
134             this._Filesize = filesize;
135         }
136     }
137 }
138