mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Merge remote-tracking branch 'refs/remotes/origin/master' into pr/250
# Conflicts: # TLSharp.Core/TLSharp.Core.csproj
This commit is contained in:
commit
f40034ad09
|
|
@ -33,7 +33,7 @@ Library _almost_ ready for production usage. We need contributors to make 1.0.0
|
|||
To use TLSharp follow next steps:
|
||||
|
||||
1. Clone TLSharp from GitHub
|
||||
1. Compile source with VS2015
|
||||
1. Compile source with VS2015 or MonoDevelop
|
||||
1. Add reference to ```TLSharp.Core.dll``` to your awesome project.
|
||||
|
||||
# Dependencies
|
||||
|
|
@ -194,6 +194,7 @@ List of donators:
|
|||
|
||||
# Contributors
|
||||
* [Afshin Arani](http://aarani.ir) - TLGenerator, and a lot of other usefull things
|
||||
* [Knocte](https://github.com/knocte)
|
||||
|
||||
# License
|
||||
|
||||
|
|
|
|||
|
|
@ -279,9 +279,7 @@ namespace TLSharp.Core.Network
|
|||
{
|
||||
var resultString = Regex.Match(errorMessage, @"\d+").Value;
|
||||
var dcIdx = int.Parse(resultString);
|
||||
var exception = new InvalidOperationException($"Your phone number registered to {dcIdx} dc. Please update settings. See https://github.com/sochix/TLSharp#i-get-an-error-migrate_x for details.");
|
||||
exception.Data.Add("dcId", dcIdx);
|
||||
throw exception;
|
||||
throw new MigrationNeededException(dcIdx);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -484,4 +482,15 @@ namespace TLSharp.Core.Network
|
|||
return new MemoryStream(new byte[len], 0, len, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
internal class MigrationNeededException : Exception
|
||||
{
|
||||
internal int DC { get; private set; }
|
||||
|
||||
internal MigrationNeededException(int dc)
|
||||
: base ("$Your phone number is registered to a different dc: {dc}. Please migrate.")
|
||||
{
|
||||
DC = dc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TLSharp.Core</RootNamespace>
|
||||
<AssemblyName>TLSharp.Core</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
|
|
|||
|
|
@ -110,16 +110,9 @@ namespace TLSharp.Core
|
|||
|
||||
completed = true;
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
catch (MigrationNeededException ex)
|
||||
{
|
||||
if (ex.Message.StartsWith("Your phone number registered to") && ex.Data["dcId"] != null)
|
||||
{
|
||||
await ReconnectToDcAsync((int)ex.Data["dcId"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
await ReconnectToDcAsync(ex.DC);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TeleSharp.Generator</RootNamespace>
|
||||
<AssemblyName>TeleSharp.Generator</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TeleSharp.TL</RootNamespace>
|
||||
<AssemblyName>TeleSharp.TL</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
|
|
|||
Loading…
Reference in a new issue