Jelajahi Sumber

Mostly changes to get System.dll compiling again. Removes a bunch
of excludes, and now we actually build things.

2002-01-17 Miguel de Icaza <[email protected]>

* Win32Exception.cs: Add.

2002-01-17 Miguel de Icaza <[email protected]>

* TraceListenerCollection.cs: Remove Warnings.

2002-01-17 Miguel de Icaza <[email protected]>

* Dns.cs: Updated to API changes.

* IPAddress.cs: Updated API. Much left to implement.

* Dns.cs: Remove IPToString method

2002-01-17 Miguel de Icaza <[email protected]>

* SocketException.cs: Reimplemented.

svn path=/trunk/mcs/; revision=2023

Miguel de Icaza 24 tahun lalu
induk
melakukan
db1bb4f4eb

+ 4 - 0
mcs/class/System/System.ComponentModel/ChangeLog

@@ -1,3 +1,7 @@
+2002-01-17  Miguel de Icaza  <[email protected]>
+
+	* Win32Exception.cs: Add.
+
 2002-01-05  Ravi Pratap  <[email protected]>
 
 	* CategoryAttribute.cs, Component.cs, ComponentCollection.cs: MonoTODO.

+ 50 - 0
mcs/class/System/System.ComponentModel/Win32Exception.cs

@@ -0,0 +1,50 @@
+//
+// System.ComponentModel.cs
+//
+// Author:
+//   Miguel de Icaza  ([email protected])
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+//
+
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.ComponentModel {
+
+	public class Win32Exception : ExternalException {
+		int native_error_code;
+		
+		// Constructors
+		public Win32Exception ()
+			: base (Locale.GetText ("Win32 exception"))
+		{
+		}
+
+		public Win32Exception (string message)
+			: base (message)
+		{
+		}
+
+		protected Win32Exception(SerializationInfo info, StreamingContext context)
+			: base (info, context) {
+		}
+		
+		public Win32Exception (string message, Exception inner)
+			: base (message, inner)
+		{
+		}
+
+		public Win32Exception (string message, int errorCode)
+		{
+			native_error_code = errorCode;
+		}
+
+		public int NativeErrorCode {
+			get {
+				return native_error_code;
+			}
+		}
+	}
+}

+ 4 - 0
mcs/class/System/System.Diagnostics/ChangeLog

@@ -1,3 +1,7 @@
+2002-01-17  Miguel de Icaza  <[email protected]>
+
+	* TraceListenerCollection.cs: Remove Warnings.
+
 2002-01-06  Ravi Pratap  <[email protected]>
 
 	* Switch.cs, TraceListenerCollection.cs : Decorate incomplete bits

+ 3 - 2
mcs/class/System/System.Diagnostics/TraceListenerCollection.cs

@@ -149,11 +149,12 @@ namespace System.Diagnostics
 		/// <param name="index">
 		/// Starting index of copy
 		/// </param>
+		[MonoTODO]
 		public void CopyTo(Array listeners, int index)
 		{
 			try {
 				this.listeners.CopyTo(listeners, index);
-			} catch(Exception e) {
+			} catch {
 				
 			}
 		}
@@ -218,7 +219,7 @@ namespace System.Diagnostics
 					if(listener.Name.Equals(name))
 						listeners.Remove(listener);
 				}
-			} catch(Exception e) {
+			} catch {
 				throw new ArgumentException("Listener is not in list.");
 			}
 		}

+ 22 - 0
mcs/class/System/System.Globalization/Locale.cs

@@ -0,0 +1,22 @@
+//
+// System.Globalization.Locale.cs
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Globalization {
+
+	internal class Locale {
+
+		/// <summary>
+		///   Returns the translated message for the current locale
+		/// </summary>
+		public static string GetText (string msg)
+		{
+			return msg;
+		}
+	}
+}

+ 4 - 0
mcs/class/System/System.Net.Sockets/ChangeLog

@@ -1,3 +1,7 @@
+2002-01-17  Miguel de Icaza  <[email protected]>
+
+	* SocketException.cs: Reimplemented.
+
 2002-01-06  Ravi Pratap  <[email protected]>
 
 	* ChangeLog : Add to this directory.

+ 17 - 74
mcs/class/System/System.Net.Sockets/SocketException.cs

@@ -2,94 +2,37 @@
 // System.Net.Sockets.NetworkStream.cs
 //
 // Author:
-//   Andrew Sutton
+//   Miguel de Icaza ([email protected])
 //
-// (C) Andrew Sutton
+// (C) 2002 Ximian, Inc.
 //
 using System;
