Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

[Core] Change libs to netstandard #687

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions TeleSharp.TL/TLContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ public static class TLContext

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);

if (!Types.ContainsKey(481674261))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see what you did here, but actually I think the best approach is simply changing the line Types.Add(481674261, typeof(TLVector<>)); to simply Types[481674261] = typeof(TLVector<>);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True -> This is a better method :) Changed

{
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
{

}
}
public static Type getType(int Constructor)
{
Expand Down