THRIFT-25. csharp: Various compiler and library improvements

Compiler:
- Thrift structures are serializable.
- The member fields of thrift structures are now private and only accessible
  through Properties, which keep the appropriate __isset up to date.

Library
- Addition of TBufferedTransport, which can be used to wrap other Transports.
- Addition of TThreadedServer, which manually manages threads instead of
  relying on .NET ThreadPool.
- Servers use a log delegate that defaults to System.Console but allows
  servers to use log4net without introducing the dependency.

ThriftTest Visual Studio Project
- Test client and server that use ThriftTest.thrift. The project references
  thrift.exe and Thrift.dll from the subversion tree and automatically builds
  generated code. This makes it very easy to test changes in both the compiler
  and library.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@732079 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/csharp/src/Transport/TServerSocket.cs b/lib/csharp/src/Transport/TServerSocket.cs
index 33ada7b..a6caf90 100644
--- a/lib/csharp/src/Transport/TServerSocket.cs
+++ b/lib/csharp/src/Transport/TServerSocket.cs
@@ -34,6 +34,11 @@
 		private int clientTimeout = 0;
 
 		/**
+		 * Whether or not to wrap new TSocket connections in buffers
+		 */
+		private bool useBufferedSockets = false;
+
+		/**
 		 * Creates a server socket from underlying socket object
 		 */
 		public TServerSocket(TcpListener listener)
@@ -62,9 +67,15 @@
 		 * Creates just a port listening server socket
 		 */
 		public TServerSocket(int port, int clientTimeout)
+			:this(port, clientTimeout, false)
+		{
+		}
+
+		public TServerSocket(int port, int clientTimeout, bool useBufferedSockets)
 		{
 			this.port = port;
 			this.clientTimeout = clientTimeout;
+			this.useBufferedSockets = useBufferedSockets;
 			try
 			{
 				// Make server socket
@@ -88,7 +99,7 @@
 				}
 				catch (SocketException sx)
 				{
-					Console.Error.WriteLine(sx);
+					throw new TTransportException("Could not accept on listening socket: " + sx.Message);
 				}
 			}
 		}
@@ -104,7 +115,15 @@
 				TcpClient result = server.AcceptTcpClient();
 				TSocket result2 = new TSocket(result);
 				result2.Timeout = clientTimeout;
-				return result2;
+				if (useBufferedSockets)
+				{
+					TBufferedTransport result3 = new TBufferedTransport(result2);
+					return result3;
+				}
+				else
+				{
+					return result2;
+				}
 			}
 			catch (Exception ex)
 			{
@@ -122,7 +141,7 @@
 				}
 				catch (Exception ex)
 				{
-					Console.Error.WriteLine("WARNING: Could not close server socket: " + ex);
+					throw new TTransportException("WARNING: Could not close server socket: " + ex);
 				}
 				server = null;
 			}