From e52f1caeee1810db5cc3023bf594f355b328a8ba Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Thu, 22 Mar 2018 03:53:52 +0100 Subject: [PATCH] [Core] Add proper method to check double loading --- TeleSharp.TL/TLContext.cs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/TeleSharp.TL/TLContext.cs b/TeleSharp.TL/TLContext.cs index 74b6cec..8550c28 100644 --- a/TeleSharp.TL/TLContext.cs +++ b/TeleSharp.TL/TLContext.cs @@ -14,19 +14,16 @@ namespace TeleSharp.TL public static void Init() { - try - { - Types = new Dictionary(); - Types = (from t in Assembly.GetExecutingAssembly().GetTypes() - where t.IsClass && t.Namespace.StartsWith("TeleSharp.TL") - where t.IsSubclassOf(typeof(TLObject)) - where t.GetCustomAttribute(typeof(TLObjectAttribute)) != null - select t).ToDictionary(x => ((TLObjectAttribute)x.GetCustomAttribute(typeof(TLObjectAttribute))).Constructor, x => x); - Types.Add(481674261, typeof(TLVector<>)); - } - catch - { + Types = new Dictionary(); + Types = (from t in Assembly.GetExecutingAssembly().GetTypes() + where t.IsClass && t.Namespace.StartsWith("TeleSharp.TL") + where t.IsSubclassOf(typeof(TLObject)) + where t.GetCustomAttribute(typeof(TLObjectAttribute)) != null + select t).ToDictionary(x => ((TLObjectAttribute)x.GetCustomAttribute(typeof(TLObjectAttribute))).Constructor, x => x); + if (!Types.ContainsKey(481674261)) + { + Types.Add(481674261, typeof(TLVector<>)); } } public static Type getType(int Constructor)