예제 #1
0
 private byte[] hashKey_Gen(ConnectedHost host)
 {
     try
     {
         using (CustomDataWriter writer = new CustomDataWriter())
         {
             writer.WriteUTF(host.Bot.Login.mAutentificationFrame.mTicket);
             byte[] key = hash(writer.Data);
             return key;
         }
     }
     catch (Exception ex)
     {
         
         return null;
     }
 }
예제 #2
0
        public void Add(object obj, bool isVar = false)
        {
            switch (obj)
            {
            case byte byteArg:
                _writer.WriteByte(byteArg);
                break;

            case sbyte sbyteArg:
                _writer.WriteSByte(sbyteArg);
                break;

            case ushort ushortArg:
                if (isVar)
                {
                    _writer.WriteVarUShort(ushortArg);
                }
                else
                {
                    _writer.WriteUShort(ushortArg);
                }
                break;

            case short shortArg:
                if (isVar)
                {
                    _writer.WriteVarShort(shortArg);
                }
                else
                {
                    _writer.WriteShort(shortArg);
                }
                break;

            case uint uintArg:
                if (isVar)
                {
                    _writer.WriteVarUInt(uintArg);
                }
                else
                {
                    _writer.WriteUInt(uintArg);
                }
                break;

            case int intArg:
                if (isVar)
                {
                    _writer.WriteVarInt(intArg);
                }
                else
                {
                    _writer.WriteInt(intArg);
                }
                break;

            case ulong ulongArg:
                if (isVar)
                {
                    _writer.WriteVarULong(ulongArg);
                }
                else
                {
                    _writer.WriteULong(ulongArg);
                }
                break;

            case long longArg:
                if (isVar)
                {
                    _writer.WriteVarLong(longArg);
                }
                else
                {
                    _writer.WriteLong(longArg);
                }
                break;

            case bool boolArg:
                _writer.WriteBool(boolArg);
                break;

            case float singleArg:
                _writer.WriteSingle(singleArg);
                break;

            case double doubleArg:
                _writer.WriteDouble(doubleArg);
                break;

            case string utfArg:
                _writer.WriteUTF(utfArg);
                break;
            }
        }