Hey people as title says and i am sure it's will be stupid question but i failed at this point ...
i am working on Redux source 5065 i am changed log-in way to this :
and here is Forward packet class :
and my problem i am facing is if the entered info is incorrect i get invalid info message , but if its correct or banned i get the client crashed.
it's only crash when it receive the type is ready or banned from the source , but if its invalid info type its show me the message successfully
i am working on Redux source 5065 i am changed log-in way to this :
PHP Code:
#region Receive Data
private unsafe void Auth_OnReceive(ISocketWrapper arg2, byte[] arg1)
{
if (arg1.Length == 52)
{
AuthState player = arg2.Connector as AuthState;
player.Cryptographer.Decrypt(arg1, arg1, arg1.Length);
player.Info = new Authentication();
player.Info.Deserialize(arg1);
player.Account = new Database.AccountTable(player.Info.Username);
Forward Fw = new Forward();
if (player.Info.Password == player.Account.Password)
{
if (player.Account.State == Database.AccountTable.AccountState.Banned)
Fw.Type = (uint)Forward.ForwardType.Banned;
else
Fw.Type = Forward.ForwardType.Ready;
}
else
{
Fw.Type = Forward.ForwardType.InvalidInfo;
}
if (Fw.Type != Forward.ForwardType.InvalidInfo)
{
Fw.Identifier = Forward.Incrementer.Next;
ServerBase.Kernel.AwaitingPool.Add(Fw.Identifier, player.Account);
}
Fw.IP = "127.0.0.1";
Fw.Port = 5816;
player.Send(Fw);
}
else
{
arg2.Socket.Disconnect(false);
}
}
#endregion
PHP Code:
public class Forward : Interfaces.IPacket
{
public static ServerBase.Counter Incrementer;
public enum ForwardType : byte { Ready = 2, InvalidInfo = 1, Banned = 0 }
byte[] Buffer;
public Forward()
{
Buffer = new byte[32];
Network.Writer.WriteUInt16(32, 0, Buffer);
Network.Writer.WriteUInt16(1055, 2, Buffer);
}
public uint Identifier
{
get
{
return BitConverter.ToUInt32(Buffer, 4);
}
set
{
Network.Writer.WriteUInt32(value, 4, Buffer);
}
}
public ForwardType Type
{
get
{
return (ForwardType)(byte)BitConverter.ToUInt32(Buffer, 8);
}
set
{
Network.Writer.WriteUInt32((byte)value, 8, Buffer);
}
}
public string IP
{
get
{
return Encoding.ASCII.GetString(Buffer, 12, 16);
}
set
{
Network.Writer.WriteString(value, 12, Buffer);
}
}
public ushort Port
{
get
{
return BitConverter.ToUInt16(Buffer, 28);
}
set
{
Network.Writer.WriteUInt16(value, 28, Buffer);
}
}
public void Deserialize(byte[] buffer)
{
//no implementation
}
public byte[] ToArray()
{
return Buffer;
}
}
it's only crash when it receive the type is ready or banned from the source , but if its invalid info type its show me the message successfully