mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-05 23:52:00 +01:00
issue#768 fix exception 'Constructor Invalid Or Context.Init Not Called !'
This commit is contained in:
parent
1aa63e565a
commit
47e973823a
|
|
@ -41,7 +41,6 @@ namespace TLSharp.Core
|
|||
if (store == null)
|
||||
store = new FileSessionStore();
|
||||
|
||||
TLContext.Init();
|
||||
_apiHash = apiHash;
|
||||
_apiId = apiId;
|
||||
_handler = handler;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace TeleSharp.TL
|
|||
{
|
||||
private static Dictionary<int, Type> Types;
|
||||
|
||||
public static void Init()
|
||||
static TLContext()
|
||||
{
|
||||
Types = new Dictionary<int, Type>();
|
||||
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];
|
||||
|
|
|
|||
Loading…
Reference in a new issue