當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。