More Cleanups
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using BNetServer;
|
||||
|
||||
public static class Global
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Framework.Networking;
|
||||
using System.Net.Sockets;
|
||||
using Framework.Web;
|
||||
using Framework.Configuration;
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Configuration;
|
||||
using Framework.Networking;
|
||||
using Framework.Serialization;
|
||||
using Framework.Web;
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace BNetServer.Networking
|
||||
{
|
||||
@@ -53,7 +52,7 @@ namespace BNetServer.Networking
|
||||
public void HandleLoginRequest(HttpHeader request)
|
||||
{
|
||||
LogonData loginForm = Json.CreateObject<LogonData>(request.Content);
|
||||
LogonResult loginResult = new LogonResult();
|
||||
LogonResult loginResult = new();
|
||||
if (loginForm == null)
|
||||
{
|
||||
loginResult.AuthenticationState = "LOGIN";
|
||||
@@ -96,7 +95,7 @@ namespace BNetServer.Networking
|
||||
{
|
||||
if (loginTicket.IsEmpty() || loginTicketExpiry < Time.UnixTime)
|
||||
{
|
||||
byte[] ticket = new byte[0].GenerateRandomKey(20);
|
||||
byte[] ticket = Array.Empty<byte>().GenerateRandomKey(20);
|
||||
loginTicket = "TC-" + ticket.ToHexString();
|
||||
}
|
||||
|
||||
@@ -117,7 +116,7 @@ namespace BNetServer.Networking
|
||||
|
||||
if (maxWrongPassword != 0)
|
||||
{
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
SQLTransaction trans = new();
|
||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetFailedLogins);
|
||||
stmt.AddValue(0, accountId);
|
||||
trans.Append(stmt);
|
||||
|
||||
@@ -6,10 +6,9 @@ using Bgs.Protocol.Authentication.V1;
|
||||
using Bgs.Protocol.Challenge.V1;
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Realm;
|
||||
using Google.Protobuf;
|
||||
using System;
|
||||
using Framework.Realm;
|
||||
using System.Net;
|
||||
|
||||
namespace BNetServer.Networking
|
||||
{
|
||||
@@ -42,7 +41,7 @@ namespace BNetServer.Networking
|
||||
|
||||
var endpoint = Global.LoginServiceMgr.GetAddressForClient(GetRemoteIpEndPoint().Address);
|
||||
|
||||
ChallengeExternalRequest externalChallenge = new ChallengeExternalRequest();
|
||||
ChallengeExternalRequest externalChallenge = new();
|
||||
externalChallenge.PayloadType = "web_auth_url";
|
||||
externalChallenge.Payload = ByteString.CopyFromUtf8($"https://{endpoint.Address}:{endpoint.Port}/bnetserver/login/");
|
||||
|
||||
@@ -92,7 +91,7 @@ namespace BNetServer.Networking
|
||||
{
|
||||
var realmId = new RealmId(lastPlayerCharactersResult.Read<byte>(1), lastPlayerCharactersResult.Read<byte>(2), lastPlayerCharactersResult.Read<uint>(3));
|
||||
|
||||
LastPlayedCharacterInfo lastPlayedCharacter = new LastPlayedCharacterInfo();
|
||||
LastPlayedCharacterInfo lastPlayedCharacter = new();
|
||||
lastPlayedCharacter.RealmId = realmId;
|
||||
lastPlayedCharacter.CharacterName = lastPlayerCharactersResult.Read<string>(4);
|
||||
lastPlayedCharacter.CharacterGUID = lastPlayerCharactersResult.Read<ulong>(5);
|
||||
@@ -142,14 +141,14 @@ namespace BNetServer.Networking
|
||||
}
|
||||
}
|
||||
|
||||
LogonResult logonResult = new LogonResult();
|
||||
LogonResult logonResult = new();
|
||||
logonResult.ErrorCode = 0;
|
||||
logonResult.AccountId = new EntityId();
|
||||
logonResult.AccountId.Low = accountInfo.Id;
|
||||
logonResult.AccountId.High = 0x100000000000000;
|
||||
foreach (var pair in accountInfo.GameAccounts)
|
||||
{
|
||||
EntityId gameAccountId = new EntityId();
|
||||
EntityId gameAccountId = new();
|
||||
gameAccountId.Low = pair.Value.Id;
|
||||
gameAccountId.High = 0x200000200576F57;
|
||||
logonResult.GameAccountId.Add(gameAccountId);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Bgs.Protocol;
|
||||
using Bgs.Protocol.Connection.V1;
|
||||
using Framework.Constants;
|
||||
using System.Collections.Generic;
|
||||
using Google.Protobuf;
|
||||
using Bgs.Protocol;
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
|
||||
namespace BNetServer.Networking
|
||||
{
|
||||
@@ -19,7 +17,7 @@ namespace BNetServer.Networking
|
||||
response.ClientId.MergeFrom(request.ClientId);
|
||||
|
||||
response.ServerId = new ProcessId();
|
||||
response.ServerId.Label = (uint)Process.GetCurrentProcess().Id;
|
||||
response.ServerId.Label = (uint)Environment.ProcessId;
|
||||
response.ServerId.Epoch = (uint)Time.UnixTime;
|
||||
response.ServerTime = (ulong)Time.UnixTimeMilliseconds;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BNetServer.Networking
|
||||
return BattlenetRpcErrorCode.Denied;
|
||||
|
||||
Bgs.Protocol.Attribute command = null;
|
||||
Dictionary<string, Variant> Params = new Dictionary<string, Variant>();
|
||||
Dictionary<string, Variant> Params = new();
|
||||
|
||||
for (int i = 0; i < request.Attribute.Count; ++i)
|
||||
{
|
||||
|
||||
@@ -125,12 +125,12 @@ namespace BNetServer.Networking
|
||||
|
||||
public async void SendResponse(uint token, IMessage response)
|
||||
{
|
||||
Header header = new Header();
|
||||
Header header = new();
|
||||
header.Token = token;
|
||||
header.ServiceId = 0xFE;
|
||||
header.Size = (uint)response.CalculateSize();
|
||||
|
||||
ByteBuffer buffer = new ByteBuffer();
|
||||
ByteBuffer buffer = new();
|
||||
buffer.WriteBytes(GetHeaderSize(header), 2);
|
||||
buffer.WriteBytes(header.ToByteArray());
|
||||
buffer.WriteBytes(response.ToByteArray());
|
||||
@@ -140,12 +140,12 @@ namespace BNetServer.Networking
|
||||
|
||||
public async void SendResponse(uint token, BattlenetRpcErrorCode status)
|
||||
{
|
||||
Header header = new Header();
|
||||
Header header = new();
|
||||
header.Token = token;
|
||||
header.Status = (uint)status;
|
||||
header.ServiceId = 0xFE;
|
||||
|
||||
ByteBuffer buffer = new ByteBuffer();
|
||||
ByteBuffer buffer = new();
|
||||
buffer.WriteBytes(GetHeaderSize(header), 2);
|
||||
buffer.WriteBytes(header.ToByteArray());
|
||||
|
||||
@@ -154,14 +154,14 @@ namespace BNetServer.Networking
|
||||
|
||||
public async void SendRequest(uint serviceHash, uint methodId, IMessage request)
|
||||
{
|
||||
Header header = new Header();
|
||||
Header header = new();
|
||||
header.ServiceId = 0;
|
||||
header.ServiceHash = serviceHash;
|
||||
header.MethodId = methodId;
|
||||
header.Size = (uint)request.CalculateSize();
|
||||
header.Token = requestToken++;
|
||||
|
||||
ByteBuffer buffer = new ByteBuffer();
|
||||
ByteBuffer buffer = new();
|
||||
buffer.WriteBytes(GetHeaderSize(header), 2);
|
||||
buffer.WriteBytes(header.ToByteArray());
|
||||
buffer.WriteBytes(request.ToByteArray());
|
||||
@@ -260,7 +260,7 @@ namespace BNetServer.Networking
|
||||
|
||||
int hashPos = Name.IndexOf('#');
|
||||
if (hashPos != -1)
|
||||
DisplayName = "WoW" + Name.Substring(hashPos + 1);
|
||||
DisplayName = "WoW" + Name[(hashPos + 1)..];
|
||||
else
|
||||
DisplayName = Name;
|
||||
|
||||
|
||||
@@ -3,19 +3,12 @@
|
||||
|
||||
using BNetServer.Networking;
|
||||
using Framework.Configuration;
|
||||
using Framework.Cryptography;
|
||||
using Framework.Database;
|
||||
using Framework.Networking;
|
||||
using Framework.Web.API;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Timers;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Framework.Cryptography;
|
||||
|
||||
namespace BNetServer
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user