瀏覽代碼

1.增加TcpAccptor类,可以异步接收连接
2.Log库改成Logger
3.不再使用zmq,zmq c#版对异步支持不好

tanghai 12 年之前
父節點
當前提交
9df15bbe3c
共有 49 個文件被更改,包括 239 次插入677 次删除
  1. 2 2
      CSharp/App/BossClient/BossClient.cs
  2. 2 2
      CSharp/App/BossClient/BossClient.csproj
  3. 3 3
      CSharp/App/BossClient/GateSession.cs
  4. 7 7
      CSharp/App/BossClient/RealmSession.cs
  5. 2 2
      CSharp/App/BossClient/TcpChannel.cs
  6. 2 2
      CSharp/App/BossCommand/ABossCommand.cs
  7. 2 2
      CSharp/App/BossCommand/BCGetCharacterInfo.cs
  8. 2 2
      CSharp/App/BossCommand/BCSendMail.cs
  9. 3 3
      CSharp/App/BossCommand/BossCommand.csproj
  10. 2 2
      CSharp/App/Modules/Login/Login.csproj
  11. 2 2
      CSharp/App/Modules/Login/LoginViewModel.cs
  12. 2 2
      CSharp/App/Modules/Robot/Robot.csproj
  13. 3 3
      CSharp/App/Modules/Robot/RobotViewModel.cs
  14. 2 2
      CSharp/App/Modules/Tree/BehaviorTreeLayout.cs
  15. 2 2
      CSharp/App/Modules/Tree/Tree.csproj
  16. 2 2
      CSharp/App/Modules/WCFClient/WCFClient.csproj
  17. 28 43
      CSharp/CSharp.sln
  18. 2 2
      CSharp/Game/Component/Component.csproj
  19. 2 2
      CSharp/Game/Component/LogicManager.cs
  20. 2 2
      CSharp/Game/Logic/Event/BeforeLoginWorldEvent.cs
  21. 2 2
      CSharp/Game/Logic/Event/BeforeUseItemEvent.cs
  22. 3 3
      CSharp/Game/Logic/Handler/ChatHandler.cs
  23. 2 2
      CSharp/Game/Logic/Logic.csproj
  24. 2 2
      CSharp/Game/World/World.csproj
  25. 3 3
      CSharp/Platform/ENet/ENet.csproj
  26. 0 1
      CSharp/Platform/ENet/EService.cs
  27. 3 3
      CSharp/Platform/ENetTest/ENetClientServerTest.cs
  28. 4 4
      CSharp/Platform/ENetTest/ENetTest.csproj
  29. 0 6
      CSharp/Platform/Hooks/Hooks.csproj
  30. 0 35
      CSharp/Platform/Log/Logger.cs
  31. 1 1
      CSharp/Platform/Logger/ALogDecorater.cs
  32. 2 2
      CSharp/Platform/Logger/ILog.cs
  33. 35 0
      CSharp/Platform/Logger/Log.cs
  34. 3 3
      CSharp/Platform/Logger/Logger.csproj
  35. 3 3
      CSharp/Platform/Logger/NLogAdapter.cs
  36. 0 0
      CSharp/Platform/Logger/Packages.config
  37. 1 1
      CSharp/Platform/Logger/StackInfoDecorater.cs
  38. 0 12
      CSharp/Platform/TNet/Class1.cs
  39. 43 49
      CSharp/Platform/TNet/TNet.csproj
  40. 58 0
      CSharp/Platform/TNet/TcpAcceptor.cs
  41. 0 36
      CSharp/Platform/Zmq/Properties/AssemblyInfo.cs
  42. 0 61
      CSharp/Platform/Zmq/ZPoller.cs
  43. 0 73
      CSharp/Platform/Zmq/ZSocket.cs
  44. 0 63
      CSharp/Platform/Zmq/Zmq.csproj
  45. 0 4
      CSharp/Platform/Zmq/packages.config
  46. 0 36
      CSharp/Platform/ZmqTest/Properties/AssemblyInfo.cs
  47. 0 73
      CSharp/Platform/ZmqTest/ZmqReqRepTest.cs
  48. 0 106
      CSharp/Platform/ZmqTest/ZmqTest.csproj
  49. 0 4
      CSharp/Platform/ZmqTest/packages.config

+ 2 - 2
CSharp/App/BossClient/BossClient.cs

@@ -2,7 +2,7 @@
 using System.Net.Sockets;
 using System.Threading.Tasks;
 using ENet;
-using Log;
+using Logger;
 
 namespace BossClient
 {
@@ -46,7 +46,7 @@ namespace BossClient
 			using (var realmSession = new RealmSession(loginSessionId, new TcpChannel(tcpClient)))
 			{
 				realmInfo = await realmSession.Login(account, password);
-				Logger.Trace("session: {0}, login success!", realmSession.ID);
+				Log.Trace("session: {0}, login success!", realmSession.ID);
 			}
 
 			// 登录gate

+ 2 - 2
CSharp/App/BossClient/BossClient.csproj

@@ -55,9 +55,9 @@
       <Project>{24233cd5-a5df-484b-a482-b79cb7a0d9cb}</Project>
       <Name>Helper</Name>
     </ProjectReference>
-    <ProjectReference Include="..\..\Platform\Log\Log.csproj">
+    <ProjectReference Include="..\..\Platform\Logger\Logger.csproj">
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
+      <Name>Logger</Name>
     </ProjectReference>
     <ProjectReference Include="..\BossBase\BossBase.csproj">
       <Project>{999910d3-4e7d-45b1-bd2c-47289cd4d1ab}</Project>

+ 3 - 3
CSharp/App/BossClient/GateSession.cs

@@ -2,7 +2,7 @@
 using System.Threading.Tasks;
 using BossBase;
 using Helper;
-using Log;
+using Logger;
 
 namespace BossClient
 {
@@ -58,7 +58,7 @@ namespace BossClient
 					this.ID, MongoHelper.ToJson(smsgAuthResponse)));
 			}
 
-			Logger.Trace("session: {0}, login gate OK!", this.ID);
+			Log.Trace("session: {0}, login gate OK!", this.ID);
 		}
 
 		public async Task<SMSG_Auth_Challenge> Handle_SMSG_Auth_Challenge()
@@ -66,7 +66,7 @@ namespace BossClient
 			var result = await this.IMessageChannel.RecvMessage();
 			ushort opcode = result.Item1;
 			byte[] message = result.Item2;
-			Logger.Debug("message: {0}", message.ToHex());
+			Log.Debug("message: {0}", message.ToHex());
 			if (opcode != MessageOpcode.SMSG_AUTH_CHALLENGE)
 			{
 				throw new BossException(string.Format(

+ 7 - 7
CSharp/App/BossClient/RealmSession.cs

@@ -3,7 +3,7 @@ using System.Security.Cryptography;
 using System.Threading.Tasks;
 using BossBase;
 using Helper;
-using Log;
+using Logger;
 
 namespace BossClient
 {
@@ -51,7 +51,7 @@ namespace BossClient
 
 			if (opcode != MessageOpcode.SMSG_AUTH_LOGON_CHALLENGE_RESPONSE)
 			{
-				Logger.Trace("opcode: {0}", opcode);
+				Log.Trace("opcode: {0}", opcode);
 				throw new BossException(string.Format(
 					"session: {0}, opcode: {1}", this.ID, opcode));
 			}
@@ -109,7 +109,7 @@ namespace BossClient
 				PasswordMd5 = passwordMd5Hex
 			};
 			
-			Logger.Trace("session: {0}, account: {1}, password: {2}", this.ID,
+			Log.Trace("session: {0}, account: {1}, password: {2}", this.ID,
 				cmsgAuthLogonPermit.Account.ToStr(), cmsgAuthLogonPermit.PasswordMd5.ToHex());
 
 			this.MessageChannel.SendMessage(MessageOpcode.CMSG_AUTH_LOGON_PERMIT, cmsgAuthLogonPermit);
@@ -136,7 +136,7 @@ namespace BossClient
 					this.ID, MongoHelper.ToJson(smsgAuthLogonChallengeResponse)));
 			}
 
-			Logger.Trace("session: {0}, SMSG_Auth_Logon_Challenge_Response OK", this.ID);
+			Log.Trace("session: {0}, SMSG_Auth_Logon_Challenge_Response OK", this.ID);
 
 			// 以下是SRP6处理过程
 			var n = smsgAuthLogonChallengeResponse.N.ToUBigInteger();
@@ -147,7 +147,7 @@ namespace BossClient
 			var srp6Client = new SRP6Client(
 				new SHA1Managed(), n, g, b, salt, account.ToByteArray(), passwordMd5Hex);
 
-			Logger.Debug("s: {0}\nN: {1}\nG: {2}\nB: {3}\nA: {4}\nS: {5}\nK: {6}\nm: {7}\na: {8}",
+			Log.Debug("s: {0}\nN: {1}\nG: {2}\nB: {3}\nA: {4}\nS: {5}\nK: {6}\nm: {7}\na: {8}",
 				srp6Client.Salt.ToUBigIntegerArray().ToHex(),
 				srp6Client.N.ToUBigIntegerArray().ToHex(), 
 				srp6Client.G.ToUBigIntegerArray().ToHex(),
@@ -173,14 +173,14 @@ namespace BossClient
 					this.ID, MongoHelper.ToJson(smsgAuthLogonProofM2)));
 			}
 
-			Logger.Trace("session: {0}, SMSG_Auth_Logon_Proof_M2 OK", this.ID);
+			Log.Trace("session: {0}, SMSG_Auth_Logon_Proof_M2 OK", this.ID);
 
 			// 请求realm list
 			var cmsgRealmList = new CMSG_Realm_List();
 			this.MessageChannel.SendMessage(MessageOpcode.CMSG_REALM_LIST, cmsgRealmList);
 			var smsgRealmList = await this.Handle_SMSG_Realm_List();
 
-			Logger.Trace("session: {0}, SMSG_Realm_List OK", this.ID);
+			Log.Trace("session: {0}, SMSG_Realm_List OK", this.ID);
 
 			string gateIP = smsgRealmList.GateIP;
 			ushort gatePort = (ushort)smsgRealmList.GatePort;

+ 2 - 2
CSharp/App/BossClient/TcpChannel.cs

@@ -3,7 +3,7 @@ using System.Net.Sockets;
 using System.Threading.Tasks;
 using BossBase;
 using Helper;
-using Log;
+using Logger;
 
 namespace BossClient
 {
@@ -56,7 +56,7 @@ namespace BossClient
 			}
 
 			int packetSize = BitConverter.ToInt32(packetBytes, 0);
-			Logger.Debug("packetSize: {0}", packetSize);
+			Log.Debug("packetSize: {0}", packetSize);
 
 			// 读opcode和message
 			totalReadSize = 0;

+ 2 - 2
CSharp/App/BossCommand/ABossCommand.cs

@@ -2,7 +2,7 @@
 using System.Threading.Tasks;
 using BossBase;
 using Helper;
-using Log;
+using Logger;
 
 namespace BossCommand
 {
@@ -30,7 +30,7 @@ namespace BossCommand
 			}
 			catch (Exception)
 			{
-				Logger.Trace("parse message fail, opcode: {0}", opcode);
+				Log.Trace("parse message fail, opcode: {0}", opcode);
 				throw;
 			}
 		}

+ 2 - 2
CSharp/App/BossCommand/BCGetCharacterInfo.cs

@@ -3,7 +3,7 @@ using System.Runtime.Serialization;
 using System.Threading.Tasks;
 using BossBase;
 using Helper;
