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()
|
public static void Init()
|
||||||
{
|
{
|
||||||
try
|
Types = new Dictionary<int, Type>();
|
||||||
{
|
Types = (from t in Assembly.GetExecutingAssembly().GetTypes()
|
||||||
Types = new Dictionary<int, Type>();
|
where t.IsClass && t.Namespace.StartsWith("TeleSharp.TL")
|
||||||
Types = (from t in Assembly.GetExecutingAssembly().GetTypes()
|
where t.IsSubclassOf(typeof(TLObject))
|
||||||
where t.IsClass && t.Namespace.StartsWith("TeleSharp.TL")
|
where t.GetCustomAttribute(typeof(TLObjectAttribute)) != null
|
||||||
where t.IsSubclassOf(typeof(TLObject))
|
select t).ToDictionary(x => ((TLObjectAttribute)x.GetCustomAttribute(typeof(TLObjectAttribute))).Constructor, x => x);
|
||||||
where t.GetCustomAttribute(typeof(TLObjectAttribute)) != null
|
|
||||||
select t).ToDictionary(x => ((TLObjectAttribute)x.GetCustomAttribute(typeof(TLObjectAttribute))).Constructor, x => x);
|
|
||||||
Types.Add(481674261, typeof(TLVector<>));
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
|
|
||||||
|
if (!Types.ContainsKey(481674261))
|
||||||
|
{
|
||||||
|
Types.Add(481674261, typeof(TLVector<>));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static Type getType(int Constructor)
|
public static Type getType(int Constructor)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue