mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
[Core] Add proper method to check double loading
This commit is contained in:
parent
5e060a160b
commit
e52f1caeee
|
|
@ -14,19 +14,16 @@ namespace TeleSharp.TL
|
|||
|
||||
public static void Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
Types = new Dictionary<int, Type>();
|
||||
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<int, Type>();
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue