diff --git a/CSharp-Mono/CSharp-Mono.userprefs b/CSharp-Mono/CSharp-Mono.userprefs index 1f9e4dfc2fbe895891e8456d60faf3995f16aa16..590bbd6eb9edb66f1aeec27aaf85aede646d5abd 100644 --- a/CSharp-Mono/CSharp-Mono.userprefs +++ b/CSharp-Mono/CSharp-Mono.userprefs @@ -1,9 +1,22 @@  - - - - + + + + + + + + + + + + + + + + + diff --git a/CSharp/CMakeLists.txt b/CSharp/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cc8975acbbcacc3effb22f13a67fac314fc30ae --- /dev/null +++ b/CSharp/CMakeLists.txt @@ -0,0 +1,18 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4) + +SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) +SET(CMAKE_USE_RELATIVE_PATHS ON) +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Debug") +ENDIF() + +PROJECT(CSharp) + +# 设置头文件查找路径 +INCLUDE_DIRECTORIES(Platform) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/Platform) + +ADD_DEFINITIONS(-DHAS_SOCKLEN_T) + +# 子目录 +ADD_SUBDIRECTORY(Platform/ENet) \ No newline at end of file diff --git a/CSharp/CSharp.sln b/CSharp/CSharp.sln index c0303daefe13669b9219f4e4d94994441b0d16a9..bf87ff7047118feb1de411c5dc26f1ae4f517e93 100644 --- a/CSharp/CSharp.sln +++ b/CSharp/CSharp.sln @@ -44,12 +44,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{AAD111 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UNet", "Platform\UNet\UNet.csproj", "{D0B4CFAC-A368-4742-9863-68776CFA9938}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENet", "Platform\ENet\ENet.vcxproj", "{C9992B7C-313E-4C9F-A954-640D01EDFB58}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UNetTest", "Platform\UNetTest\UNetTest.csproj", "{901A8E5C-C4C6-4C3C-8E18-068D75119F5D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfileExe", "Platform\ProfileExe\ProfileExe.csproj", "{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENet", "Platform\ENet\ENet.vcxproj", "{C9992B7C-313E-4C9F-A954-640D01EDFB58}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -184,20 +184,6 @@ Global {D0B4CFAC-A368-4742-9863-68776CFA9938}.Release|Mixed Platforms.Build.0 = Release|Any CPU {D0B4CFAC-A368-4742-9863-68776CFA9938}.Release|Win32.ActiveCfg = Release|Any CPU {D0B4CFAC-A368-4742-9863-68776CFA9938}.Release|x86.ActiveCfg = Release|Any CPU - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Win32.ActiveCfg = Debug|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Win32.Build.0 = Debug|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.ActiveCfg = Debug|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.Build.0 = Debug|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Any CPU.ActiveCfg = Release|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Mixed Platforms.Build.0 = Release|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Win32.ActiveCfg = Release|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Win32.Build.0 = Release|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.ActiveCfg = Release|Win32 - {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.Build.0 = Release|Win32 {901A8E5C-C4C6-4C3C-8E18-068D75119F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {901A8E5C-C4C6-4C3C-8E18-068D75119F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU {901A8E5C-C4C6-4C3C-8E18-068D75119F5D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -222,6 +208,20 @@ 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 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Win32.ActiveCfg = Debug|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Win32.Build.0 = Debug|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.ActiveCfg = Debug|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.Build.0 = Debug|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Any CPU.ActiveCfg = Release|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Mixed Platforms.Build.0 = Release|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Win32.ActiveCfg = Release|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Win32.Build.0 = Release|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.ActiveCfg = Release|Win32 + {C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -238,8 +238,8 @@ Global {6CD185D1-08E0-4729-A999-2D5B57BA8193} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6} {93FB20CF-827A-4CED-A273-90117EB7192F} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B} {D0B4CFAC-A368-4742-9863-68776CFA9938} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9} - {C9992B7C-313E-4C9F-A954-640D01EDFB58} = {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} + {C9992B7C-313E-4C9F-A954-640D01EDFB58} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9} EndGlobalSection EndGlobal diff --git a/CSharp/Platform/ENet/CMakeLists.txt b/CSharp/Platform/ENet/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..4367e8490cb97b4e902a4386528cf649a49e39ee --- /dev/null +++ b/CSharp/Platform/ENet/CMakeLists.txt @@ -0,0 +1,15 @@ +INCLUDE_DIRECTORIES(.) + +FILE(GLOB Header "enet/*.h") +FILE(GLOB CCer "*.c") + +SET(ENetSrc + ${Header} + ${CCer} +) + +ADD_LIBRARY(ENet SHARED ${ENetSrc}) + +set_target_properties(ENet PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/" +) \ No newline at end of file diff --git a/CSharp/Platform/ENet/ENet.vcxproj b/CSharp/Platform/ENet/ENet.vcxproj index e47708a1ccb0999263a686951e33d2ddf422d9bc..8bb51b56bf870b8159a7b6fe6138f9bc444a7544 100644 --- a/CSharp/Platform/ENet/ENet.vcxproj +++ b/CSharp/Platform/ENet/ENet.vcxproj @@ -104,26 +104,26 @@ - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/CSharp/Platform/ENet/ENet.vcxproj.filters b/CSharp/Platform/ENet/ENet.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..2fb8dc191b73bce3f9b0809ca2fd7185bbcf3ef9 --- /dev/null +++ b/CSharp/Platform/ENet/ENet.vcxproj.filters @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + {5b0e5c61-d179-4c41-a760-6154cf2db017} + + + + + enet + + + enet + + + enet + + + enet + + + enet + + + enet + + + enet + + + enet + + + enet + + + \ No newline at end of file diff --git a/CSharp/Platform/ENet/callbacks.cc b/CSharp/Platform/ENet/callbacks.c similarity index 100% rename from CSharp/Platform/ENet/callbacks.cc rename to CSharp/Platform/ENet/callbacks.c diff --git a/CSharp/Platform/ENet/compress.cc b/CSharp/Platform/ENet/compress.c similarity index 100% rename from CSharp/Platform/ENet/compress.cc rename to CSharp/Platform/ENet/compress.c diff --git a/CSharp/Platform/ENet/callbacks.h b/CSharp/Platform/ENet/enet/callbacks.h similarity index 100% rename from CSharp/Platform/ENet/callbacks.h rename to CSharp/Platform/ENet/enet/callbacks.h diff --git a/CSharp/Platform/ENet/enet.h b/CSharp/Platform/ENet/enet/enet.h similarity index 100% rename from CSharp/Platform/ENet/enet.h rename to CSharp/Platform/ENet/enet/enet.h diff --git a/CSharp/Platform/ENet/list.h b/CSharp/Platform/ENet/enet/list.h similarity index 100% rename from CSharp/Platform/ENet/list.h rename to CSharp/Platform/ENet/enet/list.h diff --git a/CSharp/Platform/ENet/protocol.h b/CSharp/Platform/ENet/enet/protocol.h similarity index 100% rename from CSharp/Platform/ENet/protocol.h rename to CSharp/Platform/ENet/enet/protocol.h diff --git a/CSharp/Platform/ENet/time.h b/CSharp/Platform/ENet/enet/time.h similarity index 100% rename from CSharp/Platform/ENet/time.h rename to CSharp/Platform/ENet/enet/time.h diff --git a/CSharp/Platform/ENet/types.h b/CSharp/Platform/ENet/enet/types.h similarity index 100% rename from CSharp/Platform/ENet/types.h rename to CSharp/Platform/ENet/enet/types.h diff --git a/CSharp/Platform/ENet/unix.h b/CSharp/Platform/ENet/enet/unix.h similarity index 100% rename from CSharp/Platform/ENet/unix.h rename to CSharp/Platform/ENet/enet/unix.h diff --git a/CSharp/Platform/ENet/utility.h b/CSharp/Platform/ENet/enet/utility.h similarity index 100% rename from CSharp/Platform/ENet/utility.h rename to CSharp/Platform/ENet/enet/utility.h diff --git a/CSharp/Platform/ENet/win32.h b/CSharp/Platform/ENet/enet/win32.h similarity index 100% rename from CSharp/Platform/ENet/win32.h rename to CSharp/Platform/ENet/enet/win32.h diff --git a/CSharp/Platform/ENet/host.cc b/CSharp/Platform/ENet/host.c similarity index 100% rename from CSharp/Platform/ENet/host.cc rename to CSharp/Platform/ENet/host.c diff --git a/CSharp/Platform/ENet/list.cc b/CSharp/Platform/ENet/list.c similarity index 100% rename from CSharp/Platform/ENet/list.cc rename to CSharp/Platform/ENet/list.c diff --git a/CSharp/Platform/ENet/packet.cc b/CSharp/Platform/ENet/packet.c similarity index 100% rename from CSharp/Platform/ENet/packet.cc rename to CSharp/Platform/ENet/packet.c diff --git a/CSharp/Platform/ENet/peer.cc b/CSharp/Platform/ENet/peer.c similarity index 100% rename from CSharp/Platform/ENet/peer.cc rename to CSharp/Platform/ENet/peer.c diff --git a/CSharp/Platform/ENet/protocol.cc b/CSharp/Platform/ENet/protocol.c similarity index 100% rename from CSharp/Platform/ENet/protocol.cc rename to CSharp/Platform/ENet/protocol.c diff --git a/CSharp/Platform/ENet/unix.cc b/CSharp/Platform/ENet/unix.c similarity index 100% rename from CSharp/Platform/ENet/unix.cc rename to CSharp/Platform/ENet/unix.c diff --git a/CSharp/Platform/ENet/win32.cc b/CSharp/Platform/ENet/win32.c similarity index 100% rename from CSharp/Platform/ENet/win32.cc rename to CSharp/Platform/ENet/win32.c diff --git a/CSharp/Platform/UNet/NativeMethods.cs b/CSharp/Platform/UNet/NativeMethods.cs index 504d373650f992f7303d844adcff2156457a8851..613e1e0bc663dc73514fad586680109257b31b88 100644 --- a/CSharp/Platform/UNet/NativeMethods.cs +++ b/CSharp/Platform/UNet/NativeMethods.cs @@ -7,7 +7,7 @@ namespace UNet { public static class NativeMethods { - private const string LIB = "ENet.dll"; + private const string LIB = "ENet"; public const int ENET_PEER_PACKET_THROTTLE_SCALE = 32; public const int ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2; @@ -20,12 +20,10 @@ namespace UNet public const uint ENET_HOST_ANY = 0; public const uint ENET_HOST_BROADCAST = 0xffffffff; - [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_set_host") - ] + [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_set_host")] internal static extern int EnetAddressSetHost(ref ENetAddress address, string hostName); - [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_get_host") - ] + [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_get_host")] internal static extern int EnetAddressGetHost( ref ENetAddress address, StringBuilder hostName, uint nameLength);