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
|
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
namespace mooftpserv
{
/// <summary>
/// Default log handler.
///
public class DebugLogHandler : ILogHandler
{
private IPEndPoint peer;
public DebugLogHandler()
{
}
private DebugLogHandler(IPEndPoint peer)
{
this.peer = peer;
}
public ILogHandler Clone(IPEndPoint peer)
{
return new DebugLogHandler(peer);
}
private void Write(string format, params object[] args)
{
Debug.WriteLine(String.Format("{0}: {1}", peer, String.Format(format, args)));
}
public void NewControlConnection()
{
Write("new control connection");
}
public void ClosedControlConnection()
{
Write("closed control connection");
}
public void ReceivedCommand(string verb, string arguments)
{
#if VERY_DEBUG
string argtext = (arguments == null || arguments == "" ? "" : ' ' + arguments);
Write("received command: {0}{1}", verb, argtext);
#endif
}
public void SentResponse(uint code, string description)
{
#if VERY_DEBUG
Write("sent response: {0} {1}", code, description);
#endif
}
public void NewDataConnection(IPEndPoint remote, IPEndPoint local, bool passive)
{
#if VERY_DEBUG
Write("new data connection: {0} <-> {1} ({2})", remote, local, (passive ? "passive" : "active"));
#endif
}
public void ClosedDataConnection(IPEndPoint remote, IPEndPoint local, bool passive)
{
#if VERY_DEBUG
Write("closed data connection: {0} <-> {1} ({2})", remote, local, (passive ? "passive" : "active"));
#endif
}
}
}
|