Added custom errors, fixes to code generator

The code generator now handles okay the flags using True type
Also, double checking for the flag is now avoided in cases where the
flag was a Vector type
This commit is contained in:
Lonami
2016-09-05 18:35:12 +02:00
parent b027dd2c8f
commit 251c1830a5
12 changed files with 170 additions and 110 deletions

View File

@@ -1,6 +1,7 @@
# This file is based on TLSharp
# https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/MTProto/Crypto/AuthKey.cs
import utils
from errors import *
from utils import BinaryWriter, BinaryReader
@@ -11,7 +12,7 @@ class AuthKey:
elif data:
self.key = data
else:
raise AssertionError('Either a gab integer or data bytes array must be provided')
raise InvalidParameterError('Either a gab integer or data bytes array must be provided')
with BinaryReader(utils.sha1(self.key)) as reader:
self.aux_hash = reader.read_long(signed=False)