diff --git a/TLSharp.Core/TelegramClient.cs b/TLSharp.Core/TelegramClient.cs index dd0593d..3406ee9 100644 --- a/TLSharp.Core/TelegramClient.cs +++ b/TLSharp.Core/TelegramClient.cs @@ -41,7 +41,6 @@ namespace TLSharp.Core if (store == null) store = new FileSessionStore(); - TLContext.Init(); _apiHash = apiHash; _apiId = apiId; _handler = handler; diff --git a/TeleSharp.TL/TLContext.cs b/TeleSharp.TL/TLContext.cs index db686aa..be43936 100644 --- a/TeleSharp.TL/TLContext.cs +++ b/TeleSharp.TL/TLContext.cs @@ -12,7 +12,7 @@ namespace TeleSharp.TL { private static Dictionary Types; - public static void Init() + static TLContext() { Types = new Dictionary(); 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];