diff --git a/AuroraNative/build.h b/AuroraNative/build.h index 26b094f..938971e 100644 --- a/AuroraNative/build.h +++ b/AuroraNative/build.h @@ -4,6 +4,6 @@ #define ONLINE // Enables Online servers #define DISABLE_PINNING // Disables SSL pinning -#define DISABLE_PROXY // Disables proxy +//#define DISABLE_PROXY // Disables proxy //#define VERBOSE // Enables verbose logging \ No newline at end of file diff --git a/AuroraServer/IO/BitReader.cs b/AuroraServer/IO/BitReader.cs deleted file mode 100644 index 3cb0342..0000000 --- a/AuroraServer/IO/BitReader.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; - -namespace AuroraServer.IO -{ - class BitReader - { - #region Field Region - - public int Position; - - #endregion - - #region Property Region - - public BitArray Bits { get; private set; } - - #endregion - - #region Constructor Region - - public BitReader(bool[] values) - { - Bits = new BitArray(values); - } - - public BitReader(byte[] bytes) - { - Bits = new BitArray(bytes); - } - - #endregion - - #region Method Region - - public bool ReadBit() => Bits[Position++]; - - public byte ReadByte() - { - byte result = 0; - - for (int index = 0; index < 8; index++) - { - if (ReadBit()) - result |= (byte)(1 << index); - } - - return result; - } - - public IEnumerable ReadBytes(int count) - { - byte[] result = new byte[count]; - - for (int index = 0; index < count; index++) - result[index] = ReadByte(); - - return result; - } - - public short ReadInt16() => BitConverter.ToInt16((byte[])ReadBytes(2)); - - public int ReadInt32() => BitConverter.ToInt32((byte[])ReadBytes(4)); - - public float ReadSingle() => BitConverter.ToSingle((byte[])ReadBytes(4)); - - public long ReadInt64() => BitConverter.ToInt64((byte[])ReadBytes(8)); - - #endregion - } -} diff --git a/AuroraServer/Program.cs b/AuroraServer/Program.cs index ef48b8c..e8cda22 100644 --- a/AuroraServer/Program.cs +++ b/AuroraServer/Program.cs @@ -1,5 +1,7 @@ -using Serilog; +using AuroraServer.IO; +using Serilog; using Serilog.Core; +using System.Linq; namespace AuroraServer { @@ -12,6 +14,11 @@ class Program static void Main(string[] args) { _log.Information("AuroraServer by Cyuubi, do not redistribute!"); + + BitReader reader = new BitReader(new byte[] { 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 }); + + _log.Information($"IsValid = {Enumerable.SequenceEqual(reader.ReadBits(4), new bool[] { true, true, true, false })}"); + _log.Information($"IsHandshake = {reader.ReadBit()}"); } } }