mirror of
https://github.com/sochix/TLSharp.git
synced 2026-01-06 16:59:57 +01:00
[Core] Avoid double loading if calling assembly is already loaded on runtime
This commit is contained in:
parent
81bbe62c5c
commit
5eea677a93
|
|
@ -14,13 +14,20 @@ namespace TeleSharp.TL
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
Types = new Dictionary<int, Type>();
|
try
|
||||||
Types = (from t in Assembly.GetExecutingAssembly().GetTypes()
|
{
|
||||||
where t.IsClass && t.Namespace.StartsWith("TeleSharp.TL")
|
Types = new Dictionary<int, Type>();
|
||||||
where t.IsSubclassOf(typeof(TLObject))
|
Types = (from t in Assembly.GetExecutingAssembly().GetTypes()
|
||||||
where t.GetCustomAttribute(typeof(TLObjectAttribute)) != null
|
where t.IsClass && t.Namespace.StartsWith("TeleSharp.TL")
|
||||||
select t).ToDictionary(x => ((TLObjectAttribute)x.GetCustomAttribute(typeof(TLObjectAttribute))).Constructor, x => x);
|
where t.IsSubclassOf(typeof(TLObject))
|
||||||
Types.Add(481674261, typeof(TLVector<>));
|
where t.GetCustomAttribute(typeof(TLObjectAttribute)) != null
|
||||||
|
select t).ToDictionary(x => ((TLObjectAttribute)x.GetCustomAttribute(typeof(TLObjectAttribute))).Constructor, x => x);
|
||||||
|
Types.Add(481674261, typeof(TLVector<>));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static Type getType(int Constructor)
|
public static Type getType(int Constructor)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue