mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
commit
7d436e3954
|
|
@ -148,16 +148,16 @@ Contributing is highly appreciated!
|
||||||
|
|
||||||
#### Release 1.0.0
|
#### Release 1.0.0
|
||||||
|
|
||||||
* Add PHONE_MIGRATE handling
|
* [DONE] Add PHONE_MIGRATE handling
|
||||||
* Add Updates handling
|
* Add Updates handling
|
||||||
* Add NuGet package
|
* Add NuGet package
|
||||||
* Add wrappers for media uploading
|
* [WIP] Add wrappers for media uploading
|
||||||
* Store user session as JSON
|
* Store user session as JSON
|
||||||
|
|
||||||
# FAQ
|
# FAQ
|
||||||
|
|
||||||
#### What API layer is supported?
|
#### What API layer is supported?
|
||||||
The latest one - 53. Thanks to Afshin Arani
|
The latest one - 57. Thanks to Afshin Arani for his TLGenerator
|
||||||
|
|
||||||
#### I get an error MIGRATE_X?
|
#### I get an error MIGRATE_X?
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,8 @@ namespace TLSharp.Core
|
||||||
|
|
||||||
public class Session
|
public class Session
|
||||||
{
|
{
|
||||||
private const string defaultConnectionAddress = "91.108.56.165";
|
private const string defaultConnectionAddress = "149.154.175.100";//"149.154.167.50";
|
||||||
|
|
||||||
private const int defaultConnectionPort = 443;
|
private const int defaultConnectionPort = 443;
|
||||||
|
|
||||||
public string SessionUserId { get; set; }
|
public string SessionUserId { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -51,16 +51,14 @@ namespace TLSharp.Core
|
||||||
|
|
||||||
_sender = new MtProtoSender(_transport, _session);
|
_sender = new MtProtoSender(_transport, _session);
|
||||||
|
|
||||||
if (!reconnect)
|
//set-up layer
|
||||||
{
|
|
||||||
var config = new TLRequestGetConfig();
|
var config = new TLRequestGetConfig();
|
||||||
var request = new TLRequestInitConnection() { api_id = _apiId, app_version = "1.0.0", device_model = "PC", lang_code = "en", query = config, system_version = "Win 10.0" };
|
var request = new TLRequestInitConnection() { api_id = _apiId, app_version = "1.0.0", device_model = "PC", lang_code = "en", query = config, system_version = "Win 10.0" };
|
||||||
var invokewithLayer = new TLRequestInvokeWithLayer() { layer = 53, query = request };
|
var invokewithLayer = new TLRequestInvokeWithLayer() { layer = 57, query = request };
|
||||||
await _sender.Send(invokewithLayer);
|
await _sender.Send(invokewithLayer);
|
||||||
await _sender.Receive(invokewithLayer);
|
await _sender.Receive(invokewithLayer);
|
||||||
|
|
||||||
dcOptions = ((TLConfig)invokewithLayer.Response).dc_options.lists;
|
dcOptions = ((TLConfig)invokewithLayer.Response).dc_options.lists;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +157,6 @@ namespace TLSharp.Core
|
||||||
return (T)result;
|
return (T)result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<TLContacts> GetContactsAsync()
|
public async Task<TLContacts> GetContactsAsync()
|
||||||
{
|
{
|
||||||
if (!IsUserAuthorized())
|
if (!IsUserAuthorized())
|
||||||
|
|
|
||||||
|
|
@ -129,10 +129,6 @@ namespace TeleSharp.Generator
|
||||||
}
|
}
|
||||||
foreach (var c in schema.methods)
|
foreach (var c in schema.methods)
|
||||||
{
|
{
|
||||||
if (c.method.Contains("updateUsername"))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
string path = (GetNameSpace(c.method).Replace("TeleSharp.TL", "TL\\").Replace(".", "") + "\\" + GetNameofClass(c.method, false, true) + ".cs").Replace("\\\\", "\\");
|
string path = (GetNameSpace(c.method).Replace("TeleSharp.TL", "TL\\").Replace(".", "") + "\\" + GetNameofClass(c.method, false, true) + ".cs").Replace("\\\\", "\\");
|
||||||
FileStream classFile = MakeFile(path);
|
FileStream classFile = MakeFile(path);
|
||||||
using (StreamWriter writer = new StreamWriter(classFile))
|
using (StreamWriter writer = new StreamWriter(classFile))
|
||||||
|
|
@ -280,7 +276,6 @@ namespace TeleSharp.Generator
|
||||||
}
|
}
|
||||||
public static string GetTypeName(string type)
|
public static string GetTypeName(string type)
|
||||||
{
|
{
|
||||||
if (type.ToLower().Contains("inputcontact")) return "TLInputPhoneContact";
|
|
||||||
switch (type.ToLower())
|
switch (type.ToLower())
|
||||||
{
|
{
|
||||||
case "#":
|
case "#":
|
||||||
|
|
@ -304,10 +299,14 @@ namespace TeleSharp.Generator
|
||||||
case "x":
|
case "x":
|
||||||
return "TLObject";
|
return "TLObject";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.StartsWith("Vector"))
|
if (type.StartsWith("Vector"))
|
||||||
return "TLVector<" + GetTypeName(type.Replace("Vector<", "").Replace(">", "")) + ">";
|
return "TLVector<" + GetTypeName(type.Replace("Vector<", "").Replace(">", "")) + ">";
|
||||||
else
|
|
||||||
{
|
if (type.ToLower().Contains("inputcontact"))
|
||||||
|
return "TLInputPhoneContact";
|
||||||
|
|
||||||
|
|
||||||
if (type.IndexOf('.') != -1 && type.IndexOf('?') == -1)
|
if (type.IndexOf('.') != -1 && type.IndexOf('?') == -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -331,7 +330,7 @@ namespace TeleSharp.Generator
|
||||||
{
|
{
|
||||||
return GetTypeName(type.Split('?')[1]);
|
return GetTypeName(type.Split('?')[1]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public static string LookTypeInLists(string src)
|
public static string LookTypeInLists(string src)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace TeleSharp.TL.Contacts
|
||||||
|
|
||||||
public override void DeserializeBody(BinaryReader br)
|
public override void DeserializeBody(BinaryReader br)
|
||||||
{
|
{
|
||||||
contacts = ObjectUtils.DeserializeVector<TLInputPhoneContact>(br);
|
contacts = (TLVector<TLInputPhoneContact>)ObjectUtils.DeserializeVector<TLInputPhoneContact>(br);
|
||||||
replace = BoolUtil.Deserialize(br);
|
replace = BoolUtil.Deserialize(br);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue