diff --git a/.gitignore b/.gitignore index cc0ab25..ede6a7e 100644 --- a/.gitignore +++ b/.gitignore @@ -221,3 +221,7 @@ FakesAssemblies/ **/*.Server/GeneratedArtifacts **/*.Server/ModelManifest.xml _Pvt_Extensions + +NuGet.Config +.envrc +.tool-versions \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..db80302 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +all: pack publish +pack: + ./scripts/pack.sh +publish: + ./scripts/publish.sh +bump: + ./scripts/bump.sh + + \ No newline at end of file diff --git a/TLSharp.Core/Network/TcpMessage.cs b/TLSharp.Core/Network/TcpMessage.cs index 91ef84c..c59c7a3 100644 --- a/TLSharp.Core/Network/TcpMessage.cs +++ b/TLSharp.Core/Network/TcpMessage.cs @@ -1,6 +1,7 @@ using System; using System.IO; using Ionic.Crc; +using Ionic.Zlib; namespace TLSharp.Core.Network { diff --git a/TLSharp.Core/Network/TcpTransport.cs b/TLSharp.Core/Network/TcpTransport.cs index d501751..845da75 100644 --- a/TLSharp.Core/Network/TcpTransport.cs +++ b/TLSharp.Core/Network/TcpTransport.cs @@ -2,6 +2,7 @@ using System.Net; using System.Net.Sockets; using System.Threading.Tasks; +using Ionic.Crc; namespace TLSharp.Core.Network { @@ -79,7 +80,7 @@ namespace TLSharp.Core.Network Buffer.BlockCopy(packetLengthBytes, 0, rv, 0, packetLengthBytes.Length); Buffer.BlockCopy(seqBytes, 0, rv, packetLengthBytes.Length, seqBytes.Length); Buffer.BlockCopy(body, 0, rv, packetLengthBytes.Length + seqBytes.Length, body.Length); - var crc32 = new Ionic.Crc.CRC32(); + var crc32 = new CRC32(); crc32.SlurpBlock(rv, 0, rv.Length); var validChecksum = crc32.Crc32Result; diff --git a/TLSharp.Core/Requests/AuthSendCodeRequest.cs b/TLSharp.Core/Requests/AuthSendCodeRequest.cs deleted file mode 100644 index 06852a8..0000000 --- a/TLSharp.Core/Requests/AuthSendCodeRequest.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.IO; -using TLSharp.Core.MTProto; -using TeleSharp.TL; -namespace TLSharp.Core.Requests -{ - public class AuthSendCodeRequest : MTProtoRequest - { - - public bool _phoneRegistered; - public string _phoneCodeHash; - public SendCodeArgs args=new SendCodeArgs(); - public AuthSendCodeRequest(string phoneNumber, int smsType, int apiId, string apiHash, string langCode) - { - - args.phone_number = phoneNumber; - args.api_id = apiId; - args.api_hash = apiHash; - args.allow_flashcall = false; - args.current_number = true; - } - - public override void OnSend(BinaryWriter writer) - { - writer.Write(0x86AEF0EC); - writer.Write(0); - Serializers.String.write(writer, args.phone_number); - writer.Write(args.api_id.Value); - Serializers.String.write(writer, args.api_hash); - } - - public override void OnResponse(BinaryReader reader) - { - - var s = Deserializer.Deserialize(typeof(SentCode), reader); - _phoneRegistered = ((SentCode)s).phone_registered; - _phoneCodeHash = ((SentCode)s).phone_code_hash; - } - - public override void OnException(Exception exception) - { - throw new NotImplementedException(); - } - - public override bool Confirmed => true; - public override bool Responded { get; } - } -} diff --git a/TLSharp.Core/Requests/AuthSignInRequest.cs b/TLSharp.Core/Requests/AuthSignInRequest.cs deleted file mode 100644 index 83dc2c2..0000000 --- a/TLSharp.Core/Requests/AuthSignInRequest.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.IO; -using TeleSharp.TL; -namespace TLSharp.Core.Requests -{ - public class AuthSignInRequest : MTProtoRequest - { - private SignInArgs args = new SignInArgs(); - public User user; - public int SessionExpires; - - public AuthSignInRequest(string phoneNumber, string phoneCodeHash, string code) - { - args.phone_number = phoneNumber; - args.phone_code_hash = phoneCodeHash; - args.phone_code = code; - } - - public override void OnSend(BinaryWriter writer) - { - Serializer.Serialize(args, typeof(SignInArgs), writer); - } - - public override void OnResponse(BinaryReader reader) - { - var auth = (Authorization)Deserializer.Deserialize(typeof(Authorization), reader); - user = auth.user; - } - - public override void OnException(Exception exception) - { - throw new NotImplementedException(); - } - - public override bool Confirmed => true; - public override bool Responded { get; } - } -} diff --git a/TLSharp.Core/Requests/DownloadFileRequest.cs b/TLSharp.Core/Requests/DownloadFileRequest.cs deleted file mode 100644 index 4574a9b..0000000 --- a/TLSharp.Core/Requests/DownloadFileRequest.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.IO; -using TeleSharp.TL; -namespace TLSharp.Core.Requests -{ - public class DownloadFileRequest : MTProtoRequest - { - private GetFileArgs args = new GetFileArgs(); - public TeleSharp.TL.File file; - - public DownloadFileRequest(InputFileLocation loc,int offset=0,int limit=0) - { - args.location = loc; - args.offset = offset; - args.limit = limit; - } - - public override void OnSend(BinaryWriter writer) - { - Serializer.Serialize(args, typeof(InputFileLocation), writer); - } - - public override void OnResponse(BinaryReader reader) - { - file = (TeleSharp.TL.File)Deserializer.Deserialize(typeof(TeleSharp.TL.File), reader); - } - - public override void OnException(Exception exception) - { - throw new NotImplementedException(); - } - - public override bool Confirmed => true; - public override bool Responded { get; } - } -} diff --git a/TLSharp.Core/Requests/InitConnectionRequest.cs b/TLSharp.Core/Requests/InitConnectionRequest.cs deleted file mode 100644 index b428e8d..0000000 --- a/TLSharp.Core/Requests/InitConnectionRequest.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using TeleSharp.TL; -using TLSharp.Core.MTProto; - -namespace TLSharp.Core.Requests -{ - public class InitConnectionRequest : MTProtoRequest - { - public InvokeWithLayerArgs invokeWithLayer { get; set; } - public InitConnectionArgs initConn { get; set; } - public GetConfigArgs getConfig { get; set; } - public TeleSharp.TL.Config Configs { get; set; } - - public InitConnectionRequest(int apiId) - { - invokeWithLayer = new InvokeWithLayerArgs(); - initConn = new InitConnectionArgs(); - invokeWithLayer.layer = 53; - initConn.api_id = apiId; - initConn.app_version = "1.0-SNAPSHOT"; - initConn.lang_code = "en"; - initConn.system_version = "WinPhone 8.0"; - initConn.device_model = "WinPhone Emulator"; - initConn.query = new GetConfigArgs(); - invokeWithLayer.query = initConn; - } - - public override void OnSend(BinaryWriter writer) - { - Serializer.Serialize(invokeWithLayer, invokeWithLayer.GetType(), writer); - } - - - public override void OnResponse(BinaryReader reader) - { - Configs = (TeleSharp.TL.Config)Deserializer.Deserialize(typeof(TeleSharp.TL.Config), reader); - } - - public override void OnException(Exception exception) - { - throw new NotImplementedException(); - } - - public override bool Responded - { - get { return true; } - } - - public override void OnSendSuccess() - { - - } - public override bool Confirmed => true; - } -} diff --git a/TLSharp.Core/TLSharp.Core.csproj b/TLSharp.Core/TLSharp.Core.csproj index 74efe73..4247f22 100644 --- a/TLSharp.Core/TLSharp.Core.csproj +++ b/TLSharp.Core/TLSharp.Core.csproj @@ -1,16 +1,44 @@  - - + Debug AnyCPU {400D2544-1CC6-4D8A-A62C-2292D9947A16} Library + TLSharp + Telegram client library implemented in C# + Ilya P + 0.1.0.433 + telegram client;telegram API + http://sochix.github.io/TLSharp/ + https://core.telegram.org/favicon.ico + false + Unofficial Telegram (http://telegram.org) client library implemented in C#. Latest TL scheme + supported. + + Consider donation to speed up development process. + + Bitcoin wallet: 3K1ocweFgaHnAibJ3n6hX7RNZWFTFcJjUe + + It's a perfect fit for any developer who would like to send data directly to Telegram users or write own + custom Telegram client. + MIT + Copyright 2019 + git + https://github.com/sochix/TLSharp + false + false + false + false + false + false + true Properties TLSharp.Core TLSharp.Core - v4.5 + netstandard2.0 512 + $(TargetsForTfmSpecificBuildOutput);IncludeTLAssets true @@ -30,10 +58,12 @@ 4 - - ..\packages\MarkerMetro.Unity.Ionic.Zlib.2.0.0.14\lib\net35\Ionic.ZLib.dll - True - + + + + + + @@ -44,42 +74,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + {d6144517-91d2-4880-86df-e9ff5d7f383a} TeleSharp.TL - + + + + + + + + + <_UnmanagedRegistrationCache Remove="obj\TLSharp.Core.csproj.UnmanagedRegistration.cache" /> + + + + <_ResolveComReferenceCache Remove="obj\Debug\netstandard2.0\TLSharp.Core.csproj.ResolveComReference.cache" /> + + + + + + + + <_DebugSymbolsIntermediatePath Remove="obj\Debug\netstandard2.0\TLSharp.Core.pdb" /> + + + + <_DeploymentManifestEntryPoint Remove="obj\Debug\netstandard2.0\TLSharp.Core.dll" /> + + + + + + + + + +