diff --git a/.vs/HaoYueNet/DesignTimeBuild/.dtbcache.v2 b/.vs/HaoYueNet/DesignTimeBuild/.dtbcache.v2 index 1a45331..2bfafaa 100644 Binary files a/.vs/HaoYueNet/DesignTimeBuild/.dtbcache.v2 and b/.vs/HaoYueNet/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/HaoYueNet/FileContentIndex/264911a7-fcbf-45b9-9f01-f6b4684fb7a8.vsidx b/.vs/HaoYueNet/FileContentIndex/264911a7-fcbf-45b9-9f01-f6b4684fb7a8.vsidx deleted file mode 100644 index 69d6885..0000000 Binary files a/.vs/HaoYueNet/FileContentIndex/264911a7-fcbf-45b9-9f01-f6b4684fb7a8.vsidx and /dev/null differ diff --git a/.vs/HaoYueNet/FileContentIndex/4276406d-9cd1-4677-b724-afe7ec1c7148.vsidx b/.vs/HaoYueNet/FileContentIndex/4276406d-9cd1-4677-b724-afe7ec1c7148.vsidx new file mode 100644 index 0000000..bb9e0e9 Binary files /dev/null and b/.vs/HaoYueNet/FileContentIndex/4276406d-9cd1-4677-b724-afe7ec1c7148.vsidx differ diff --git a/.vs/HaoYueNet/FileContentIndex/52ba0b33-f7ac-464a-b93d-8478ef174812.vsidx b/.vs/HaoYueNet/FileContentIndex/52ba0b33-f7ac-464a-b93d-8478ef174812.vsidx deleted file mode 100644 index 24ac6f8..0000000 Binary files a/.vs/HaoYueNet/FileContentIndex/52ba0b33-f7ac-464a-b93d-8478ef174812.vsidx and /dev/null differ diff --git a/.vs/HaoYueNet/FileContentIndex/6a19da00-ad65-49e0-96a6-8070e9505ed2.vsidx b/.vs/HaoYueNet/FileContentIndex/6a19da00-ad65-49e0-96a6-8070e9505ed2.vsidx new file mode 100644 index 0000000..6321b4c Binary files /dev/null and b/.vs/HaoYueNet/FileContentIndex/6a19da00-ad65-49e0-96a6-8070e9505ed2.vsidx differ diff --git a/.vs/HaoYueNet/FileContentIndex/d5b6b639-3bec-437c-8aa1-0d19e483a59a.vsidx b/.vs/HaoYueNet/FileContentIndex/d5b6b639-3bec-437c-8aa1-0d19e483a59a.vsidx new file mode 100644 index 0000000..9cd0b95 Binary files /dev/null and b/.vs/HaoYueNet/FileContentIndex/d5b6b639-3bec-437c-8aa1-0d19e483a59a.vsidx differ diff --git a/.vs/HaoYueNet/FileContentIndex/e611adbc-4f6c-4e85-99e1-a2450d1969e8.vsidx b/.vs/HaoYueNet/FileContentIndex/e611adbc-4f6c-4e85-99e1-a2450d1969e8.vsidx deleted file mode 100644 index 04a5321..0000000 Binary files a/.vs/HaoYueNet/FileContentIndex/e611adbc-4f6c-4e85-99e1-a2450d1969e8.vsidx and /dev/null differ diff --git a/.vs/HaoYueNet/FileContentIndex/f605dade-673c-4f67-ac26-a3f4c502f3b4.vsidx b/.vs/HaoYueNet/FileContentIndex/f605dade-673c-4f67-ac26-a3f4c502f3b4.vsidx new file mode 100644 index 0000000..eaacc07 Binary files /dev/null and b/.vs/HaoYueNet/FileContentIndex/f605dade-673c-4f67-ac26-a3f4c502f3b4.vsidx differ diff --git a/.vs/HaoYueNet/FileContentIndex/ff9b6839-1a82-4879-9ad5-c21bf2a1418b.vsidx b/.vs/HaoYueNet/FileContentIndex/ff9b6839-1a82-4879-9ad5-c21bf2a1418b.vsidx deleted file mode 100644 index 2618334..0000000 Binary files a/.vs/HaoYueNet/FileContentIndex/ff9b6839-1a82-4879-9ad5-c21bf2a1418b.vsidx and /dev/null differ diff --git a/.vs/HaoYueNet/v17/.futdcache.v2 b/.vs/HaoYueNet/v17/.futdcache.v2 index 2ccc4fc..57a6f56 100644 Binary files a/.vs/HaoYueNet/v17/.futdcache.v2 and b/.vs/HaoYueNet/v17/.futdcache.v2 differ diff --git a/.vs/ProjectEvaluation/haoyuenet.metadata.v5.2 b/.vs/ProjectEvaluation/haoyuenet.metadata.v5.2 index 9abec33..ce6c4a4 100644 Binary files a/.vs/ProjectEvaluation/haoyuenet.metadata.v5.2 and b/.vs/ProjectEvaluation/haoyuenet.metadata.v5.2 differ diff --git a/.vs/ProjectEvaluation/haoyuenet.projects.v5.2 b/.vs/ProjectEvaluation/haoyuenet.projects.v5.2 index 93cb95e..c299a61 100644 Binary files a/.vs/ProjectEvaluation/haoyuenet.projects.v5.2 and b/.vs/ProjectEvaluation/haoyuenet.projects.v5.2 differ diff --git a/HaoYueNet.sln b/HaoYueNet.sln index c0ce52c..ae173fb 100644 --- a/HaoYueNet.sln +++ b/HaoYueNet.sln @@ -11,12 +11,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HaoYueNet.ServerNetwork", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HaoYueNet.ClientNetwork", "NetLib\HaoYueNet.ClientNetwork\HaoYueNet.ClientNetwork.csproj", "{696F6AAE-2D41-48F7-8FCD-E95CFE2A6519}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleClient", "Simple\SimpleClient\SimpleClient.csproj", "{C558ACA4-E59E-4F4D-94B7-2B78DA272CF3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleServer", "Simple\SimpleServer\SimpleServer.csproj", "{5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HaoYueNet.ClientNetworkNet4x", "NetLib\HaoYueNet.ClientNetworkNet4x\HaoYueNet.ClientNetworkNet4x.csproj", "{A741610F-29B9-4F0E-9A3D-0B3E1318F031}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServerCore", "Simple\ServerCore\ServerCore.csproj", "{3F26CB3D-ECD1-4D50-8AE6-EB6762CBACF6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Protobuf", "Simple\Protobuf\Protobuf.csproj", "{E5AE46D9-D809-4E87-8ADD-B1BD28ED60E9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "Simple\Server\Server.csproj", "{3F52D1D0-4B1E-4819-9AB3-A770DD5C505D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientCore", "Simple\ClientCore\ClientCore.csproj", "{99E54CE5-4EF6-4441-9F40-8FDE8229041E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client-Cli", "Simple\Client-Cli\Client-Cli.csproj", "{45FBC25D-9EC5-4C8E-A979-005F04CE76AB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -31,18 +37,30 @@ Global {696F6AAE-2D41-48F7-8FCD-E95CFE2A6519}.Debug|Any CPU.Build.0 = Debug|Any CPU {696F6AAE-2D41-48F7-8FCD-E95CFE2A6519}.Release|Any CPU.ActiveCfg = Release|Any CPU {696F6AAE-2D41-48F7-8FCD-E95CFE2A6519}.Release|Any CPU.Build.0 = Release|Any CPU - {C558ACA4-E59E-4F4D-94B7-2B78DA272CF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C558ACA4-E59E-4F4D-94B7-2B78DA272CF3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C558ACA4-E59E-4F4D-94B7-2B78DA272CF3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C558ACA4-E59E-4F4D-94B7-2B78DA272CF3}.Release|Any CPU.Build.0 = Release|Any CPU - {5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Release|Any CPU.Build.0 = Release|Any CPU {A741610F-29B9-4F0E-9A3D-0B3E1318F031}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A741610F-29B9-4F0E-9A3D-0B3E1318F031}.Debug|Any CPU.Build.0 = Debug|Any CPU {A741610F-29B9-4F0E-9A3D-0B3E1318F031}.Release|Any CPU.ActiveCfg = Release|Any CPU {A741610F-29B9-4F0E-9A3D-0B3E1318F031}.Release|Any CPU.Build.0 = Release|Any CPU + {3F26CB3D-ECD1-4D50-8AE6-EB6762CBACF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3F26CB3D-ECD1-4D50-8AE6-EB6762CBACF6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3F26CB3D-ECD1-4D50-8AE6-EB6762CBACF6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3F26CB3D-ECD1-4D50-8AE6-EB6762CBACF6}.Release|Any CPU.Build.0 = Release|Any CPU + {E5AE46D9-D809-4E87-8ADD-B1BD28ED60E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E5AE46D9-D809-4E87-8ADD-B1BD28ED60E9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E5AE46D9-D809-4E87-8ADD-B1BD28ED60E9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E5AE46D9-D809-4E87-8ADD-B1BD28ED60E9}.Release|Any CPU.Build.0 = Release|Any CPU + {3F52D1D0-4B1E-4819-9AB3-A770DD5C505D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3F52D1D0-4B1E-4819-9AB3-A770DD5C505D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3F52D1D0-4B1E-4819-9AB3-A770DD5C505D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3F52D1D0-4B1E-4819-9AB3-A770DD5C505D}.Release|Any CPU.Build.0 = Release|Any CPU + {99E54CE5-4EF6-4441-9F40-8FDE8229041E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99E54CE5-4EF6-4441-9F40-8FDE8229041E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99E54CE5-4EF6-4441-9F40-8FDE8229041E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99E54CE5-4EF6-4441-9F40-8FDE8229041E}.Release|Any CPU.Build.0 = Release|Any CPU + {45FBC25D-9EC5-4C8E-A979-005F04CE76AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {45FBC25D-9EC5-4C8E-A979-005F04CE76AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {45FBC25D-9EC5-4C8E-A979-005F04CE76AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {45FBC25D-9EC5-4C8E-A979-005F04CE76AB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -50,9 +68,12 @@ Global GlobalSection(NestedProjects) = preSolution {22ED65D3-E2FB-49E4-BDF5-EB2A70774C2E} = {D0066C06-A89A-4E05-80E0-D8232FB0FF3C} {696F6AAE-2D41-48F7-8FCD-E95CFE2A6519} = {D0066C06-A89A-4E05-80E0-D8232FB0FF3C} - {C558ACA4-E59E-4F4D-94B7-2B78DA272CF3} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29} - {5559B94A-DA9E-4CF7-B799-2BCAA1F11F49} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29} {A741610F-29B9-4F0E-9A3D-0B3E1318F031} = {D0066C06-A89A-4E05-80E0-D8232FB0FF3C} + {3F26CB3D-ECD1-4D50-8AE6-EB6762CBACF6} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29} + {E5AE46D9-D809-4E87-8ADD-B1BD28ED60E9} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29} + {3F52D1D0-4B1E-4819-9AB3-A770DD5C505D} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29} + {99E54CE5-4EF6-4441-9F40-8FDE8229041E} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29} + {45FBC25D-9EC5-4C8E-A979-005F04CE76AB} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {22107F03-013F-4871-AC8E-F082694E2679} diff --git a/NetLib/HaoYueNet.ClientNetwork/Properties/PublishProfiles/FolderProfile.pubxml b/NetLib/HaoYueNet.ClientNetwork/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..34e4f3a --- /dev/null +++ b/NetLib/HaoYueNet.ClientNetwork/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,13 @@ + + + + + Release + Any CPU + bin\Release\net7.0\publish\ + FileSystem + <_TargetId>Folder + + \ No newline at end of file diff --git a/NetLib/HaoYueNet.ServerNetwork/Properties/PublishProfiles/FolderProfile.pubxml b/NetLib/HaoYueNet.ServerNetwork/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..34e4f3a --- /dev/null +++ b/NetLib/HaoYueNet.ServerNetwork/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,13 @@ + + + + + Release + Any CPU + bin\Release\net7.0\publish\ + FileSystem + <_TargetId>Folder + + \ No newline at end of file diff --git a/ProtobufCore/out/CS/ProtobufAuth.cs b/ProtobufCore/out/CS/ProtobufAuth.cs new file mode 100644 index 0000000..2ab2650 --- /dev/null +++ b/ProtobufCore/out/CS/ProtobufAuth.cs @@ -0,0 +1,1145 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: protobuf_Auth.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace AxibugProtobuf { + + /// Holder for reflection information generated from protobuf_Auth.proto + public static partial class ProtobufAuthReflection { + + #region Descriptor + /// File descriptor for protobuf_Auth.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ProtobufAuthReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChNwcm90b2J1Zl9BdXRoLnByb3RvEg5BeGlidWdQcm90b2J1ZiKRAQoOUHJv", + "dG9idWZfTG9naW4SLAoJbG9naW5UeXBlGAEgASgOMhkuQXhpYnVnUHJvdG9i", + "dWYuTG9naW5UeXBlEi4KCmRldmljZVR5cGUYAiABKA4yGi5BeGlidWdQcm90", + "b2J1Zi5EZXZpY2VUeXBlEg8KB0FjY291bnQYAyABKAkSEAoIUGFzc3dvcmQY", + "BCABKAkifwoTUHJvdG9idWZfTG9naW5fUkVTUBINCgVUb2tlbhgBIAEoCRIV", + "Cg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoGU3Rh", + "dHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0dXMi", + "IwoQUHJvdG9idWZfQ2hhdE1zZxIPCgdDaGF0TXNnGAEgASgJIkgKFVByb3Rv", + "YnVmX0NoYXRNc2dfUkVTUBIQCghOaWNrTmFtZRgBIAEoCRIPCgdDaGF0TXNn", + "GAIgASgJEgwKBERhdGUYAyABKAMqPQoJQ29tbWFuZElEEg4KCkNNRF9ERUZB", + "VUwQABIOCglDTURfTE9HSU4Q0Q8SEAoLQ01EX0NIQVRNU0cQoR8qKwoJRXJy", + "b3JDb2RlEhAKDEVSUk9SX0RFRkFVTBAAEgwKCEVSUk9SX09LEAEqPgoJTG9n", + "aW5UeXBlEg8KC0Jhc2VEZWZhdWx0EAASDgoKSGFvWXVlQXV0aBABEgcKA0JG", + "MxADEgcKA0JGNBAEKksKCkRldmljZVR5cGUSFgoSRGV2aWNlVHlwZV9EZWZh", + "dWx0EAASBgoCUEMQARILCgdBbmRyb2lkEAISBwoDSU9TEAMSBwoDUFNWEAQq", + "TgoRTG9naW5SZXN1bHRTdGF0dXMSIQodTG9naW5SZXN1bHRTdGF0dXNfQmFz", + "ZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFiBnByb3Rv", + "Mw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login), global::AxibugProtobuf.Protobuf_Login.Parser, new[]{ "LoginType", "DeviceType", "Account", "Password" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "Token", "LastLoginDate", "RegDate", "Status" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg), global::AxibugProtobuf.Protobuf_ChatMsg.Parser, new[]{ "ChatMsg" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg_RESP), global::AxibugProtobuf.Protobuf_ChatMsg_RESP.Parser, new[]{ "NickName", "ChatMsg", "Date" }, null, null, null, null) + })); + } + #endregion + + } + #region Enums + public enum CommandID { + /// + ///缺省不使用 + /// + [pbr::OriginalName("CMD_DEFAUL")] CmdDefaul = 0, + /// + ///登录上行 | 下行 对应 Protobuf_Login | Protobuf_Login_RESP + /// + [pbr::OriginalName("CMD_LOGIN")] CmdLogin = 2001, + /// + ///登录上行 | 下行 对应 Protobuf_ChatMsg | Protobuf_ChatMsg_RESP + /// + [pbr::OriginalName("CMD_CHATMSG")] CmdChatmsg = 4001, + } + + public enum ErrorCode { + /// + ///缺省不使用 + /// + [pbr::OriginalName("ERROR_DEFAUL")] ErrorDefaul = 0, + /// + ///成功 + /// + [pbr::OriginalName("ERROR_OK")] ErrorOk = 1, + } + + public enum LoginType { + /// + ///缺省不使用 + /// + [pbr::OriginalName("BaseDefault")] BaseDefault = 0, + [pbr::OriginalName("HaoYueAuth")] HaoYueAuth = 1, + [pbr::OriginalName("BF3")] Bf3 = 3, + [pbr::OriginalName("BF4")] Bf4 = 4, + } + + public enum DeviceType { + /// + ///缺省不使用 + /// + [pbr::OriginalName("DeviceType_Default")] Default = 0, + [pbr::OriginalName("PC")] Pc = 1, + [pbr::OriginalName("Android")] Android = 2, + [pbr::OriginalName("IOS")] Ios = 3, + [pbr::OriginalName("PSV")] Psv = 4, + } + + public enum LoginResultStatus { + /// + ///缺省不使用 + /// + [pbr::OriginalName("LoginResultStatus_BaseDefault")] BaseDefault = 0, + [pbr::OriginalName("OK")] Ok = 1, + [pbr::OriginalName("AccountErr")] AccountErr = 2, + } + + #endregion + + #region Messages + /// + ///登录数据上行 + /// + public sealed partial class Protobuf_Login : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_Login()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::AxibugProtobuf.ProtobufAuthReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login(Protobuf_Login other) : this() { + loginType_ = other.loginType_; + deviceType_ = other.deviceType_; + account_ = other.account_; + password_ = other.password_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login Clone() { + return new Protobuf_Login(this); + } + + /// Field number for the "loginType" field. + public const int LoginTypeFieldNumber = 1; + private global::AxibugProtobuf.LoginType loginType_ = global::AxibugProtobuf.LoginType.BaseDefault; + /// + ///登录操作类型 [0]皓月通行证 [3] 皓月BF3 [4] 皓月BF4 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::AxibugProtobuf.LoginType LoginType { + get { return loginType_; } + set { + loginType_ = value; + } + } + + /// Field number for the "deviceType" field. + public const int DeviceTypeFieldNumber = 2; + private global::AxibugProtobuf.DeviceType deviceType_ = global::AxibugProtobuf.DeviceType.Default; + /// + ///设备类型 [0]PC [1]AndroidPad预留 [3]IPad预留 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::AxibugProtobuf.DeviceType DeviceType { + get { return deviceType_; } + set { + deviceType_ = value; + } + } + + /// Field number for the "Account" field. + public const int AccountFieldNumber = 3; + private string account_ = ""; + /// + ///用户名 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Account { + get { return account_; } + set { + account_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Password" field. + public const int PasswordFieldNumber = 4; + private string password_ = ""; + /// + ///密码 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Password { + get { return password_; } + set { + password_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Protobuf_Login); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Protobuf_Login other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LoginType != other.LoginType) return false; + if (DeviceType != other.DeviceType) return false; + if (Account != other.Account) return false; + if (Password != other.Password) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (LoginType != global::AxibugProtobuf.LoginType.BaseDefault) hash ^= LoginType.GetHashCode(); + if (DeviceType != global::AxibugProtobuf.DeviceType.Default) hash ^= DeviceType.GetHashCode(); + if (Account.Length != 0) hash ^= Account.GetHashCode(); + if (Password.Length != 0) hash ^= Password.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LoginType != global::AxibugProtobuf.LoginType.BaseDefault) { + output.WriteRawTag(8); + output.WriteEnum((int) LoginType); + } + if (DeviceType != global::AxibugProtobuf.DeviceType.Default) { + output.WriteRawTag(16); + output.WriteEnum((int) DeviceType); + } + if (Account.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Account); + } + if (Password.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Password); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LoginType != global::AxibugProtobuf.LoginType.BaseDefault) { + output.WriteRawTag(8); + output.WriteEnum((int) LoginType); + } + if (DeviceType != global::AxibugProtobuf.DeviceType.Default) { + output.WriteRawTag(16); + output.WriteEnum((int) DeviceType); + } + if (Account.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Account); + } + if (Password.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Password); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (LoginType != global::AxibugProtobuf.LoginType.BaseDefault) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LoginType); + } + if (DeviceType != global::AxibugProtobuf.DeviceType.Default) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) DeviceType); + } + if (Account.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Account); + } + if (Password.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Password); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Protobuf_Login other) { + if (other == null) { + return; + } + if (other.LoginType != global::AxibugProtobuf.LoginType.BaseDefault) { + LoginType = other.LoginType; + } + if (other.DeviceType != global::AxibugProtobuf.DeviceType.Default) { + DeviceType = other.DeviceType; + } + if (other.Account.Length != 0) { + Account = other.Account; + } + if (other.Password.Length != 0) { + Password = other.Password; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + LoginType = (global::AxibugProtobuf.LoginType) input.ReadEnum(); + break; + } + case 16: { + DeviceType = (global::AxibugProtobuf.DeviceType) input.ReadEnum(); + break; + } + case 26: { + Account = input.ReadString(); + break; + } + case 34: { + Password = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + LoginType = (global::AxibugProtobuf.LoginType) input.ReadEnum(); + break; + } + case 16: { + DeviceType = (global::AxibugProtobuf.DeviceType) input.ReadEnum(); + break; + } + case 26: { + Account = input.ReadString(); + break; + } + case 34: { + Password = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + ///登录数据下行 + /// + public sealed partial class Protobuf_Login_RESP : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_Login_RESP()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::AxibugProtobuf.ProtobufAuthReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login_RESP() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login_RESP(Protobuf_Login_RESP other) : this() { + token_ = other.token_; + lastLoginDate_ = other.lastLoginDate_; + regDate_ = other.regDate_; + status_ = other.status_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login_RESP Clone() { + return new Protobuf_Login_RESP(this); + } + + /// Field number for the "Token" field. + public const int TokenFieldNumber = 1; + private string token_ = ""; + /// + ///登录凭据 (本次登录之后,所有业务请求凭据,需要存储在内存中) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Token { + get { return token_; } + set { + token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastLoginDate" field. + public const int LastLoginDateFieldNumber = 2; + private string lastLoginDate_ = ""; + /// + ///上次登录时间(只用于呈现的字符串,若界面需求需要) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastLoginDate { + get { return lastLoginDate_; } + set { + lastLoginDate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RegDate" field. + public const int RegDateFieldNumber = 3; + private string regDate_ = ""; + /// + ///注册时间(只用于呈现的字符串,若界面需求需要) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RegDate { + get { return regDate_; } + set { + regDate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Status" field. + public const int StatusFieldNumber = 4; + private global::AxibugProtobuf.LoginResultStatus status_ = global::AxibugProtobuf.LoginResultStatus.BaseDefault; + /// + ///账号状态 (预留) [1]正常[0]被禁封 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::AxibugProtobuf.LoginResultStatus Status { + get { return status_; } + set { + status_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Protobuf_Login_RESP); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Protobuf_Login_RESP other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Token != other.Token) return false; + if (LastLoginDate != other.LastLoginDate) return false; + if (RegDate != other.RegDate) return false; + if (Status != other.Status) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Token.Length != 0) hash ^= Token.GetHashCode(); + if (LastLoginDate.Length != 0) hash ^= LastLoginDate.GetHashCode(); + if (RegDate.Length != 0) hash ^= RegDate.GetHashCode(); + if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) hash ^= Status.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Token.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Token); + } + if (LastLoginDate.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastLoginDate); + } + if (RegDate.Length != 0) { + output.WriteRawTag(26); + output.WriteString(RegDate); + } + if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) { + output.WriteRawTag(32); + output.WriteEnum((int) Status); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Token.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Token); + } + if (LastLoginDate.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastLoginDate); + } + if (RegDate.Length != 0) { + output.WriteRawTag(26); + output.WriteString(RegDate); + } + if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) { + output.WriteRawTag(32); + output.WriteEnum((int) Status); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Token.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); + } + if (LastLoginDate.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastLoginDate); + } + if (RegDate.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RegDate); + } + if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Status); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Protobuf_Login_RESP other) { + if (other == null) { + return; + } + if (other.Token.Length != 0) { + Token = other.Token; + } + if (other.LastLoginDate.Length != 0) { + LastLoginDate = other.LastLoginDate; + } + if (other.RegDate.Length != 0) { + RegDate = other.RegDate; + } + if (other.Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) { + Status = other.Status; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Token = input.ReadString(); + break; + } + case 18: { + LastLoginDate = input.ReadString(); + break; + } + case 26: { + RegDate = input.ReadString(); + break; + } + case 32: { + Status = (global::AxibugProtobuf.LoginResultStatus) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Token = input.ReadString(); + break; + } + case 18: { + LastLoginDate = input.ReadString(); + break; + } + case 26: { + RegDate = input.ReadString(); + break; + } + case 32: { + Status = (global::AxibugProtobuf.LoginResultStatus) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + /// + ///聊天 上行 + /// + public sealed partial class Protobuf_ChatMsg : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_ChatMsg()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::AxibugProtobuf.ProtobufAuthReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg(Protobuf_ChatMsg other) : this() { + chatMsg_ = other.chatMsg_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg Clone() { + return new Protobuf_ChatMsg(this); + } + + /// Field number for the "ChatMsg" field. + public const int ChatMsgFieldNumber = 1; + private string chatMsg_ = ""; + /// + ///消息 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ChatMsg { + get { return chatMsg_; } + set { + chatMsg_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Protobuf_ChatMsg); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Protobuf_ChatMsg other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ChatMsg != other.ChatMsg) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ChatMsg.Length != 0) hash ^= ChatMsg.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ChatMsg.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ChatMsg); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ChatMsg.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ChatMsg); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ChatMsg.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ChatMsg); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Protobuf_ChatMsg other) { + if (other == null) { + return; + } + if (other.ChatMsg.Length != 0) { + ChatMsg = other.ChatMsg; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ChatMsg = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ChatMsg = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + ///聊天 下行 + /// + public sealed partial class Protobuf_ChatMsg_RESP : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_ChatMsg_RESP()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::AxibugProtobuf.ProtobufAuthReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg_RESP() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg_RESP(Protobuf_ChatMsg_RESP other) : this() { + nickName_ = other.nickName_; + chatMsg_ = other.chatMsg_; + date_ = other.date_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg_RESP Clone() { + return new Protobuf_ChatMsg_RESP(this); + } + + /// Field number for the "NickName" field. + public const int NickNameFieldNumber = 1; + private string nickName_ = ""; + /// + ///昵称 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NickName { + get { return nickName_; } + set { + nickName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ChatMsg" field. + public const int ChatMsgFieldNumber = 2; + private string chatMsg_ = ""; + /// + ///消息 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ChatMsg { + get { return chatMsg_; } + set { + chatMsg_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Date" field. + public const int DateFieldNumber = 3; + private long date_; + /// + ///消息 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Date { + get { return date_; } + set { + date_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Protobuf_ChatMsg_RESP); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Protobuf_ChatMsg_RESP other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (NickName != other.NickName) return false; + if (ChatMsg != other.ChatMsg) return false; + if (Date != other.Date) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (NickName.Length != 0) hash ^= NickName.GetHashCode(); + if (ChatMsg.Length != 0) hash ^= ChatMsg.GetHashCode(); + if (Date != 0L) hash ^= Date.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (NickName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NickName); + } + if (ChatMsg.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ChatMsg); + } + if (Date != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Date); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NickName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NickName); + } + if (ChatMsg.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ChatMsg); + } + if (Date != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Date); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (NickName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NickName); + } + if (ChatMsg.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ChatMsg); + } + if (Date != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Date); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Protobuf_ChatMsg_RESP other) { + if (other == null) { + return; + } + if (other.NickName.Length != 0) { + NickName = other.NickName; + } + if (other.ChatMsg.Length != 0) { + ChatMsg = other.ChatMsg; + } + if (other.Date != 0L) { + Date = other.Date; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + NickName = input.ReadString(); + break; + } + case 18: { + ChatMsg = input.ReadString(); + break; + } + case 24: { + Date = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + NickName = input.ReadString(); + break; + } + case 18: { + ChatMsg = input.ReadString(); + break; + } + case 24: { + Date = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/ProtobufCore/proto/protobuf_Auth.proto b/ProtobufCore/proto/protobuf_Auth.proto new file mode 100644 index 0000000..5298c59 --- /dev/null +++ b/ProtobufCore/proto/protobuf_Auth.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; +package AxibugProtobuf; +option optimize_for = SPEED; + +enum CommandID +{ + CMD_DEFAUL = 0;//缺省不使用 + + CMD_LOGIN = 2001; //登录上行 | 下行 对应 Protobuf_Login | Protobuf_Login_RESP + + CMD_CHATMSG = 4001; //登录上行 | 下行 对应 Protobuf_ChatMsg | Protobuf_ChatMsg_RESP +} + +enum ErrorCode +{ + ERROR_DEFAUL = 0;//缺省不使用 + ERROR_OK = 1; //成功 +} + +enum LoginType +{ + BaseDefault = 0;//缺省不使用 + HaoYueAuth = 1; + BF3 = 3; + BF4 = 4; +} + +enum DeviceType +{ + DeviceType_Default = 0;//缺省不使用 + PC = 1; + Android = 2; + IOS = 3; + PSV = 4; +} + +enum LoginResultStatus +{ + LoginResultStatus_BaseDefault = 0;//缺省不使用 + OK = 1; + AccountErr = 2; +} + +//登录数据上行 +message Protobuf_Login +{ + LoginType loginType = 1;//登录操作类型 [0]皓月通行证 [3] 皓月BF3 [4] 皓月BF4 + DeviceType deviceType = 2;//设备类型 [0]PC [1]AndroidPad预留 [3]IPad预留 + string Account = 3;//用户名 + string Password = 4;//密码 +} + +//登录数据下行 +message Protobuf_Login_RESP +{ + string Token = 1;//登录凭据 (本次登录之后,所有业务请求凭据,需要存储在内存中) + string LastLoginDate = 2;//上次登录时间(只用于呈现的字符串,若界面需求需要) + string RegDate = 3;//注册时间(只用于呈现的字符串,若界面需求需要) + LoginResultStatus Status = 4;//账号状态 (预留) [1]正常[0]被禁封 +} + + +//聊天 上行 +message Protobuf_ChatMsg +{ + string ChatMsg = 1;//消息 +} + +//聊天 下行 +message Protobuf_ChatMsg_RESP +{ + string NickName = 1;//昵称 + string ChatMsg = 2;//消息 + int64 Date = 3;//消息 +} \ No newline at end of file diff --git a/ProtobufCore/proto2cpp.exe b/ProtobufCore/proto2cpp.exe deleted file mode 100644 index 04e976a..0000000 Binary files a/ProtobufCore/proto2cpp.exe and /dev/null differ diff --git a/ProtobufCore/update_build.bat b/ProtobufCore/update_build.bat deleted file mode 100644 index 02b1fe1..0000000 --- a/ProtobufCore/update_build.bat +++ /dev/null @@ -1,6 +0,0 @@ -call proto2cpp.exe protoc.exe -cd.. -set "protopath=%cd%" -cd new_server_proto -copy %cd%\out\cpp\ %protopath%\newhxserver\ProtocolSrc\ -pause \ No newline at end of file diff --git a/Simple/Client-Cli/Client-Cli.csproj b/Simple/Client-Cli/Client-Cli.csproj new file mode 100644 index 0000000..7d56365 --- /dev/null +++ b/Simple/Client-Cli/Client-Cli.csproj @@ -0,0 +1,15 @@ + + + + Exe + net7.0 + Client_Cli + enable + enable + + + + + + + diff --git a/Simple/Client-Cli/Program.cs b/Simple/Client-Cli/Program.cs new file mode 100644 index 0000000..30e119f --- /dev/null +++ b/Simple/Client-Cli/Program.cs @@ -0,0 +1,41 @@ +using ClientCore; +App.Init("127.0.0.1", 23846); + +//注册 +App.chat.OnChatMsg += OnChatMsg; + +while (true) +{ + string CommandStr = Console.ReadLine(); + string Command = ""; + Command = ((CommandStr.IndexOf(" ") <= 0) ? CommandStr : CommandStr.Substring(0, CommandStr.IndexOf(" "))); + string[] CmdArr = CommandStr.Split(' '); + switch (Command) + { + case "login": + case "l": + if (CmdArr.Length < 2) + { + Console.WriteLine("缺省用户名"); + return; + } + App.login.Login(CmdArr[1]); + break; + case "say": + if (CmdArr.Length < 2) + { + Console.WriteLine("缺省参数"); + return; + } + App.chat.SendChatMsg(CmdArr[1]); + break; + default: + Console.WriteLine("未知命令" + CommandStr); + break; + } +} + +void OnChatMsg(string str1, string str2) +{ + Console.WriteLine($"[Chat]{str1}:{str2}"); +} \ No newline at end of file diff --git a/Simple/ClientCore/App.cs b/Simple/ClientCore/App.cs new file mode 100644 index 0000000..c2567bc --- /dev/null +++ b/Simple/ClientCore/App.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ClientCore.Manager; +using ClientCore.Network; + +namespace ClientCore +{ + public class App + { + public static string TokenStr; + public static long RID = -1; + public static string IP; + public static int Port; + public static NetworkHelper networkHelper; + public static AppLogin login; + public static AppChat chat; + + public static void Init(string IP, int port) + { + networkHelper = new NetworkHelper(); + login = new AppLogin(); + chat = new AppChat(); + networkHelper.Init(IP, port); + } + } + + +} \ No newline at end of file diff --git a/Simple/SimpleClient/SimpleClient.csproj b/Simple/ClientCore/ClientCore.csproj similarity index 58% rename from Simple/SimpleClient/SimpleClient.csproj rename to Simple/ClientCore/ClientCore.csproj index 9459fbb..c3fefa8 100644 --- a/Simple/SimpleClient/SimpleClient.csproj +++ b/Simple/ClientCore/ClientCore.csproj @@ -1,23 +1,14 @@ - + - Exe net7.0 enable enable - - - - - - - - - + diff --git a/Simple/ClientCore/Event/DelegateClass.cs b/Simple/ClientCore/Event/DelegateClass.cs new file mode 100644 index 0000000..3c972cb --- /dev/null +++ b/Simple/ClientCore/Event/DelegateClass.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static HaoYueNet.ClientNetwork.NetworkHelperCore; + +namespace ClientCore.Event +{ + public class DelegateClass + { + public delegate void dg_Str(string Msg); + public delegate void dg_Str_Str(string Str1, string Str2); + } +} diff --git a/Simple/ClientCore/Manager/AppChat.cs b/Simple/ClientCore/Manager/AppChat.cs new file mode 100644 index 0000000..8e5533b --- /dev/null +++ b/Simple/ClientCore/Manager/AppChat.cs @@ -0,0 +1,28 @@ +using AxibugProtobuf; +using ClientCore.Network; +using System.Net.Sockets; +using static ClientCore.Event.DelegateClass; +using static HaoYueNet.ClientNetwork.NetworkHelperCore; + +namespace ClientCore.Manager +{ + public class AppChat + { + public event dg_Str_Str OnChatMsg; + + public void SendChatMsg(string ChatMsg) + { + Protobuf_ChatMsg msg = new Protobuf_ChatMsg() + { + ChatMsg = ChatMsg, + }; + App.networkHelper.SendToServer((int)CommandID.CmdChatmsg, NetBase.Serizlize(msg)); + } + + public void RecvChatMsg(byte[] reqData) + { + Protobuf_ChatMsg_RESP msg = NetBase.DeSerizlize(reqData); + OnChatMsg(msg.NickName, msg.ChatMsg); + } + } +} diff --git a/Simple/ClientCore/Manager/AppLogin.cs b/Simple/ClientCore/Manager/AppLogin.cs new file mode 100644 index 0000000..e2529d7 --- /dev/null +++ b/Simple/ClientCore/Manager/AppLogin.cs @@ -0,0 +1,18 @@ +using AxibugProtobuf; +using ClientCore.Network; + +namespace ClientCore.Manager +{ + public class AppLogin + { + public void Login(string Account) + { + Protobuf_Login msg = new Protobuf_Login() + { + LoginType = 0, + Account = Account, + }; + App.networkHelper.SendToServer((int)CommandID.CmdLogin, NetBase.Serizlize(msg)); + } + } +} diff --git a/Simple/SimpleClient/Network/NetBase.cs b/Simple/ClientCore/Network/NetBase.cs similarity index 75% rename from Simple/SimpleClient/Network/NetBase.cs rename to Simple/ClientCore/Network/NetBase.cs index dbc2f7f..c760407 100644 --- a/Simple/SimpleClient/Network/NetBase.cs +++ b/Simple/ClientCore/Network/NetBase.cs @@ -1,11 +1,6 @@ using Google.Protobuf; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace SimpleClient +namespace ClientCore.Network { public static class NetBase { diff --git a/Simple/SimpleClient/Network/NetworkHelper.cs b/Simple/ClientCore/Network/NetworkHelper.cs similarity index 88% rename from Simple/SimpleClient/Network/NetworkHelper.cs rename to Simple/ClientCore/Network/NetworkHelper.cs index 72b0c16..39f4efb 100644 --- a/Simple/SimpleClient/Network/NetworkHelper.cs +++ b/Simple/ClientCore/Network/NetworkHelper.cs @@ -1,11 +1,12 @@ -using HaoYueNet.ClientNetwork; +using AxibugProtobuf; +using HaoYueNet.ClientNetwork; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SimpleClient +namespace ClientCore.Network { /// /// 继承网络库,以支持网络功能 @@ -52,12 +53,13 @@ namespace SimpleClient public void GetDataCallBack(int CMDID, int ERRCODE, byte[] data) { NetworkDeBugLog("收到消息 CMDID =>" + CMDID + " ERRCODE =>" + ERRCODE + " 数据长度=>" + data.Length); - try { //根据协议ID走不同逻辑 - switch (CMDID) + switch ((CommandID)CMDID) { + case CommandID.CmdLogin: break; + case CommandID.CmdChatmsg: App.chat.RecvChatMsg(data); break; } } catch (Exception ex) diff --git a/Simple/Protobuf/Protobuf.csproj b/Simple/Protobuf/Protobuf.csproj new file mode 100644 index 0000000..c12031c --- /dev/null +++ b/Simple/Protobuf/Protobuf.csproj @@ -0,0 +1,15 @@ + + + + net7.0 + enable + enable + + + + + ..\..\NetLib\Google.Protobuf.dll + + + + diff --git a/Simple/Protobuf/ProtobufAuth.cs b/Simple/Protobuf/ProtobufAuth.cs new file mode 100644 index 0000000..2ab2650 --- /dev/null +++ b/Simple/Protobuf/ProtobufAuth.cs @@ -0,0 +1,1145 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: protobuf_Auth.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace AxibugProtobuf { + + /// Holder for reflection information generated from protobuf_Auth.proto + public static partial class ProtobufAuthReflection { + + #region Descriptor + /// File descriptor for protobuf_Auth.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ProtobufAuthReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChNwcm90b2J1Zl9BdXRoLnByb3RvEg5BeGlidWdQcm90b2J1ZiKRAQoOUHJv", + "dG9idWZfTG9naW4SLAoJbG9naW5UeXBlGAEgASgOMhkuQXhpYnVnUHJvdG9i", + "dWYuTG9naW5UeXBlEi4KCmRldmljZVR5cGUYAiABKA4yGi5BeGlidWdQcm90", + "b2J1Zi5EZXZpY2VUeXBlEg8KB0FjY291bnQYAyABKAkSEAoIUGFzc3dvcmQY", + "BCABKAkifwoTUHJvdG9idWZfTG9naW5fUkVTUBINCgVUb2tlbhgBIAEoCRIV", + "Cg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoGU3Rh", + "dHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0dXMi", + "IwoQUHJvdG9idWZfQ2hhdE1zZxIPCgdDaGF0TXNnGAEgASgJIkgKFVByb3Rv", + "YnVmX0NoYXRNc2dfUkVTUBIQCghOaWNrTmFtZRgBIAEoCRIPCgdDaGF0TXNn", + "GAIgASgJEgwKBERhdGUYAyABKAMqPQoJQ29tbWFuZElEEg4KCkNNRF9ERUZB", + "VUwQABIOCglDTURfTE9HSU4Q0Q8SEAoLQ01EX0NIQVRNU0cQoR8qKwoJRXJy", + "b3JDb2RlEhAKDEVSUk9SX0RFRkFVTBAAEgwKCEVSUk9SX09LEAEqPgoJTG9n", + "aW5UeXBlEg8KC0Jhc2VEZWZhdWx0EAASDgoKSGFvWXVlQXV0aBABEgcKA0JG", + "MxADEgcKA0JGNBAEKksKCkRldmljZVR5cGUSFgoSRGV2aWNlVHlwZV9EZWZh", + "dWx0EAASBgoCUEMQARILCgdBbmRyb2lkEAISBwoDSU9TEAMSBwoDUFNWEAQq", + "TgoRTG9naW5SZXN1bHRTdGF0dXMSIQodTG9naW5SZXN1bHRTdGF0dXNfQmFz", + "ZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFiBnByb3Rv", + "Mw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login), global::AxibugProtobuf.Protobuf_Login.Parser, new[]{ "LoginType", "DeviceType", "Account", "Password" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "Token", "LastLoginDate", "RegDate", "Status" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg), global::AxibugProtobuf.Protobuf_ChatMsg.Parser, new[]{ "ChatMsg" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg_RESP), global::AxibugProtobuf.Protobuf_ChatMsg_RESP.Parser, new[]{ "NickName", "ChatMsg", "Date" }, null, null, null, null) + })); + } + #endregion + + } + #region Enums + public enum CommandID { + /// + ///缺省不使用 + /// + [pbr::OriginalName("CMD_DEFAUL")] CmdDefaul = 0, + /// + ///登录上行 | 下行 对应 Protobuf_Login | Protobuf_Login_RESP + /// + [pbr::OriginalName("CMD_LOGIN")] CmdLogin = 2001, + /// + ///登录上行 | 下行 对应 Protobuf_ChatMsg | Protobuf_ChatMsg_RESP + /// + [pbr::OriginalName("CMD_CHATMSG")] CmdChatmsg = 4001, + } + + public enum ErrorCode { + /// + ///缺省不使用 + /// + [pbr::OriginalName("ERROR_DEFAUL")] ErrorDefaul = 0, + /// + ///成功 + /// + [pbr::OriginalName("ERROR_OK")] ErrorOk = 1, + } + + public enum LoginType { + /// + ///缺省不使用 + /// + [pbr::OriginalName("BaseDefault")] BaseDefault = 0, + [pbr::OriginalName("HaoYueAuth")] HaoYueAuth = 1, + [pbr::OriginalName("BF3")] Bf3 = 3, + [pbr::OriginalName("BF4")] Bf4 = 4, + } + + public enum DeviceType { + /// + ///缺省不使用 + /// + [pbr::OriginalName("DeviceType_Default")] Default = 0, + [pbr::OriginalName("PC")] Pc = 1, + [pbr::OriginalName("Android")] Android = 2, + [pbr::OriginalName("IOS")] Ios = 3, + [pbr::OriginalName("PSV")] Psv = 4, + } + + public enum LoginResultStatus { + /// + ///缺省不使用 + /// + [pbr::OriginalName("LoginResultStatus_BaseDefault")] BaseDefault = 0, + [pbr::OriginalName("OK")] Ok = 1, + [pbr::OriginalName("AccountErr")] AccountErr = 2, + } + + #endregion + + #region Messages + /// + ///登录数据上行 + /// + public sealed partial class Protobuf_Login : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_Login()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::AxibugProtobuf.ProtobufAuthReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login(Protobuf_Login other) : this() { + loginType_ = other.loginType_; + deviceType_ = other.deviceType_; + account_ = other.account_; + password_ = other.password_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login Clone() { + return new Protobuf_Login(this); + } + + /// Field number for the "loginType" field. + public const int LoginTypeFieldNumber = 1; + private global::AxibugProtobuf.LoginType loginType_ = global::AxibugProtobuf.LoginType.BaseDefault; + /// + ///登录操作类型 [0]皓月通行证 [3] 皓月BF3 [4] 皓月BF4 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::AxibugProtobuf.LoginType LoginType { + get { return loginType_; } + set { + loginType_ = value; + } + } + + /// Field number for the "deviceType" field. + public const int DeviceTypeFieldNumber = 2; + private global::AxibugProtobuf.DeviceType deviceType_ = global::AxibugProtobuf.DeviceType.Default; + /// + ///设备类型 [0]PC [1]AndroidPad预留 [3]IPad预留 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::AxibugProtobuf.DeviceType DeviceType { + get { return deviceType_; } + set { + deviceType_ = value; + } + } + + /// Field number for the "Account" field. + public const int AccountFieldNumber = 3; + private string account_ = ""; + /// + ///用户名 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Account { + get { return account_; } + set { + account_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Password" field. + public const int PasswordFieldNumber = 4; + private string password_ = ""; + /// + ///密码 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Password { + get { return password_; } + set { + password_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Protobuf_Login); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Protobuf_Login other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LoginType != other.LoginType) return false; + if (DeviceType != other.DeviceType) return false; + if (Account != other.Account) return false; + if (Password != other.Password) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (LoginType != global::AxibugProtobuf.LoginType.BaseDefault) hash ^= LoginType.GetHashCode(); + if (DeviceType != global::AxibugProtobuf.DeviceType.Default) hash ^= DeviceType.GetHashCode(); + if (Account.Length != 0) hash ^= Account.GetHashCode(); + if (Password.Length != 0) hash ^= Password.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LoginType != global::AxibugProtobuf.LoginType.BaseDefault) { + output.WriteRawTag(8); + output.WriteEnum((int) LoginType); + } + if (DeviceType != global::AxibugProtobuf.DeviceType.Default) { + output.WriteRawTag(16); + output.WriteEnum((int) DeviceType); + } + if (Account.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Account); + } + if (Password.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Password); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LoginType != global::AxibugProtobuf.LoginType.BaseDefault) { + output.WriteRawTag(8); + output.WriteEnum((int) LoginType); + } + if (DeviceType != global::AxibugProtobuf.DeviceType.Default) { + output.WriteRawTag(16); + output.WriteEnum((int) DeviceType); + } + if (Account.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Account); + } + if (Password.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Password); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (LoginType != global::AxibugProtobuf.LoginType.BaseDefault) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LoginType); + } + if (DeviceType != global::AxibugProtobuf.DeviceType.Default) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) DeviceType); + } + if (Account.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Account); + } + if (Password.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Password); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Protobuf_Login other) { + if (other == null) { + return; + } + if (other.LoginType != global::AxibugProtobuf.LoginType.BaseDefault) { + LoginType = other.LoginType; + } + if (other.DeviceType != global::AxibugProtobuf.DeviceType.Default) { + DeviceType = other.DeviceType; + } + if (other.Account.Length != 0) { + Account = other.Account; + } + if (other.Password.Length != 0) { + Password = other.Password; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + LoginType = (global::AxibugProtobuf.LoginType) input.ReadEnum(); + break; + } + case 16: { + DeviceType = (global::AxibugProtobuf.DeviceType) input.ReadEnum(); + break; + } + case 26: { + Account = input.ReadString(); + break; + } + case 34: { + Password = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + LoginType = (global::AxibugProtobuf.LoginType) input.ReadEnum(); + break; + } + case 16: { + DeviceType = (global::AxibugProtobuf.DeviceType) input.ReadEnum(); + break; + } + case 26: { + Account = input.ReadString(); + break; + } + case 34: { + Password = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + ///登录数据下行 + /// + public sealed partial class Protobuf_Login_RESP : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_Login_RESP()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::AxibugProtobuf.ProtobufAuthReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login_RESP() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login_RESP(Protobuf_Login_RESP other) : this() { + token_ = other.token_; + lastLoginDate_ = other.lastLoginDate_; + regDate_ = other.regDate_; + status_ = other.status_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_Login_RESP Clone() { + return new Protobuf_Login_RESP(this); + } + + /// Field number for the "Token" field. + public const int TokenFieldNumber = 1; + private string token_ = ""; + /// + ///登录凭据 (本次登录之后,所有业务请求凭据,需要存储在内存中) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Token { + get { return token_; } + set { + token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "LastLoginDate" field. + public const int LastLoginDateFieldNumber = 2; + private string lastLoginDate_ = ""; + /// + ///上次登录时间(只用于呈现的字符串,若界面需求需要) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string LastLoginDate { + get { return lastLoginDate_; } + set { + lastLoginDate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "RegDate" field. + public const int RegDateFieldNumber = 3; + private string regDate_ = ""; + /// + ///注册时间(只用于呈现的字符串,若界面需求需要) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RegDate { + get { return regDate_; } + set { + regDate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Status" field. + public const int StatusFieldNumber = 4; + private global::AxibugProtobuf.LoginResultStatus status_ = global::AxibugProtobuf.LoginResultStatus.BaseDefault; + /// + ///账号状态 (预留) [1]正常[0]被禁封 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::AxibugProtobuf.LoginResultStatus Status { + get { return status_; } + set { + status_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Protobuf_Login_RESP); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Protobuf_Login_RESP other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Token != other.Token) return false; + if (LastLoginDate != other.LastLoginDate) return false; + if (RegDate != other.RegDate) return false; + if (Status != other.Status) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Token.Length != 0) hash ^= Token.GetHashCode(); + if (LastLoginDate.Length != 0) hash ^= LastLoginDate.GetHashCode(); + if (RegDate.Length != 0) hash ^= RegDate.GetHashCode(); + if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) hash ^= Status.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Token.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Token); + } + if (LastLoginDate.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastLoginDate); + } + if (RegDate.Length != 0) { + output.WriteRawTag(26); + output.WriteString(RegDate); + } + if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) { + output.WriteRawTag(32); + output.WriteEnum((int) Status); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Token.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Token); + } + if (LastLoginDate.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LastLoginDate); + } + if (RegDate.Length != 0) { + output.WriteRawTag(26); + output.WriteString(RegDate); + } + if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) { + output.WriteRawTag(32); + output.WriteEnum((int) Status); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Token.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); + } + if (LastLoginDate.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LastLoginDate); + } + if (RegDate.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RegDate); + } + if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Status); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Protobuf_Login_RESP other) { + if (other == null) { + return; + } + if (other.Token.Length != 0) { + Token = other.Token; + } + if (other.LastLoginDate.Length != 0) { + LastLoginDate = other.LastLoginDate; + } + if (other.RegDate.Length != 0) { + RegDate = other.RegDate; + } + if (other.Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) { + Status = other.Status; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Token = input.ReadString(); + break; + } + case 18: { + LastLoginDate = input.ReadString(); + break; + } + case 26: { + RegDate = input.ReadString(); + break; + } + case 32: { + Status = (global::AxibugProtobuf.LoginResultStatus) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Token = input.ReadString(); + break; + } + case 18: { + LastLoginDate = input.ReadString(); + break; + } + case 26: { + RegDate = input.ReadString(); + break; + } + case 32: { + Status = (global::AxibugProtobuf.LoginResultStatus) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + /// + ///聊天 上行 + /// + public sealed partial class Protobuf_ChatMsg : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_ChatMsg()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::AxibugProtobuf.ProtobufAuthReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg(Protobuf_ChatMsg other) : this() { + chatMsg_ = other.chatMsg_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg Clone() { + return new Protobuf_ChatMsg(this); + } + + /// Field number for the "ChatMsg" field. + public const int ChatMsgFieldNumber = 1; + private string chatMsg_ = ""; + /// + ///消息 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ChatMsg { + get { return chatMsg_; } + set { + chatMsg_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Protobuf_ChatMsg); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Protobuf_ChatMsg other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ChatMsg != other.ChatMsg) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ChatMsg.Length != 0) hash ^= ChatMsg.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ChatMsg.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ChatMsg); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ChatMsg.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ChatMsg); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ChatMsg.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ChatMsg); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Protobuf_ChatMsg other) { + if (other == null) { + return; + } + if (other.ChatMsg.Length != 0) { + ChatMsg = other.ChatMsg; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ChatMsg = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ChatMsg = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + ///聊天 下行 + /// + public sealed partial class Protobuf_ChatMsg_RESP : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_ChatMsg_RESP()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::AxibugProtobuf.ProtobufAuthReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg_RESP() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg_RESP(Protobuf_ChatMsg_RESP other) : this() { + nickName_ = other.nickName_; + chatMsg_ = other.chatMsg_; + date_ = other.date_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Protobuf_ChatMsg_RESP Clone() { + return new Protobuf_ChatMsg_RESP(this); + } + + /// Field number for the "NickName" field. + public const int NickNameFieldNumber = 1; + private string nickName_ = ""; + /// + ///昵称 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string NickName { + get { return nickName_; } + set { + nickName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ChatMsg" field. + public const int ChatMsgFieldNumber = 2; + private string chatMsg_ = ""; + /// + ///消息 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ChatMsg { + get { return chatMsg_; } + set { + chatMsg_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Date" field. + public const int DateFieldNumber = 3; + private long date_; + /// + ///消息 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long Date { + get { return date_; } + set { + date_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Protobuf_ChatMsg_RESP); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Protobuf_ChatMsg_RESP other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (NickName != other.NickName) return false; + if (ChatMsg != other.ChatMsg) return false; + if (Date != other.Date) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (NickName.Length != 0) hash ^= NickName.GetHashCode(); + if (ChatMsg.Length != 0) hash ^= ChatMsg.GetHashCode(); + if (Date != 0L) hash ^= Date.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (NickName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NickName); + } + if (ChatMsg.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ChatMsg); + } + if (Date != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Date); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NickName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NickName); + } + if (ChatMsg.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ChatMsg); + } + if (Date != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Date); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (NickName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(NickName); + } + if (ChatMsg.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ChatMsg); + } + if (Date != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Date); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Protobuf_ChatMsg_RESP other) { + if (other == null) { + return; + } + if (other.NickName.Length != 0) { + NickName = other.NickName; + } + if (other.ChatMsg.Length != 0) { + ChatMsg = other.ChatMsg; + } + if (other.Date != 0L) { + Date = other.Date; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + NickName = input.ReadString(); + break; + } + case 18: { + ChatMsg = input.ReadString(); + break; + } + case 24: { + Date = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + NickName = input.ReadString(); + break; + } + case 18: { + ChatMsg = input.ReadString(); + break; + } + case 24: { + Date = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Simple/Server/Program.cs b/Simple/Server/Program.cs new file mode 100644 index 0000000..764948e --- /dev/null +++ b/Simple/Server/Program.cs @@ -0,0 +1,20 @@ +using ServerCore; +using ServerCore.Manager; + +ServerManager.InitServer(23846); + +while (true) +{ + string CommandStr = Console.ReadLine(); + string Command = ""; + Command = ((CommandStr.IndexOf(" ") <= 0) ? CommandStr : CommandStr.Substring(0, CommandStr.IndexOf(" "))); + switch (Command) + { + case "list": + Console.WriteLine("当前在线:" + ServerManager.g_ClientMgr.GetOnlineClient()); + break; + default: + Console.WriteLine("未知命令" + CommandStr); + break; + } +} \ No newline at end of file diff --git a/Simple/SimpleServer/SimpleServer.csproj b/Simple/Server/Server.csproj similarity index 72% rename from Simple/SimpleServer/SimpleServer.csproj rename to Simple/Server/Server.csproj index f7477f1..57b0271 100644 --- a/Simple/SimpleServer/SimpleServer.csproj +++ b/Simple/Server/Server.csproj @@ -8,7 +8,7 @@ - + diff --git a/Simple/ServerCore/Common/Helper.cs b/Simple/ServerCore/Common/Helper.cs new file mode 100644 index 0000000..2cf4cfe --- /dev/null +++ b/Simple/ServerCore/Common/Helper.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServerCore.Common +{ + public static class Helper + { + public static long GetNowTimeStamp() + { + return GetTimeStamp(DateTime.Now); + } + + /// + /// 获取时间戳 + /// + /// + public static long GetTimeStamp(DateTime dt) + { + TimeSpan ts = dt - new DateTime(1970, 1, 1, 0, 0, 0, 0); + return Convert.ToInt64(ts.TotalSeconds); + } + } +} diff --git a/Simple/ServerCore/Manager/ChatManager.cs b/Simple/ServerCore/Manager/ChatManager.cs new file mode 100644 index 0000000..7106aba --- /dev/null +++ b/Simple/ServerCore/Manager/ChatManager.cs @@ -0,0 +1,24 @@ +using AxibugProtobuf; +using ServerCore.Common; +using ServerCore.NetWork; +using System.Net.Sockets; + +namespace ServerCore.Manager +{ + public class ChatManager + { + public void RecvPlayerChatMsg(Socket sk, byte[] reqData) + { + ClientInfo _c = ServerManager.g_ClientMgr.GetClientForSocket(sk); + ServerManager.g_Log.Debug("收到新的登录请求"); + Protobuf_ChatMsg msg = NetBase.DeSerizlize(reqData); + byte[] respData = NetBase.Serizlize(new Protobuf_ChatMsg_RESP() + { + ChatMsg = msg.ChatMsg, + NickName = _c.Account, + Date = Helper.GetNowTimeStamp() + }); + ServerManager.g_ClientMgr.ClientSendALL((int)CommandID.CmdChatmsg, (int)ErrorCode.ErrorOk, respData); + } + } +} \ No newline at end of file diff --git a/Simple/SimpleServer/Manager/ClientManager.cs b/Simple/ServerCore/Manager/ClientManager.cs similarity index 71% rename from Simple/SimpleServer/Manager/ClientManager.cs rename to Simple/ServerCore/Manager/ClientManager.cs index 637c98b..8b1f56e 100644 --- a/Simple/SimpleServer/Manager/ClientManager.cs +++ b/Simple/ServerCore/Manager/ClientManager.cs @@ -1,12 +1,13 @@ -using System.Net.Sockets; +using AxibugProtobuf; +using System.Net.Sockets; using System.Timers; -namespace SimpleServer +namespace ServerCore.Manager { public class ClientInfo { public long UID { get; set; } - public long RID { get; set; } + public string Account { get; set; } public Socket _socket { get; set; } public bool IsOffline { get; set; } = false; public DateTime LogOutDT { get; set; } @@ -14,14 +15,14 @@ namespace SimpleServer public class ClientManager { - public List ClientList = new List(); - public Dictionary _DictRIDClient = new Dictionary(); - public Dictionary _DictSocketClient = new Dictionary(); - public Dictionary _DictUIDClient = new Dictionary(); - + private List ClientList = new List(); + private Dictionary _DictSocketClient = new Dictionary(); + private Dictionary _DictUIDClient = new Dictionary(); + private long TestUIDSeed = 0; + private System.Timers.Timer _ClientCheckTimer; private long _RemoveOfflineCacheMin; - public void Init(long ticktime,long RemoveOfflineCacheMin) + public void Init(long ticktime, long RemoveOfflineCacheMin) { //换算成毫秒 _RemoveOfflineCacheMin = RemoveOfflineCacheMin * 1000; @@ -31,8 +32,13 @@ namespace SimpleServer _ClientCheckTimer.Elapsed += new ElapsedEventHandler(ClientCheckClearOffline_Elapsed); _ClientCheckTimer.Enabled = true; } - - private void ClientCheckClearOffline_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + + public long GetNextUID() + { + return ++TestUIDSeed; + } + + private void ClientCheckClearOffline_Elapsed(object sender, ElapsedEventArgs e) { DateTime CheckDT = DateTime.Now.AddMinutes(-1 * _RemoveOfflineCacheMin); ClientInfo[] OfflineClientlist = ClientList.Where(w => w.IsOffline == true && w.LogOutDT < CheckDT).ToArray(); @@ -45,24 +51,47 @@ namespace SimpleServer } GC.Collect(); } - + //通用处理 #region clientlist 处理 + public ClientInfo JoinNewClient(Protobuf_Login data, Socket _socket) + { + //也许这个函数需加lock + + ClientInfo cinfo = GetClientForSocket(_socket); + //如果连接还在 + if (cinfo != null) + { + cinfo.IsOffline = false; + } + else + { + cinfo = new ClientInfo() + { + UID = GetNextUID(), + _socket = _socket, + Account = data.Account, + IsOffline = false, + }; + AddClient(cinfo); + } + return cinfo; + } + /// /// 增加用户 /// /// - public void AddClient(ClientInfo clientInfo) + void AddClient(ClientInfo clientInfo) { try { - Console.WriteLine("追加连接玩家 RID=>" + clientInfo.RID + " UID=>" + clientInfo.UID); + Console.WriteLine("追加连接玩家 UID=>" + clientInfo.UID + " | " + clientInfo.Account); lock (ClientList) { _DictUIDClient.Add(clientInfo.UID, clientInfo); - _DictRIDClient.Add(clientInfo.RID, clientInfo); _DictSocketClient.Add(clientInfo._socket, clientInfo); ClientList.Add(clientInfo); } @@ -72,7 +101,7 @@ namespace SimpleServer ex.ToString(); } } - + /// /// 清理连接 /// @@ -81,23 +110,16 @@ namespace SimpleServer { lock (ClientList) { - if(_DictUIDClient.ContainsKey(client.UID)) + if (_DictUIDClient.ContainsKey(client.UID)) _DictUIDClient.Remove(client.UID); - if (_DictRIDClient.ContainsKey(client.RID)) - _DictRIDClient.Remove(client.RID); - if (_DictSocketClient.ContainsKey(client._socket)) _DictSocketClient.Remove(client._socket); - + ClientList.Remove(client); } } - public ClientInfo GetClientForRoleID(int RoleID) - { - return _DictRIDClient.ContainsKey(RoleID) ? _DictRIDClient[RoleID] : null; - } public ClientInfo GetClientForSocket(Socket sk) { @@ -123,7 +145,7 @@ namespace SimpleServer if (!_DictSocketClient.ContainsKey(sk)) return; - Console.WriteLine("标记玩家RID"+ _DictSocketClient[sk].RID+ "为离线"); + Console.WriteLine("标记玩家UID" + _DictSocketClient[sk].UID + "为离线"); _DictSocketClient[sk].IsOffline = true; _DictSocketClient[sk].LogOutDT = DateTime.Now; } @@ -134,17 +156,14 @@ namespace SimpleServer return; RemoveClient(_DictSocketClient[sk]); - //ClientList.Remove(GetClientForSocket(sk)); } #endregion - //public void AddClient_JoinGame(Socket sk) - //{ - // var c = new ClientInfo(); - // c = AutoRoleID; - // AddClient(c); - //} + public void ClientSendALL(int CMDID, int ERRCODE, byte[] data) + { + ClientSend(ClientList, CMDID, ERRCODE, data); + } /// /// 给一组用户发送数据 @@ -155,11 +174,11 @@ namespace SimpleServer /// public void ClientSend(List _toclientlist, int CMDID, int ERRCODE, byte[] data) { - for (int i = 0; i < _toclientlist.Count();i++) + for (int i = 0; i < _toclientlist.Count(); i++) { if (_toclientlist[i] == null || _toclientlist[i].IsOffline) continue; - ServerManager.g_SocketMgr.SendToSocket(_toclientlist[i]._socket, CMDID,ERRCODE,data); + ServerManager.g_SocketMgr.SendToSocket(_toclientlist[i]._socket, CMDID, ERRCODE, data); } } @@ -182,5 +201,10 @@ namespace SimpleServer return; ServerManager.g_SocketMgr.SendToSocket(_c._socket, CMDID, ERRCODE, data); } + + public int GetOnlineClient() + { + return ClientList.Where(w => !w.IsOffline).Count(); + } } } diff --git a/Simple/ServerCore/Manager/LogManager.cs b/Simple/ServerCore/Manager/LogManager.cs new file mode 100644 index 0000000..b1d8e77 --- /dev/null +++ b/Simple/ServerCore/Manager/LogManager.cs @@ -0,0 +1,20 @@ +namespace ServerCore.Manager +{ + public class LogManager + { + public void Debug(string str) + { + Console.WriteLine(str); + } + + public void Warning(string str) + { + Console.WriteLine(str); + } + + public void Error(string str) + { + Console.WriteLine(str); + } + } +} \ No newline at end of file diff --git a/Simple/ServerCore/Manager/LoginManager.cs b/Simple/ServerCore/Manager/LoginManager.cs new file mode 100644 index 0000000..e936177 --- /dev/null +++ b/Simple/ServerCore/Manager/LoginManager.cs @@ -0,0 +1,26 @@ +using AxibugProtobuf; +using ServerCore.NetWork; +using System.Net.Sockets; + +namespace ServerCore.Manager +{ + public class LoginManager + { + public void UserLogin(Socket _socket, byte[] reqData) + { + ServerManager.g_Log.Debug("收到新的登录请求"); + Protobuf_Login msg = NetBase.DeSerizlize(reqData); + ClientInfo cinfo = ServerManager.g_ClientMgr.JoinNewClient(msg, _socket); + + byte[] respData = NetBase.Serizlize(new Protobuf_Login_RESP() + { + Status = LoginResultStatus.Ok, + RegDate = "", + LastLoginDate = "", + Token = "" + }); + + ServerManager.g_ClientMgr.ClientSend(cinfo, (int)CommandID.CmdLogin, (int)ErrorCode.ErrorOk, respData); + } + } +} \ No newline at end of file diff --git a/Simple/ServerCore/Manager/ServerManager.cs b/Simple/ServerCore/Manager/ServerManager.cs new file mode 100644 index 0000000..2a198de --- /dev/null +++ b/Simple/ServerCore/Manager/ServerManager.cs @@ -0,0 +1,27 @@ +using System.Net; +using ServerCore.NetWork; + +namespace ServerCore.Manager +{ + public static class ServerManager + { + public static ClientManager g_ClientMgr; + public static LogManager g_Log; + public static LoginManager g_Login; + public static ChatManager g_Chat; + public static IOCPNetWork g_SocketMgr; + + public static void InitServer(int port) + { + g_ClientMgr = new ClientManager(); + g_Log = new LogManager(); + g_Login = new LoginManager(); + g_Chat = new ChatManager(); + g_SocketMgr = new IOCPNetWork(1024, 1024); + g_SocketMgr.Init(); + g_SocketMgr.Start(new IPEndPoint(IPAddress.Any.Address, port)); + Console.WriteLine("监听:" + port); + Console.WriteLine("Succeed!"); + } + } +} \ No newline at end of file diff --git a/Simple/SimpleServer/NetWork/IOCPNetWork.cs b/Simple/ServerCore/NetWork/IOCPNetWork.cs similarity index 79% rename from Simple/SimpleServer/NetWork/IOCPNetWork.cs rename to Simple/ServerCore/NetWork/IOCPNetWork.cs index fef483d..ea03c91 100644 --- a/Simple/SimpleServer/NetWork/IOCPNetWork.cs +++ b/Simple/ServerCore/NetWork/IOCPNetWork.cs @@ -1,7 +1,9 @@ -using HaoYueNet.ServerNetwork; +using AxibugProtobuf; +using HaoYueNet.ServerNetwork; +using ServerCore.Manager; using System.Net.Sockets; -namespace SimpleServer +namespace ServerCore.NetWork { public class IOCPNetWork : SocketManager { @@ -25,7 +27,7 @@ namespace SimpleServer private void IOCPNetWork_ClientNumberChange(int num, AsyncUserToken token) { - Console.WriteLine("建立新的连接"); + Console.WriteLine("Client数发生变化"); } /// @@ -41,12 +43,13 @@ namespace SimpleServer public void DataCallBackToOld(Socket sk, int CMDID, byte[] data) { - //ServerManager.g_Log.Debug("收到消息 CMDID =>" + CMDID + " 数据长度=>" + data.Length); + ServerManager.g_Log.Debug("收到消息 CMDID =>" + CMDID + " 数据长度=>" + data.Length); try { - switch (CMDID) + switch ((CommandID)CMDID) { - + case CommandID.CmdLogin: ServerManager.g_Login.UserLogin(sk, data); break; + case CommandID.CmdChatmsg: ServerManager.g_Chat.RecvPlayerChatMsg(sk, data); break; } } catch (Exception ex) @@ -63,16 +66,16 @@ namespace SimpleServer { OnCloseToOld(token.Socket); } - + /// /// 断开连接 /// /// public void OnCloseToOld(Socket sk) { - //ServerManager.g_Log.Debug("清理掉线"); + Console.WriteLine("断开连接"); ServerManager.g_ClientMgr.SetClientOfflineForSocket(sk); } - + } } diff --git a/Simple/ServerCore/NetWork/NetBase.cs b/Simple/ServerCore/NetWork/NetBase.cs new file mode 100644 index 0000000..404f542 --- /dev/null +++ b/Simple/ServerCore/NetWork/NetBase.cs @@ -0,0 +1,22 @@ +using Google.Protobuf; + +namespace ServerCore.NetWork +{ + public static class NetBase + { + + public static byte[] Serizlize(IMessage msg) + { + return msg.ToByteArray(); + } + + public static T DeSerizlize(byte[] bytes) + { + var msgType = typeof(T); + object msg = Activator.CreateInstance(msgType); + ((IMessage)msg).MergeFrom(bytes); + return (T)msg; + } + } + +} diff --git a/Simple/ServerCore/ServerCore.csproj b/Simple/ServerCore/ServerCore.csproj new file mode 100644 index 0000000..e5bb8e0 --- /dev/null +++ b/Simple/ServerCore/ServerCore.csproj @@ -0,0 +1,20 @@ + + + + net7.0 + enable + enable + + + + + + + + + + ..\..\NetLib\Google.Protobuf.dll + + + + diff --git a/Simple/SimpleClient/Program.cs b/Simple/SimpleClient/Program.cs deleted file mode 100644 index a121771..0000000 --- a/Simple/SimpleClient/Program.cs +++ /dev/null @@ -1,22 +0,0 @@ -// See https://aka.ms/new-console-template for more information - -using SimpleClient; - -Console.WriteLine("Hello, World!"); - -StaticComm.networkHelper = new NetworkHelper(); - -StaticComm.networkHelper.Init("127.0.0.1", 23846); - -while (true) -{ - string CommandStr = Console.ReadLine(); - string Command = ""; - Command = ((CommandStr.IndexOf(" ") <= 0) ? CommandStr : CommandStr.Substring(0, CommandStr.IndexOf(" "))); - switch (Command) - { - default: - Console.WriteLine("未知命令" + CommandStr); - break; - } -} \ No newline at end of file diff --git a/Simple/SimpleClient/StaticComm.cs b/Simple/SimpleClient/StaticComm.cs deleted file mode 100644 index 2fcb9f5..0000000 --- a/Simple/SimpleClient/StaticComm.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SimpleClient -{ - public class StaticComm - { - public static string TokenStr; - public static long RID = -1; - public static string IP; - public static int Port; - - - public static NetworkHelper networkHelper; - } -} diff --git a/Simple/SimpleServer/Manager/ServerManager.cs b/Simple/SimpleServer/Manager/ServerManager.cs deleted file mode 100644 index 354cb4c..0000000 --- a/Simple/SimpleServer/Manager/ServerManager.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace SimpleServer -{ - public static class ServerManager - { - public static ClientManager g_ClientMgr; - public static IOCPNetWork g_SocketMgr; - } -} \ No newline at end of file diff --git a/Simple/SimpleServer/Program.cs b/Simple/SimpleServer/Program.cs deleted file mode 100644 index 451242a..0000000 --- a/Simple/SimpleServer/Program.cs +++ /dev/null @@ -1,27 +0,0 @@ -// See https://aka.ms/new-console-template for more information -using SimpleServer; -using System.Net; - -Console.WriteLine("Hello, World!"); - -ServerManager.g_ClientMgr = new ClientManager(); -ServerManager.g_SocketMgr = new IOCPNetWork(1024, 1024); -ServerManager.g_SocketMgr.Init(); -ServerManager.g_SocketMgr.Start(new IPEndPoint(IPAddress.Any.Address, 23846)); -Console.WriteLine("监听:" + 23846); -Console.WriteLine("Succeed!"); -while (true) -{ - string CommandStr = Console.ReadLine(); - string Command = ""; - Command = ((CommandStr.IndexOf(" ") <= 0) ? CommandStr : CommandStr.Substring(0, CommandStr.IndexOf(" "))); - switch(Command) - { - case "list": - Console.WriteLine("当前在线:" + ServerManager.g_ClientMgr.ClientList.Count()); - break; - default: - Console.WriteLine("未知命令"+CommandStr); - break; - } -} \ No newline at end of file