-using Log;
+using Logger;
 
 namespace BossCommand
 {
@@ -24,7 +24,7 @@ namespace BossCommand
 			var smsgBossCommandResponse = await this.RecvMessage<SMSG_Boss_Command_Response>();
 			if (smsgBossCommandResponse.ErrorCode != ErrorCode.RESPONSE_SUCCESS)
 			{
-				Logger.Trace("get character info fail, error code: {0}", smsgBossCommandResponse.ErrorCode);
+				Log.Trace("get character info fail, error code: {0}", smsgBossCommandResponse.ErrorCode);
 				return null;
 			}
 

+ 2 - 2
CSharp/App/BossCommand/BCSendMail.cs

@@ -2,7 +2,7 @@
 using System.Threading.Tasks;
 using BossBase;
 using Helper;
-using Log;
+using Logger;
 
 namespace BossCommand
 {
@@ -18,7 +18,7 @@ namespace BossCommand
 		{
 			this.CommandString = string.Format(
 				"send_mail --json {0} ", MongoHelper.ToJson(this.BossMail));
-			Logger.Trace(this.CommandString);
+			Log.Trace(this.CommandString);
 			this.SendMessage(new CMSG_Boss_Gm { Message = CommandString });
 			var smsgBossCommandResponse = await this.RecvMessage<SMSG_Boss_Command_Response>();
 			return smsgBossCommandResponse.ErrorCode;

+ 3 - 3
CSharp/App/BossCommand/BossCommand.csproj

@@ -52,9 +52,9 @@
       <Project>{24233CD5-A5DF-484B-A482-B79CB7A0D9CB}</Project>
       <Name>Helper</Name>
     </ProjectReference>
-    <ProjectReference Include="..\..\Platform\Log\Log.csproj">
-      <Project>{72E16572-FC1F-4A9E-BC96-035417239298}</Project>
-      <Name>Log</Name>
+    <ProjectReference Include="..\..\Platform\Logger\Logger.csproj">
+      <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
+      <Name>Logger</Name>
     </ProjectReference>
     <ProjectReference Include="..\BossBase\BossBase.csproj">
       <Project>{999910D3-4E7D-45B1-BD2C-47289CD4D1AB}</Project>

+ 2 - 2
CSharp/App/Modules/Login/Login.csproj

@@ -95,9 +95,9 @@
     <None Include="Packages.config" />
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\..\Platform\Log\Log.csproj">
+    <ProjectReference Include="..\..\..\Platform\Logger\Logger.csproj">
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
+      <Name>Logger</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\BossBase\BossBase.csproj">
       <Project>{999910D3-4E7D-45B1-BD2C-47289CD4D1AB}</Project>

+ 2 - 2
CSharp/App/Modules/Login/LoginViewModel.cs

@@ -5,7 +5,7 @@ using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Threading;
 using BossBase;
-using Log;
+using Logger;
 using Microsoft.Practices.Prism.Events;
 using Microsoft.Practices.Prism.ViewModel;
 
@@ -127,7 +127,7 @@ namespace Login
 			catch (Exception e)
 			{
 				this.ErrorInfo = "登录失败";
-				Logger.Trace(e.ToString());
+				Log.Trace(e.ToString());
 				return;
 			}
 			

+ 2 - 2
CSharp/App/Modules/Robot/Robot.csproj

@@ -98,9 +98,9 @@
       <Project>{24233cd5-a5df-484b-a482-b79cb7a0d9cb}</Project>
       <Name>Helper</Name>
     </ProjectReference>
-    <ProjectReference Include="..\..\..\Platform\Log\Log.csproj">
+    <ProjectReference Include="..\..\..\Platform\Logger\Logger.csproj">
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
+      <Name>Logger</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\BossBase\BossBase.csproj">
       <Project>{999910d3-4e7d-45b1-bd2c-47289cd4d1ab}</Project>

+ 3 - 3
CSharp/App/Modules/Robot/RobotViewModel.cs

@@ -8,7 +8,7 @@ using System.Windows;
 using BossCommand;
 using BossBase;
 using Helper;
-using Log;
+using Logger;
 using Microsoft.Practices.Prism.Events;
 using Microsoft.Practices.Prism.ViewModel;
 
@@ -460,7 +460,7 @@ namespace Robot
 			}
 			catch (Exception e)
 			{
-				Logger.Trace(e.ToString());
+				Log.Trace(e.ToString());
 				this.ErrorInfo = "输入错误!";
 				return;
 			}
@@ -493,7 +493,7 @@ namespace Robot
 			}
 			catch(Exception e)
 			{
-				Logger.Trace(e.ToString());
+				Log.Trace(e.ToString());
 				return;
 			}
 			var smsgBossCommandResponse = (SMSG_Boss_Command_Response)result;

+ 2 - 2
CSharp/App/Modules/Tree/BehaviorTreeLayout.cs

@@ -1,4 +1,4 @@
-using Log;
+using Logger;
 
 namespace Tree
 {
@@ -128,7 +128,7 @@ namespace Tree
 			treeNode.Prelim = prelim;
 			treeNode.Modify = modify;
 
-			Logger.Debug("Num: " + treeNode.Num + " Prelim: " + treeNode.Prelim + " Modify: " +
+			Log.Debug("Num: " + treeNode.Num + " Prelim: " + treeNode.Prelim + " Modify: " +
 				treeNode.Modify);
 		}
 

+ 2 - 2
CSharp/App/Modules/Tree/Tree.csproj

@@ -76,9 +76,9 @@
     </Page>
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\..\Platform\Log\Log.csproj">
+    <ProjectReference Include="..\..\..\Platform\Logger\Logger.csproj">
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
+      <Name>Logger</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\Infrastructure\Infrastructure.csproj">
       <Project>{48a2e149-0dac-41b4-bb54-dfbccd6d42b3}</Project>

+ 2 - 2
CSharp/App/Modules/WCFClient/WCFClient.csproj

@@ -93,9 +93,9 @@
     <AppDesigner Include="Properties\" />
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\..\Platform\Log\Log.csproj">
+    <ProjectReference Include="..\..\..\Platform\Logger\Logger.csproj">
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
+      <Name>Logger</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\Infrastructure\Infrastructure.csproj">
       <Project>{48A2E149-0DAC-41B4-BB54-DFBCCD6D42B3}</Project>

+ 28 - 43
CSharp/CSharp.sln

@@ -24,8 +24,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hooks", "Platform\Hooks\Hoo
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure", "App\Infrastructure\Infrastructure.csproj", "{48A2E149-0DAC-41B4-BB54-DFBCCD6D42B3}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Log", "Platform\Log\Log.csproj", "{72E16572-FC1F-4A9E-BC96-035417239298}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{FD5F443E-CBEE-443E-821D-C47C86E09534}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtobufTool", "Tools\ProtobufTool\ProtobufTool.csproj", "{87537C92-B2C7-4E46-A6FB-02B73215C100}"
@@ -68,9 +66,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ENetExe", "Platform\ENetExe
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2814EB55-E1C2-4751-AC14-94116DA9D22B}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZmqTest", "Platform\ZmqTest\ZmqTest.csproj", "{AAEAFEF6-C3CC-4507-A012-04732EAA088A}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TNet", "Platform\TNet\TNet.csproj", "{F74367BF-FEFE-45F9-8303-94414D128B0B}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zmq", "Platform\Zmq\Zmq.csproj", "{31A4AF28-0988-4862-9D5A-69D34CDB50E6}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logger", "Platform\Logger\Logger.csproj", "{72E16572-FC1F-4A9E-BC96-035417239298}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -134,18 +132,6 @@ Global
 		{48A2E149-0DAC-41B4-BB54-DFBCCD6D42B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
 		{48A2E149-0DAC-41B4-BB54-DFBCCD6D42B3}.Release|Win32.ActiveCfg = Release|Any CPU
 		{48A2E149-0DAC-41B4-BB54-DFBCCD6D42B3}.Release|x86.ActiveCfg = Release|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Win32.ActiveCfg = Debug|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Any CPU.Build.0 = Release|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Win32.ActiveCfg = Release|Any CPU
-		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|x86.ActiveCfg = Release|Any CPU
 		{87537C92-B2C7-4E46-A6FB-02B73215C100}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{87537C92-B2C7-4E46-A6FB-02B73215C100}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{87537C92-B2C7-4E46-A6FB-02B73215C100}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -364,30 +350,30 @@ Global
 		{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}.Release|Mixed Platforms.Build.0 = Release|Any CPU
 		{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}.Release|Win32.ActiveCfg = Release|Any CPU
 		{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}.Release|x86.ActiveCfg = Release|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Debug|Win32.ActiveCfg = Debug|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Release|Win32.ActiveCfg = Release|Any CPU
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A}.Release|x86.ActiveCfg = Release|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Debug|Win32.ActiveCfg = Debug|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Release|Any CPU.Build.0 = Release|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Release|Win32.ActiveCfg = Release|Any CPU
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6}.Release|x86.ActiveCfg = Release|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Release|Win32.ActiveCfg = Release|Any CPU
+		{F74367BF-FEFE-45F9-8303-94414D128B0B}.Release|x86.ActiveCfg = Release|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Any CPU.Build.0 = Release|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|Win32.ActiveCfg = Release|Any CPU
+		{72E16572-FC1F-4A9E-BC96-035417239298}.Release|x86.ActiveCfg = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -400,14 +386,13 @@ Global
 		{999910D3-4E7D-45B1-BD2C-47289CD4D1AB} = {6E9D97F0-4243-452E-B832-1A855B8118EB}
 		{6C16281F-5550-4024-9504-295C63889E4F} = {6E9D97F0-4243-452E-B832-1A855B8118EB}
 		{3A98B35C-DEA8-489C-9203-263FFB6B065D} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
