Skip to content

Commit

Permalink
Use NatUtility.Log instead of Console.WriteLine
Browse files Browse the repository at this point in the history
svn path=/trunk/Mono.Nat/; revision=133219
  • Loading branch information
alanmcgovern committed Apr 30, 2009
1 parent 0f6f194 commit ce6aaa4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Mono.Nat/NatUtility.cs
Expand Up @@ -108,7 +108,7 @@ private static void SearchAndListen()
foreach (ISearcher s in controllers)
if (s.NextSearch < DateTime.Now && searching)
{
Console.WriteLine("Searching for: {0}", s.GetType().Name);
Log("Searching for: {0}", s.GetType().Name);
s.Search(client);
}
System.Threading.Thread.Sleep(10);
Expand Down
2 changes: 1 addition & 1 deletion src/Mono.Nat/PmpSearcher.cs
Expand Up @@ -58,7 +58,7 @@ public void Handle(byte[] response, IPEndPoint endpoint)
return;
int errorcode = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(response, 2));
if (errorcode != 0)
Console.WriteLine("Non zero error: {0}", errorcode);
NatUtility.Log("Non zero error: {0}", errorcode);

IPAddress publicIp = new IPAddress(new byte[] { response[8], response[9], response[10], response[11] });
nextSearch = DateTime.Now.AddMinutes(5);
Expand Down
6 changes: 3 additions & 3 deletions src/Mono.Nat/Upnp/Messages/UpnpMessage.cs
Expand Up @@ -47,7 +47,7 @@ protected MessageBase(UpnpNatDevice device)
protected WebRequest CreateRequest(string upnpMethod, string methodParameters, string webrequestMethod)
{
string ss = "http://" + this.device.HostEndPoint.ToString() + this.device.ControlUrl;
Console.WriteLine("Initiating request to: {0}", ss);
NatUtility.Log("Initiating request to: {0}", ss);
Uri location = new Uri(ss);

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(location);
Expand Down Expand Up @@ -106,8 +106,8 @@ public static MessageBase Decode(UpnpNatDevice device, string message)
if ((node = doc.SelectSingleNode("//responseNs:GetSpecificPortMappingEntryResponse", nsm)) != null)
return new GetGenericPortMappingEntryResponseMessage(node, false);

Console.WriteLine("Unknown message returned. Please send me back the following XML:");
Console.WriteLine(message);
NatUtility.Log("Unknown message returned. Please send me back the following XML:");
NatUtility.Log(message);
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Mono.Nat/Upnp/UpnpNatDevice.cs
Expand Up @@ -61,7 +61,7 @@ internal UpnpNatDevice (string deviceDetails)
// Are we going to get addresses with the "http://" attached?
if (locationDetails.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase))
{
Console.WriteLine("Found device at: {0}", locationDetails);
NatUtility.Log("Found device at: {0}", locationDetails);
// This bit strings out the "http://" from the string
locationDetails = locationDetails.Substring(7);

Expand All @@ -80,7 +80,7 @@ internal UpnpNatDevice (string deviceDetails)
this.hostEndPoint = new IPEndPoint(IPAddress.Parse(hostAddressAndPort), 80);
}

Console.WriteLine("Parsed device as: {0}", this.hostEndPoint.ToString());
NatUtility.Log("Parsed device as: {0}", this.hostEndPoint.ToString());

// The service description URL is the remainder of the "locationDetails" string. The bit that was originally after the ip
// and port information
Expand Down

0 comments on commit ce6aaa4

Please sign in to comment.