-using System.Reflection;
 using System.Runtime.Serialization;
+using System.Globalization;
+using System.ComponentModel;
 
 namespace System.Net.Sockets
 {
-	// <remarks>
-	//    A socket exception. Does this REALLY need to
-	//    be derived from Win32Exception? It seems a
-	//    little lame.
-	//
-	//    This needs some work...
-	// </remarks>
-	public class SocketException : Exception
-	{
-		protected int		error_code;
-		protected int		native_code;
-		protected string	help_link;
-		protected string	message;
-
+	public class SocketException : Win32Exception {
+		// Constructors
 		public SocketException ()
+			: base (Locale.GetText ("Socket exception"))
 		{
-			error_code = 0;
-		}
-
-		public SocketException (int error)
-		{
-			error_code = error;
-		}
-
-		public SocketException (SerializationInfo info, StreamingContext cxt)
-		{
-		}
-
-		public override int ErrorCode
-		{
-			get { return error_code; }
-		}
-
-		public override string HelpLink
-		{
-			get { return help_link; }
-			set { help_link = value; }
-		}
-
-		public override Exception InnerException
-		{
-			get { return inner_exception }
 		}
 
-		public override string Message
+		public SocketException (int code)
+			: base (Locale.GetText ("Socket exception"), code)
 		{
-			get { return message; }
 		}
-
-		public override int NativeErrorCode
-		{
-			get { return native_code; }
-		}
-
-		public override string Source
-		{
-			get { return source; }
-		}
-
-		public override string StackTrace
-		{
-			get { return stack_trace; }
+		
+		protected SocketException(SerializationInfo info, StreamingContext context)
+			: base (info, context) {
 		}
-
-		public override int GetHashCode()
-		{
-			return native_code;
-		}
-
-		[MonoTODO]
-		public override void GetObjectData( SerializationInfo info, StreamingContext cxt )
-		{
-			// TODO: fill this in
-		}
-
-		public override string ToString()
-		{
-			return error_code + " " + help_link;
+		
+		public override int ErrorCode {
+			get {
+				return NativeErrorCode;
+			}
 		}
 	}
 }

+ 8 - 0
mcs/class/System/System.Net/ChangeLog

@@ -1,3 +1,11 @@
+2002-01-17  Miguel de Icaza  <[email protected]>
+
+	* Dns.cs: Updated to API changes.
+
+	* IPAddress.cs: Updated API.  Much left to implement.
+
+	* Dns.cs: Remove IPToString method
+
 2002-01-06  Ravi Pratap  <[email protected]>
 
 	* Dns.cs, AuthenticationManager.cs, SocketAddress.cs : MonoTODO

+ 2 - 20
mcs/class/System/System.Net/Dns.cs

@@ -166,7 +166,7 @@ namespace System.Net {
 		public static IPHostEntry GetHostByAddress(IPAddress address) {
 			if (address == null)
 				throw new ArgumentNullException();
-			return GetHostByAddress(IPAddress.HostToNetworkOrder(address.Address));
+			return GetHostByAddress (IPAddress.HostToNetworkOrder (address.Address));
 		}
 		
 		public static IPHostEntry GetHostByAddress(string address) {
@@ -199,24 +199,6 @@ namespace System.Net {
 			return h.HostName;
 		}
 		
-		/// <param name=address>
-		/// IP address in Little-Endian byte order.
-		/// </param>
-		/// <returns>
-		/// IP address in dotted notation form.
-		/// </returns>
-		public static string IpToString(int address) {
-			address = IPAddress.HostToNetworkOrder(address);
-			StringBuilder res = new StringBuilder();
-			for(int i = 3; i > 0; --i) {
-				byte b = (byte)(address >> i * 8);
-				res.Append(b);
-				res.Append('.');
-			}
-			res.Append((byte)address);
-			return res.ToString();
-		}
-		
 		/// <summary>
 		/// This method resovles a DNS-style host name or IP
 		/// address.
@@ -314,7 +296,7 @@ namespace System.Net {
 				++p;
 			}
 			if (res > uint.MaxValue)
-				return new IPAddress(IPAddress.NetworkToHostOrder(res));
+				return new IPAddress(IPAddress.NetworkToHostOrder((long)res));
 			else
 				return new IPAddress(IPAddress.NetworkToHostOrder((int)res));
 		}

+ 39 - 3
mcs/class/System/System.Net/IPAddress.cs

@@ -13,7 +13,7 @@ namespace System.Net {
 	///   Encapsulates an IP Address.
 	/// </remarks>
 	public class IPAddress {
-		public uint Address;
+		public long Address;
 
 		public static readonly IPAddress Any;
 		public static readonly IPAddress Broadcast;
@@ -36,7 +36,7 @@ namespace System.Net {
 		/// <summary>
 		///   Constructor from a 32-bit constant.
 		/// </summary>
-		public IPAddress (uint address)
+		public IPAddress (long address)
 		{
 			this.Address = address;
 		}
@@ -78,7 +78,7 @@ namespace System.Net {
 		/// <summary>
 		///   Returns this object rendered in a quad-dotted notation
 		/// </summary>
-		public static string ToString (uint addr)
+		static string ToString (long addr)
 		{
 			return  (addr >> 24).ToString () + "." +
 				((addr >> 16) & 0xff).ToString () + "." +
@@ -101,6 +101,42 @@ namespace System.Net {
 		{
 			return (int)Address;
 		}
+
+		[MonoTODO]
+		public static short HostToNetworkOrder (short host)
+		{
+			return host;
+		}
+
+		[MonoTODO]
+		public static int HostToNetworkOrder (int host)
+		{
+			return host;
+		}
+
+		[MonoTODO]
+		public static long HostToNetworkOrder (long host)
+		{
+			return host;
+		}
+
+		[MonoTODO]
+		public static short NetworkToHostOrder (short host)
+		{
+			return host;
+		}
+
+		[MonoTODO]
+		public static int NetworkToHostOrder (int host)
+		{
+			return host;
+		}
+
+		[MonoTODO]
+		public static long NetworkToHostOrder (long host)
+		{
+			return host;
+		}
 	}
 	
 }

+ 2 - 3
mcs/class/System/System.build

@@ -17,9 +17,8 @@
 				<excludes name="System.Net.Sockets/LingerOption.cs"/>
 				<excludes name="System.Net.Sockets/NetworkStream.cs"/>
 				<excludes name="System.Net.Sockets/Socket.cs"/>
-				<excludes name="System.Net.Sockets/SocketException.cs"/>
-				<excludes name="System.Net/Dns.cs"/>
-				<excludes name="System.Net/IPHostEntry.cs"/>
+				<excludes name="System.Net.Sockets/TcpClient.cs"/>
+				<excludes name="System.Net.Sockets/TcpListener.cs"/>
 				<excludes name="System.Net/IAuthenticationModule.cs"/>
 				<excludes name="System.Net/AuthenticationManager.cs"/>
 			</sources>

+ 4 - 0
mcs/class/System/Test/ChangeLog

@@ -1,3 +1,7 @@
+2002-01-17  Miguel de Icaza  <[email protected]>
+
+	* DnsTest.cs: Updated test.
+
 2001-09-26  Mads Pultz <[email protected]>
 	* DnsTest.cs: initial tests of BeginGetHostByName and EndGetHostByName implemented.
 

+ 0 - 11
mcs/class/System/Test/DnsTest.cs

@@ -129,17 +129,6 @@ public class DnsTest: TestCase {
 		SubTestGetHostByAddressIPAddress(new IPAddress(IPAddress.NetworkToHostOrder((int)site2IP)));
 	}
 	
-	private void SubTestIpToString(int IpAddr) {
-		String addr = System.Net.Dns.IpToString(IpAddr);
-		Assert(addr != null);
-		Assert(addr.Split('.').Length == 4);
-	}
-	
-	public void TestIpToString() {
-		SubTestIpToString((int)site1IP);
-		SubTestIpToString((int)site2IP);
-	}
-	
 	private void SubTestResolve(string addr) {
 		IPHostEntry h = System.Net.Dns.Resolve(addr);
 		SubTestValidIPHostEntry(h);

+ 0 - 11
mcs/class/System/Test/System.Net/DnsTest.cs

@@ -129,17 +129,6 @@ public class DnsTest: TestCase {
 		SubTestGetHostByAddressIPAddress(new IPAddress(IPAddress.NetworkToHostOrder((int)site2IP)));
 	}
 	
-	private void SubTestIpToString(int IpAddr) {
-		String addr = System.Net.Dns.IpToString(IpAddr);
-		Assert(addr != null);
-		Assert(addr.Split('.').Length == 4);
-	}
-	
-	public void TestIpToString() {
-		SubTestIpToString((int)site1IP);
-		SubTestIpToString((int)site2IP);
-	}
-	
 	private void SubTestResolve(string addr) {
 		IPHostEntry h = System.Net.Dns.Resolve(addr);
 		SubTestValidIPHostEntry(h);