-		{72E16572-FC1F-4A9E-BC96-035417239298} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
 		{24233CD5-A5DF-484B-A482-B79CB7A0D9CB} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
 		{C9992B7C-313E-4C9F-A954-640D01EDFB58} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
 		{D0B4CFAC-A368-4742-9863-68776CFA9938} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
 		{901A8E5C-C4C6-4C3C-8E18-068D75119F5D} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
 		{CBA52DC8-1C80-4A79-9AC5-73514EBBD749} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
-		{AAEAFEF6-C3CC-4507-A012-04732EAA088A} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
-		{31A4AF28-0988-4862-9D5A-69D34CDB50E6} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
+		{F74367BF-FEFE-45F9-8303-94414D128B0B} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
+		{72E16572-FC1F-4A9E-BC96-035417239298} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
 		{5D6ECBCD-BE14-4DCB-BAEC-57089748B164} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
 		{5AA48F9A-455D-4CD8-A605-A3AC38283E60} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
 		{B07D70E7-F902-4F67-A486-B7AF27D6B813} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}

+ 2 - 2
CSharp/Game/Component/Component.csproj

@@ -70,9 +70,9 @@
       <Project>{24233cd5-a5df-484b-a482-b79cb7a0d9cb}</Project>
       <Name>Helper</Name>
     </ProjectReference>
-    <ProjectReference Include="..\..\Platform\Log\Log.csproj">
+    <ProjectReference Include="..\..\Platform\Logger\Logger.csproj">
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
+      <Name>Logger</Name>
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>

+ 2 - 2
CSharp/Game/Component/LogicManager.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.IO;
 using Helper;
-using Log;
+using Logger;
 
 namespace Component
 {
@@ -116,7 +116,7 @@ namespace Component
 			}
 			catch (Exception e)
 			{
-				Logger.Trace("message handle error: {0}", e.Message);
+				Log.Trace("message handle error: {0}", e.Message);
 			}
 	    }
 

+ 2 - 2
CSharp/Game/Logic/Event/BeforeLoginWorldEvent.cs

@@ -1,5 +1,5 @@
 using Component;
