issue#768 fix exception 'Constructor Invalid Or Context.Init Not Called !'

This commit is contained in:
vlad_neg 2018-05-30 01:50:44 +03:00 committed by Andres G. Aragoneses
parent 1aa63e565a
commit 47e973823a
2 changed files with 2 additions and 2 deletions

View file

@ -41,7 +41,6 @@ namespace TLSharp.Core
if (store == null)
store = new FileSessionStore();
TLContext.Init();
_apiHash = apiHash;
_apiId = apiId;
_handler = handler;

View file

@ -12,7 +12,7 @@ namespace TeleSharp.TL
{
private static Dictionary<int, Type> Types;
public static void Init()
static TLContext()
{
Types = new Dictionary<int, Type>();
Types = (from t in Assembly.GetExecutingAssembly().GetTypes()
@ -22,6 +22,7 @@ namespace TeleSharp.TL
select t).ToDictionary(x => ((TLObjectAttribute)x.GetCustomAttribute(typeof(TLObjectAttribute))).Constructor, x => x);
Types.Add(481674261, typeof(TLVector<>));
}
public static Type getType(int Constructor)
{
return Types[Constructor];