当前位置: 首页>>代码示例>>C#>>正文


C# Client.SetBiosIdentification方法代码示例

本文整理汇总了C#中Server.Network.Client.SetBiosIdentification方法的典型用法代码示例。如果您正苦于以下问题:C# Client.SetBiosIdentification方法的具体用法?C# Client.SetBiosIdentification怎么用?C# Client.SetBiosIdentification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Network.Client的用法示例。


在下文中一共展示了Client.SetBiosIdentification方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessData

        internal static void ProcessData(Client client, string[] parse)
        {
            //string[] parse = data.Split(TcpPacket.SEP_CHAR);
            if (client.Player == null)
            {
                if (parse[0].ToLower() == "requestnews")
                {
                    Messenger.SendNews(client);
                    client.InitializeClientSystem();
                    return;
                }
            }
            if (client.Player == null)
            {
                Messenger.PlainMsg(client, "Unable to initialize connection. Please retry.", Enums.PlainMsgType.MainMenu);
                return;
            }
            if (!client.Player.LoggedIn)
            {
                #region Not Logged In
                switch (parse[0].ToLower())
                {
                    case "clienterror":
                        {
                            string error = parse[1];
                            error += "\r\n\r\n------- ERROR REPORT END -------\r\n\r\n";
                            Logging.Logger.AppendToLog("/Client Error Logs/" + DateTime.Now.ToShortDateString().Replace("/", "-") + "/log.txt", error);
                        }
                        break;
                    case "requestnews":
                        Messenger.SendNews(client);
                        client.InitializeClientSystem();
                        break;
                    #region Logging In
                    case "login":
                        {
                            if (Globals.ServerClosed)
                            {
                                Messenger.PlainMsg(client, "Server is closed at the moment!", Enums.PlainMsgType.MainMenu);
                                return;
                            }
                            if (ClientManager.CanLogin(parse[1]))
                            {
                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                {
                                    // Check if the account exists
                                    if (PlayerManager.AccountExists(dbConnection, parse[1]) == false)
                                    {
                                        Messenger.PlainMsg(client, "This account does not exist.", Enums.PlainMsgType.MainMenu);
                                        return;
                                    }
                                    // Check the client version
                                    if (parse[3].ToInt() < Constants.CLIENT_VERSION)
                                    {
                                        Messenger.PlainMsg(client, "Your client is outdated. Please update your client.", Enums.PlainMsgType.MainMenu);
                                        return;
                                    }
                                    // Verify that the client used is a valid one
                                    if (parse[10] != "PMDCPCore")
                                    {
                                        Messenger.PlainMsg(client, "Bad client version! Did you edit the source code?", Enums.PlainMsgType.MainMenu);
                                        return;
                                    }

            #if !DEBUG
                                    if (ClientManager.IsMacAddressConnected(parse[11])) {
                                        Messenger.PlainMsg(client, "You are already playing on this computer!", Enums.PlainMsgType.MainMenu);
                                        return;
                                    }

            #endif

                                    string password = Security.Hash.GenerateMD5Hash(parse[2]).Trim();
                                    if (PlayerManager.IsPasswordCorrect(dbConnection, parse[1], password))
                                    {

                                        client.SetMacAddress(parse[11]);
                                        client.SetBiosIdentification(parse[12]);
                                        // Check if they aren't banned
                                        if (Bans.IsIPBanned(dbConnection, client) == Enums.BanType.Ban || Bans.IsMacBanned(dbConnection, client) == Enums.BanType.Ban)
                                        {
                                            Logging.ChatLogger.AppendToChatLog("Staff", "IP: " + client.IP + " Mac: " + client.MacAddress + " attempted to log on, but was banned.");
                                            Messenger.PlainMsg(client, "You can't enter this world!", Enums.PlainMsgType.MainMenu);
                                            client.SetMacAddress("");
                                            client.SetBiosIdentification("");
                                            return;
                                        }

                                        client.Player.AccountName = parse[1];

                                        client.Player.SetSystemInfo(parse[8], parse[9], parse[10]);
                                        Messenger.SendChars(dbConnection, client);
                                    }
                                    else
                                    {
                                        Messenger.PlainMsg(client, "Invalid password.", Enums.PlainMsgType.MainMenu);
                                    }
                                }
                            }
                            else
//.........这里部分代码省略.........
开发者ID:MandL27,项目名称:Server,代码行数:101,代码来源:MessageProcessor.cs


注:本文中的Server.Network.Client.SetBiosIdentification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。