-using Log;
+using Logger;
 
 namespace Logic
 {
@@ -8,7 +8,7 @@ namespace Logic
 	{
 		public void Trigger(MessageEnv messageEnv)
 		{
-			Logger.Trace("check player");
+			Log.Trace("check player");
 		}
 	}
 }

+ 2 - 2
CSharp/Game/Logic/Event/BeforeUseItemEvent.cs

@@ -1,5 +1,5 @@
 using Component;
-using Log;
+using Logger;
 
 namespace Logic
 {
@@ -8,7 +8,7 @@ namespace Logic
 	{
 		public void Trigger(MessageEnv messageEnv)
 		{
-			Logger.Trace("check player");
+			Log.Trace("check player");
 		}
 	}
 }

+ 3 - 3
CSharp/Game/Logic/Handler/ChatHandler.cs

@@ -1,6 +1,6 @@
 using Component.Config;
 using Helper;
-using Log;
+using Logger;
 using Component;
 
 namespace Logic
@@ -14,8 +14,8 @@ namespace Logic
 
 			var world = World.World.Instance;
 			var globalConfig = world.ConfigManager.Get<GlobalConfig>(1);
-			Logger.Debug(MongoHelper.ToJson(globalConfig));
-			Logger.Debug("chat content: {0}", chat.Content);
+			Log.Debug(MongoHelper.ToJson(globalConfig));
+			Log.Debug("chat content: {0}", chat.Content);
 		}
 	}
 }

+ 2 - 2
CSharp/Game/Logic/Logic.csproj

@@ -45,9 +45,9 @@
       <Project>{24233cd5-a5df-484b-a482-b79cb7a0d9cb}</Project>
       <Name>Helper</Name>
     </ProjectReference>
-    <ProjectReference Include="..\..\Platform\Log\Log.csproj">
+    <ProjectReference Include="..\..\Platform\Logger\Logger.csproj">
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
+      <Name>Logger</Name>
     </ProjectReference>
     <ProjectReference Include="..\Component\Component.csproj">
       <Project>{0fa529d1-d0a9-4a8e-90f5-117ce80f2ede}</Project>

+ 2 - 2
CSharp/Game/World/World.csproj

@@ -45,9 +45,9 @@
       <Project>{24233cd5-a5df-484b-a482-b79cb7a0d9cb}</Project>
       <Name>Helper</Name>
     </ProjectReference>
-    <ProjectReference Include="..\..\Platform\Log\Log.csproj">
+    <ProjectReference Include="..\..\Platform\Logger\Logger.csproj">
       <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
+      <Name>Logger</Name>
     </ProjectReference>
     <ProjectReference Include="..\Component\Component.csproj">
       <Project>{0fa529d1-d0a9-4a8e-90f5-117ce80f2ede}</Project>

+ 3 - 3
CSharp/Platform/ENet/ENet.csproj

@@ -53,9 +53,9 @@
     <Folder Include="Properties\" />
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\Log\Log.csproj">
-      <Project>{72E16572-FC1F-4A9E-BC96-035417239298}</Project>
-      <Name>Log</Name>
+    <ProjectReference Include="..\Logger\Logger.csproj">
+      <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
+      <Name>Logger</Name>
     </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

+ 0 - 1
CSharp/Platform/ENet/EService.cs

@@ -1,6 +1,5 @@
 using System;
 using System.Collections.Generic;
-using Log;
 
 namespace ENet
 {

+ 3 - 3
CSharp/Platform/ENetTest/ENetClientServerTest.cs

@@ -2,7 +2,7 @@
 using System.Threading;
 using ENet;
 using Helper;
-using Log;
+using Logger;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
 namespace ENetTest
@@ -26,7 +26,7 @@ namespace ENetTest
 				CollectionAssert.AreEqual("9876543210".ToByteArray(), bytes);
 			}
 			stopWatch.Stop();
-			Logger.Debug("time: {0}", stopWatch.ElapsedMilliseconds);
+			Log.Debug("time: {0}", stopWatch.ElapsedMilliseconds);
 			await eSocket.DisconnectAsync();
 			service.Stop();
 		}
@@ -38,7 +38,7 @@ namespace ENetTest
 			bool isRunning = true;
 			while (isRunning)
 			{
-				Logger.Debug("start accept");
+				Log.Debug("start accept");
 				var eSocket = new ESocket(service);
 				await eSocket.AcceptAsync();
 				eSocket.Disconnect += ev =>

+ 4 - 4
CSharp/Platform/ENetTest/ENetTest.csproj

@@ -61,14 +61,14 @@
       <Project>{24233cd5-a5df-484b-a482-b79cb7a0d9cb}</Project>
       <Name>Helper</Name>
     </ProjectReference>
-    <ProjectReference Include="..\..\Platform\Log\Log.csproj">
-      <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
-    </ProjectReference>
     <ProjectReference Include="..\ENet\ENet.csproj">
       <Project>{d0b4cfac-a368-4742-9863-68776cfa9938}</Project>
       <Name>ENet</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Logger\Logger.csproj">
+      <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
+      <Name>Logger</Name>
+    </ProjectReference>
   </ItemGroup>
   <Choose>
     <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">

+ 0 - 6
CSharp/Platform/Hooks/Hooks.csproj

@@ -45,12 +45,6 @@
   <ItemGroup>
     <Folder Include="Properties\" />
   </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Log\Log.csproj">
-      <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
-    </ProjectReference>
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 0 - 35
CSharp/Platform/Log/Logger.cs

@@ -1,35 +0,0 @@
-namespace Log
-{
-	public static class Logger
-	{
-		private static readonly ILogger globalLogger = new NLoggerAdapter(new StackInfoDecorater());
-
-		public static ILogger GlobalLogger
-		{
-			get
-			{
-				return globalLogger;
-			}
-		}
-
-		public static void Trace(string message)
-		{
-			globalLogger.Trace(message);
-		}
-
-		public static void Trace(string format, params object[] args)
-		{
-			globalLogger.Trace(string.Format(format, args));
-		}
-
-		public static void Debug(string format)
-		{
-			globalLogger.Debug(format);
-		}
-
-		public static void Debug(string format, params object[] args)
-		{
-			globalLogger.Debug(string.Format(format, args));
-		}
-	}
-}

+ 1 - 1
CSharp/Platform/Log/ALogDecorater.cs → CSharp/Platform/Logger/ALogDecorater.cs

@@ -1,4 +1,4 @@
-namespace Log
+namespace Logger
 {
 	public abstract class ALogDecorater
 	{

+ 2 - 2
CSharp/Platform/Log/ILogger.cs → CSharp/Platform/Logger/ILog.cs

@@ -1,6 +1,6 @@
-namespace Log
+namespace Logger
 {
-	public interface ILogger
+	public interface ILog
 	{
 		void Trace(string message);
 		void Debug(string message);

+ 35 - 0
CSharp/Platform/Logger/Log.cs

@@ -0,0 +1,35 @@
+namespace Logger
+{
+	public static class Log
+	{
+		private static readonly ILog globalLog = new NLogAdapter(new StackInfoDecorater());
+
+		public static ILog GlobalLog
+		{
+			get
+			{
+				return globalLog;
+			}
+		}
+
+		public static void Trace(string message)
+		{
+			GlobalLog.Trace(message);
+		}
+
+		public static void Trace(string format, params object[] args)
+		{
+			GlobalLog.Trace(string.Format(format, args));
+		}
+
+		public static void Debug(string format)
+		{
+			GlobalLog.Debug(format);
+		}
+
+		public static void Debug(string format, params object[] args)
+		{
+			GlobalLog.Debug(string.Format(format, args));
+		}
+	}
+}

+ 3 - 3
CSharp/Platform/Log/Log.csproj → CSharp/Platform/Logger/Logger.csproj

@@ -41,9 +41,9 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="ALogDecorater.cs" />
-    <Compile Include="Logger.cs" />
-    <Compile Include="ILogger.cs" />
-    <Compile Include="NLoggerAdapter.cs" />
+    <Compile Include="Log.cs" />
+    <Compile Include="ILog.cs" />
+    <Compile Include="NLogAdapter.cs" />
     <Compile Include="StackInfoDecorater.cs" />
   </ItemGroup>
   <ItemGroup>

+ 3 - 3
CSharp/Platform/Log/NLoggerAdapter.cs → CSharp/Platform/Logger/NLogAdapter.cs

@@ -1,12 +1,12 @@
 using NLog;
 
-namespace Log
+namespace Logger
 {
-	public class NLoggerAdapter: ALogDecorater, ILogger
+	public class NLogAdapter: ALogDecorater, ILog
 	{
 		private readonly NLog.Logger logger = LogManager.GetCurrentClassLogger();
 
-		public NLoggerAdapter(ALogDecorater decorater = null): base(decorater)
+		public NLogAdapter(ALogDecorater decorater = null): base(decorater)
 		{
 		}
 

+ 0 - 0
CSharp/Platform/Log/Packages.config → CSharp/Platform/Logger/Packages.config


+ 1 - 1
CSharp/Platform/Log/StackInfoDecorater.cs → CSharp/Platform/Logger/StackInfoDecorater.cs

@@ -1,7 +1,7 @@
 using System.Diagnostics;
 using System.IO;
 
-namespace Log
+namespace Logger
 {
 	internal class StackInfoDecorater: ALogDecorater
 	{

+ 0 - 12
CSharp/Platform/TNet/Class1.cs

@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace TNet
-{
-    public class Class1
-    {
-    }
-}

+ 43 - 49
CSharp/Platform/TNet/TNet.csproj

@@ -1,53 +1,48 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-	<PropertyGroup>
-		<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-		<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-		<ProjectGuid>f6339a3f-46f7-420a-ad20-a365f724a470</ProjectGuid>
-		<OutputType>Library</OutputType>
-		<AppDesignerFolder>Properties</AppDesignerFolder>
-		<RootNamespace>TNet</RootNamespace>
-		<AssemblyName>TNet</AssemblyName>
-		<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-		<FileAlignment>512</FileAlignment>
-	</PropertyGroup>
-	<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-		<DebugSymbols>true</DebugSymbols>
-		<DebugType>full</DebugType>
-		<Optimize>false</Optimize>
-		<OutputPath>bin\Debug\</OutputPath>
-		<DefineConstants>DEBUG;TRACE</DefineConstants>
-		<ErrorReport>prompt</ErrorReport>
-		<WarningLevel>4</WarningLevel>
-	</PropertyGroup>
-	<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-		<DebugType>pdbonly</DebugType>
- 		<Optimize>true</Optimize>
-		<OutputPath>bin\Release\</OutputPath>
-		<DefineConstants>TRACE</DefineConstants>
-		<ErrorReport>prompt</ErrorReport>
-		<WarningLevel>4</WarningLevel>
-	</PropertyGroup>
-	<ItemGroup>
-		<Reference Include="System"/>
-		
-		<Reference Include="System.Core"/>
-		<Reference Include="System.Xml.Linq"/>
-		<Reference Include="System.Data.DataSetExtensions"/>
-		
-		
-		<Reference Include="Microsoft.CSharp"/>
- 		
-		<Reference Include="System.Data"/>
-		<Reference Include="System.Xml"/>
-	</ItemGroup>
-	<ItemGroup>
-		<Compile Include="Class1.cs" />
-
-		<Compile Include="Properties\AssemblyInfo.cs" />
-	</ItemGroup>
-	<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F74367BF-FEFE-45F9-8303-94414D128B0B}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>TNet</RootNamespace>
+    <AssemblyName>TNet</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\Bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\Bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="TcpAcceptor.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
@@ -55,5 +50,4 @@
   <Target Name="AfterBuild">
   </Target>
   -->
-
- </Project>
+</Project>

+ 58 - 0
CSharp/Platform/TNet/TcpAcceptor.cs

@@ -0,0 +1,58 @@
+using System;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading.Tasks;
+
+namespace TNet
+{
+    public class TcpAcceptor
+    {
+	    private readonly Socket socket;
+		private readonly SocketAsyncEventArgs asyncEventArgs = new SocketAsyncEventArgs();
+
+	    public TcpAcceptor(Socket socket, EndPoint endPoint)
+	    {
+		    this.socket = socket;
+			this.asyncEventArgs.Completed += OnArgsCompletion;
+			this.socket.Bind(endPoint);
+	    }
+
+	    public Task<NetworkStream> AcceptAsync()
+	    {
+			var tcs = new TaskCompletionSource<NetworkStream>();
+		    
+			try
+			{
+				asyncEventArgs.UserToken = tcs;
+
+				bool ret = this.socket.AcceptAsync(asyncEventArgs);
+
+				if (!ret)
+				{
+					if (asyncEventArgs.SocketError == SocketError.Success)
+					{
+						return Task.FromResult(new NetworkStream(asyncEventArgs.AcceptSocket, true));
+					}
+					tcs.TrySetException(new InvalidOperationException(this.asyncEventArgs.SocketError.ToString()));
+				}
+			}
+			catch (Exception ex)
+			{
+				tcs.TrySetException(ex);
+			}
+			return tcs.Task;
+	    }
+
+	    private void OnArgsCompletion(object sender, SocketAsyncEventArgs e)
+	    {
+			var tcs = (TaskCompletionSource<NetworkStream>)e.UserToken;
+
+			if (asyncEventArgs.SocketError != SocketError.Success)
+			{
+				tcs.TrySetException(new InvalidOperationException(asyncEventArgs.SocketError.ToString()));
+				return;
+			}
+			tcs.SetResult(new NetworkStream(e.AcceptSocket, true));
+	    }
+    }
+}

+ 0 - 36
CSharp/Platform/Zmq/Properties/AssemblyInfo.cs

@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// 有关程序集的常规信息通过以下
-// 特性集控制。更改这些特性值可修改
-// 与程序集关联的信息。
-[assembly: AssemblyTitle("Zmq")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Zmq")]
-[assembly: AssemblyCopyright("Copyright ©  2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// 将 ComVisible 设置为 false 使此程序集中的类型
-// 对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
-// 则将该类型上的 ComVisible 特性设置为 true。
-[assembly: ComVisible(false)]
-
-// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
-[assembly: Guid("1ba6cfe8-9bfe-44a9-80e9-f61be827ae04")]
-
-// 程序集的版本信息由下面四个值组成: 
-//
-//      主版本
-//      次版本 
-//      生成号
-//      修订号
-//
-// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
-// 方法是按如下所示使用“*”: 
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]

+ 0 - 61
CSharp/Platform/Zmq/ZPoller.cs

@@ -1,61 +0,0 @@
-using System;
-using ZeroMQ;
-
-namespace Zmq
-{
-	public class ZPoller: Poller
-	{
-		private readonly object eventsLock = new object();
-		private Action events = () => {};
-		private bool isRunning = true;
-
-		public event Action Events
-		{
-			add
-			{
-				lock (this.eventsLock)
-				{
-					this.events += value;
-				}
-			}
-			remove
-			{
-				lock (this.eventsLock)
-				{
-					this.events -= value;
-				}
-			}
-		}
-
-		private void OnEvents()
-		{
-			Action local = null;
-			lock (this.eventsLock)
-			{
-				local = this.events;
-				this.events = () => {};
-			}
-			local();
-		}
-
-		public void Add(ZSocket socket)
-		{
-			this.AddSocket(socket.ZmqSocket);
-		}
-
-		public void Start()
-		{
-			isRunning = true;
-			this.OnEvents();
-			while (isRunning)
-			{
-				this.Poll(TimeSpan.FromMilliseconds(0));
-			}
-		}
-
-		public void Stop()
-		{
-			isRunning = false;
-		}
-	}
-}

+ 0 - 73
CSharp/Platform/Zmq/ZSocket.cs

@@ -1,73 +0,0 @@
-using System;
-using System.Text;
-using System.Threading.Tasks;
-using ZeroMQ;
-
-namespace Zmq
-{
-	public class ZSocket: IDisposable
-	{
-		private readonly ZmqSocket socket;
-
-		public ZSocket(ZmqSocket socket)
-		{
-			this.socket = socket;
-			this.socket.ReceiveReady += delegate { };
-		}
-
-		public void Dispose()
-		{
-			this.socket.Dispose();
-		}
-
-		public ZmqSocket ZmqSocket
-		{
-			get
-			{
-				return this.socket;
-			}
-		}
-
-		private EventHandler<SocketEventArgs> SendHandler { get; set; }
-
-		private EventHandler<SocketEventArgs> RecvHandler { get; set; }
-
-	    public Task<string> RecvAsync()
-	    {
-			var tcs = new TaskCompletionSource<string>();
-
-			this.RecvHandler = (sender, args) =>
-		    {
-				args.Socket.ReceiveReady -= this.RecvHandler;
-				tcs.TrySetResult(args.Socket.Receive(Encoding.Unicode));
-		    };
-
-			this.socket.ReceiveReady += this.RecvHandler;
-		    return tcs.Task;
-	    }
-
-		public Task<bool> SendAsync(string str)
-		{
-			var tcs = new TaskCompletionSource<bool>();
-
-			this.SendHandler = (sender, args) =>
-			{
-				args.Socket.SendReady -= this.SendHandler;
-				this.socket.Send(str, Encoding.Unicode, TimeSpan.FromMilliseconds(0));
-				tcs.TrySetResult(true);
-			};
-			this.socket.SendReady += this.SendHandler;
-			return tcs.Task;
-		}
-
-		public void Connect(string address)
-		{
-			this.socket.Connect(address);
-		}
-
-		public void Bind(string address)
-		{
-			this.socket.Bind(address);
-		}
-	}
-}

+ 0 - 63
CSharp/Platform/Zmq/Zmq.csproj

@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{31A4AF28-0988-4862-9D5A-69D34CDB50E6}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Zmq</RootNamespace>
-    <AssemblyName>Zmq</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <RestorePackages>true</RestorePackages>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>..\..\Bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>..\..\Bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="clrzmq">
-      <HintPath>..\..\packages\clrzmq.3.0.0-rc1\lib\net40\clrzmq.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="ZPoller.cs" />
-    <Compile Include="ZSocket.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="packages.config" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>

+ 0 - 4
CSharp/Platform/Zmq/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="clrzmq" version="3.0.0-rc1" targetFramework="net45" />
-</packages>

+ 0 - 36
CSharp/Platform/ZmqTest/Properties/AssemblyInfo.cs

@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// 有关程序集的常规信息通过以下特性集 
-// 控制。更改这些特性值可修改
-// 与程序集关联的信息。
-[assembly: AssemblyTitle("ZmqTest")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("ZmqTest")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// 将 ComVisible 设置为 false 会使此程序集中的类型 
-// 对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
-// 请将该类型上的 ComVisible 特性设置为 true。
-[assembly: ComVisible(false)]
-
-// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
-[assembly: Guid("3bf57ebf-3d07-4c39-8148-70674cf3b9e5")]
-
-// 程序集的版本信息由以下四个值组成: 
-//
-//      主版本
-//      次版本
-//      生成号
-//      修订号
-//
-// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
-// 方法是按如下所示使用“*”: 
-// [assembly:  AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]

+ 0 - 73
CSharp/Platform/ZmqTest/ZmqReqRepTest.cs

@@ -1,73 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using Helper;
-using Log;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Zmq;
-using ZeroMQ;
-
-namespace ZmqTest
-{
-	[TestClass]
-	public class ZmqReqRepTest
-	{
-		const string address = "tcp://127.0.0.1:5001";
-
-		[TestMethod]
-		public void TestSendAsyncAndRecvAsync()
-		{
-			var clientPoller = new ZPoller();
-			var serverPoller = new ZPoller();
-
-			clientPoller.Events += () => Client2(clientPoller);
-
-			serverPoller.Events += () => Server2(serverPoller);
-
-			var task1 = Task.Factory.StartNew(clientPoller.Start, TaskCreationOptions.LongRunning);
-			var task2 = Task.Factory.StartNew(serverPoller.Start, TaskCreationOptions.LongRunning);
-			Task.WaitAll(task1, task2);
-		}
-
-		public static async Task Client2(ZPoller zPoller)
-		{
-			using (var context = ZmqContext.Create())
-			{
-				try
-				{
-					var socket = new ZSocket(context.CreateSocket(SocketType.REP));
-					zPoller.Add(socket);
-					socket.Connect(address);
-					await socket.SendAsync("hello world");
-					string recvStr = await socket.RecvAsync();
-					Logger.Debug(string.Format("client2: {0}", recvStr));
-					zPoller.Stop();
-				}
-				catch (Exception e)
-				{
-					Logger.Debug(string.Format("exception: {0}", e.StackTrace));
-				}
-			}	
-		}
-
-		public static async Task Server2(ZPoller zPoller)
-		{
-			using (var context = ZmqContext.Create())
-			{
-				try
-				{
-					var socket = new ZSocket(context.CreateSocket(SocketType.REP));
-					zPoller.Add(socket);
-					socket.Bind(address);
-					string recvStr = await socket.RecvAsync();
-					Logger.Debug(string.Format("server2: {0}", recvStr));
-					await socket.SendAsync("hello world");
-					zPoller.Stop();
-				}
-				catch (Exception e)
-				{
-					Logger.Debug(string.Format("exception2: {0}", e.StackTrace));
-				}
-			}	
-		}
-	}
-}

+ 0 - 106
CSharp/Platform/ZmqTest/ZmqTest.csproj

@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{AAEAFEF6-C3CC-4507-A012-04732EAA088A}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>ZmqTest</RootNamespace>
-    <AssemblyName>ZmqTest</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
-    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
-    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
-    <IsCodedUITest>False</IsCodedUITest>
-    <TestProjectType>UnitTest</TestProjectType>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <RestorePackages>true</RestorePackages>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>..\..\Bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>..\..\Bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="clrzmq">
-      <HintPath>..\..\packages\clrzmq.3.0.0-rc1\lib\net40\clrzmq.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-  </ItemGroup>
-  <Choose>
-    <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
-      <ItemGroup>
-        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
-      </ItemGroup>
-    </When>
-    <Otherwise>
-      <ItemGroup>
-        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
-      </ItemGroup>
-    </Otherwise>
-  </Choose>
-  <ItemGroup>
-    <Compile Include="ZmqReqRepTest.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Helper\Helper.csproj">
-      <Project>{24233cd5-a5df-484b-a482-b79cb7a0d9cb}</Project>
-      <Name>Helper</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Log\Log.csproj">
-      <Project>{72e16572-fc1f-4a9e-bc96-035417239298}</Project>
-      <Name>Log</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Zmq\Zmq.csproj">
-      <Project>{31a4af28-0988-4862-9d5a-69d34cdb50e6}</Project>
-      <Name>Zmq</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="packages.config" />
-  </ItemGroup>
-  <Choose>
-    <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
-      <ItemGroup>
-        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-          <Private>False</Private>
-        </Reference>
-        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-          <Private>False</Private>
-        </Reference>
-        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-          <Private>False</Private>
-        </Reference>
-        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-          <Private>False</Private>
-        </Reference>
-      </ItemGroup>
-    </When>
-  </Choose>
-  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>

+ 0 - 4
CSharp/Platform/ZmqTest/packages.config

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="clrzmq" version="3.0.0-rc1" targetFramework="net45" />
-</packages>