From d62e35df8e118078ab852d58ab87c90ed10439e7 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Mon, 22 Jan 2018 21:48:48 +0100 Subject: [PATCH 01/10] [Core] Change libs to netstandard -> Make it run on Linux, rename unused files to *.cs.bak --- TLSharp.Core/Properties/AssemblyInfo.cs | 36 - ...eRequest.cs => AuthSendCodeRequest.cs.bak} | 0 ...nInRequest.cs => AuthSignInRequest.cs.bak} | 0 ...eRequest.cs => DownloadFileRequest.cs.bak} | 0 ...equest.cs => InitConnectionRequest.cs.bak} | 0 ...TProtoRequest.cs => MTProtoRequest.cs.bak} | 0 TLSharp.Core/TLSharp.Core.csproj | 100 +- .../TLSharp.Tests.NUnit.csproj | 15 +- TLSharp.Tests.NUnit/Test.cs | 3 +- TLSharp.Tests.VS/TLSharp.Tests.VS.csproj | 3 +- TLSharp.Tests/TLSharp.Tests.csproj | 3 +- TLSharp.Tests/app.config | 12 +- TeleSharp.Generator/App.config | 6 +- .../TeleSharp.Generator.csproj | 10 +- TeleSharp.TL/Properties/AssemblyInfo.cs | 36 - TeleSharp.TL/TeleSharp.TL.csproj | 950 +----------------- 16 files changed, 67 insertions(+), 1107 deletions(-) delete mode 100644 TLSharp.Core/Properties/AssemblyInfo.cs rename TLSharp.Core/Requests/{AuthSendCodeRequest.cs => AuthSendCodeRequest.cs.bak} (100%) rename TLSharp.Core/Requests/{AuthSignInRequest.cs => AuthSignInRequest.cs.bak} (100%) rename TLSharp.Core/Requests/{DownloadFileRequest.cs => DownloadFileRequest.cs.bak} (100%) rename TLSharp.Core/Requests/{InitConnectionRequest.cs => InitConnectionRequest.cs.bak} (100%) rename TLSharp.Core/Requests/{MTProtoRequest.cs => MTProtoRequest.cs.bak} (100%) delete mode 100644 TeleSharp.TL/Properties/AssemblyInfo.cs diff --git a/TLSharp.Core/Properties/AssemblyInfo.cs b/TLSharp.Core/Properties/AssemblyInfo.cs deleted file mode 100644 index 856dc61d..00000000 --- a/TLSharp.Core/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TLSharp.Core")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TLSharp.Core")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("400d2544-1cc6-4d8a-a62c-2292d9947a16")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TLSharp.Core/Requests/AuthSendCodeRequest.cs b/TLSharp.Core/Requests/AuthSendCodeRequest.cs.bak similarity index 100% rename from TLSharp.Core/Requests/AuthSendCodeRequest.cs rename to TLSharp.Core/Requests/AuthSendCodeRequest.cs.bak diff --git a/TLSharp.Core/Requests/AuthSignInRequest.cs b/TLSharp.Core/Requests/AuthSignInRequest.cs.bak similarity index 100% rename from TLSharp.Core/Requests/AuthSignInRequest.cs rename to TLSharp.Core/Requests/AuthSignInRequest.cs.bak diff --git a/TLSharp.Core/Requests/DownloadFileRequest.cs b/TLSharp.Core/Requests/DownloadFileRequest.cs.bak similarity index 100% rename from TLSharp.Core/Requests/DownloadFileRequest.cs rename to TLSharp.Core/Requests/DownloadFileRequest.cs.bak diff --git a/TLSharp.Core/Requests/InitConnectionRequest.cs b/TLSharp.Core/Requests/InitConnectionRequest.cs.bak similarity index 100% rename from TLSharp.Core/Requests/InitConnectionRequest.cs rename to TLSharp.Core/Requests/InitConnectionRequest.cs.bak diff --git a/TLSharp.Core/Requests/MTProtoRequest.cs b/TLSharp.Core/Requests/MTProtoRequest.cs.bak similarity index 100% rename from TLSharp.Core/Requests/MTProtoRequest.cs rename to TLSharp.Core/Requests/MTProtoRequest.cs.bak diff --git a/TLSharp.Core/TLSharp.Core.csproj b/TLSharp.Core/TLSharp.Core.csproj index fbef9425..55b79f73 100644 --- a/TLSharp.Core/TLSharp.Core.csproj +++ b/TLSharp.Core/TLSharp.Core.csproj @@ -1,89 +1,31 @@ - - - + + - Debug - AnyCPU - {400D2544-1CC6-4D8A-A62C-2292D9947A16} - Library - Properties - TLSharp.Core - TLSharp.Core - v4.5 - 512 + netstandard2.0;net47 + TLSharp.Core + 1.0.1 + TLSharp.Core + TLSharp.Core + TLSharp.Core + 1.0.1.0 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 + + - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + + - - ..\packages\MarkerMetro.Unity.Ionic.Zlib.2.0.0.14\lib\net35\Ionic.ZLib.dll - True - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - {d6144517-91d2-4880-86df-e9ff5d7f383a} - TeleSharp.TL - - - - - \ No newline at end of file + + diff --git a/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj b/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj index e947f4e9..36d808b6 100644 --- a/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj +++ b/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj @@ -1,5 +1,5 @@ - - + + Debug AnyCPU @@ -7,7 +7,8 @@ Library TLSharp.Tests.NUnit TLSharp.Tests.NUnit - v4.5 + v4.7 + true @@ -30,7 +31,7 @@ - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + ..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll @@ -40,15 +41,13 @@ app.config - - - + {DE5C0467-EE99-4734-95F2-EFF7A0B99924} TLSharp.Tests - + \ No newline at end of file diff --git a/TLSharp.Tests.NUnit/Test.cs b/TLSharp.Tests.NUnit/Test.cs index 40e54ac6..bbd427bb 100644 --- a/TLSharp.Tests.NUnit/Test.cs +++ b/TLSharp.Tests.NUnit/Test.cs @@ -6,10 +6,9 @@ namespace TLSharp.Tests { - [TestFixture] public class TLSharpTestsNUnit : TLSharpTests { - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { base.Init(o => Assert.IsNotNull(o), b => Assert.IsTrue(b)); diff --git a/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj b/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj index a44fff4b..55797f22 100644 --- a/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj +++ b/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj @@ -8,7 +8,7 @@ Properties TLSharp.Tests.VS TLSharp.Tests.VS - v4.5 + v4.7 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0 @@ -16,6 +16,7 @@ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages False UnitTest + true diff --git a/TLSharp.Tests/TLSharp.Tests.csproj b/TLSharp.Tests/TLSharp.Tests.csproj index e2277f1c..c39c1956 100644 --- a/TLSharp.Tests/TLSharp.Tests.csproj +++ b/TLSharp.Tests/TLSharp.Tests.csproj @@ -9,8 +9,9 @@ Properties TLSharp.Tests TLSharp.Tests - v4.5 + v4.7 512 + true diff --git a/TLSharp.Tests/app.config b/TLSharp.Tests/app.config index 490261d2..f4f7640b 100644 --- a/TLSharp.Tests/app.config +++ b/TLSharp.Tests/app.config @@ -1,10 +1,10 @@ - + - - - - + + + + @@ -12,4 +12,4 @@ - + diff --git a/TeleSharp.Generator/App.config b/TeleSharp.Generator/App.config index 88fa4027..9d2c7adf 100644 --- a/TeleSharp.Generator/App.config +++ b/TeleSharp.Generator/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/TeleSharp.Generator/TeleSharp.Generator.csproj b/TeleSharp.Generator/TeleSharp.Generator.csproj index 94f3e9b3..7de9007d 100644 --- a/TeleSharp.Generator/TeleSharp.Generator.csproj +++ b/TeleSharp.Generator/TeleSharp.Generator.csproj @@ -9,9 +9,10 @@ Properties TeleSharp.Generator TeleSharp.Generator - v4.5 + v4.7 512 true + AnyCPU @@ -33,10 +34,6 @@ 4 - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True - @@ -45,6 +42,9 @@ + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + diff --git a/TeleSharp.TL/Properties/AssemblyInfo.cs b/TeleSharp.TL/Properties/AssemblyInfo.cs deleted file mode 100644 index 3ff3c974..00000000 --- a/TeleSharp.TL/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TeleSharp.TL")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TeleSharp.TL")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d6144517-91d2-4880-86df-e9ff5d7f383a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TeleSharp.TL/TeleSharp.TL.csproj b/TeleSharp.TL/TeleSharp.TL.csproj index 7c6b30c8..77b3f411 100644 --- a/TeleSharp.TL/TeleSharp.TL.csproj +++ b/TeleSharp.TL/TeleSharp.TL.csproj @@ -1,938 +1,28 @@ - - - + + - Debug - AnyCPU - {D6144517-91D2-4880-86DF-E9FF5D7F383A} - Library - Properties - TeleSharp.TL - TeleSharp.TL - v4.5 - 512 + netstandard2.0;net47 + 1.0.1.0 + 1.0.1.0 + 1.0.1 + TeleSharp.TL + TeleSharp.TL + TeleSharp.TL + TeleSharp.TL - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 + + - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + + - - ..\packages\BigMath.0.5.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\BigMath.dll - True - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - \ No newline at end of file + + From bc306495ec67a25a55a2f6bf786a9cb92f7ceb28 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Mon, 22 Jan 2018 22:02:20 +0100 Subject: [PATCH 02/10] [Core] Upgrade packages to support netstandard --- TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj | 4 ++-- TLSharp.Tests.NUnit/packages.config | 2 +- TeleSharp.Generator/TeleSharp.Generator.csproj | 6 +++--- TeleSharp.Generator/packages.config | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj b/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj index 36d808b6..dcb982c9 100644 --- a/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj +++ b/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj @@ -29,10 +29,10 @@ false - - + ..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll + diff --git a/TLSharp.Tests.NUnit/packages.config b/TLSharp.Tests.NUnit/packages.config index c714ef3a..64ebca7f 100644 --- a/TLSharp.Tests.NUnit/packages.config +++ b/TLSharp.Tests.NUnit/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/TeleSharp.Generator/TeleSharp.Generator.csproj b/TeleSharp.Generator/TeleSharp.Generator.csproj index 7de9007d..71141207 100644 --- a/TeleSharp.Generator/TeleSharp.Generator.csproj +++ b/TeleSharp.Generator/TeleSharp.Generator.csproj @@ -34,6 +34,9 @@ 4 + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + @@ -42,9 +45,6 @@ - - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - diff --git a/TeleSharp.Generator/packages.config b/TeleSharp.Generator/packages.config index 9d64bf36..e157ba14 100644 --- a/TeleSharp.Generator/packages.config +++ b/TeleSharp.Generator/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file From c621164ff44ab1721f2f11de3f70a8535069c3a4 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Mon, 22 Jan 2018 22:14:56 +0100 Subject: [PATCH 03/10] [Core] Fix appveyor build (VS2015 dont support netstandard) --- TLSharp.sln | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TLSharp.sln b/TLSharp.sln index 4f55f1bd..228018b9 100644 --- a/TLSharp.sln +++ b/TLSharp.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2024 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Core", "TLSharp.Core\TLSharp.Core.csproj", "{400D2544-1CC6-4D8A-A62C-2292D9947A16}" EndProject From 9fe43b52f94853936e1bd15774deee45fecf1b27 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Sat, 10 Feb 2018 00:37:38 +0100 Subject: [PATCH 04/10] [Core] Drop unused files --- .../Requests/AuthSendCodeRequest.cs.bak | 48 --------------- .../Requests/AuthSignInRequest.cs.bak | 38 ------------ .../Requests/DownloadFileRequest.cs.bak | 36 ------------ .../Requests/InitConnectionRequest.cs.bak | 58 ------------------- TLSharp.Core/Requests/MTProtoRequest.cs.bak | 46 --------------- 5 files changed, 226 deletions(-) delete mode 100644 TLSharp.Core/Requests/AuthSendCodeRequest.cs.bak delete mode 100644 TLSharp.Core/Requests/AuthSignInRequest.cs.bak delete mode 100644 TLSharp.Core/Requests/DownloadFileRequest.cs.bak delete mode 100644 TLSharp.Core/Requests/InitConnectionRequest.cs.bak delete mode 100644 TLSharp.Core/Requests/MTProtoRequest.cs.bak diff --git a/TLSharp.Core/Requests/AuthSendCodeRequest.cs.bak b/TLSharp.Core/Requests/AuthSendCodeRequest.cs.bak deleted file mode 100644 index 06852a85..00000000 --- a/TLSharp.Core/Requests/AuthSendCodeRequest.cs.bak +++ /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.bak b/TLSharp.Core/Requests/AuthSignInRequest.cs.bak deleted file mode 100644 index 83dc2c20..00000000 --- a/TLSharp.Core/Requests/AuthSignInRequest.cs.bak +++ /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.bak b/TLSharp.Core/Requests/DownloadFileRequest.cs.bak deleted file mode 100644 index 4574a9b0..00000000 --- a/TLSharp.Core/Requests/DownloadFileRequest.cs.bak +++ /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.bak b/TLSharp.Core/Requests/InitConnectionRequest.cs.bak deleted file mode 100644 index b428e8db..00000000 --- a/TLSharp.Core/Requests/InitConnectionRequest.cs.bak +++ /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/Requests/MTProtoRequest.cs.bak b/TLSharp.Core/Requests/MTProtoRequest.cs.bak deleted file mode 100644 index c095d397..00000000 --- a/TLSharp.Core/Requests/MTProtoRequest.cs.bak +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.IO; - -namespace TLSharp.Core.Requests -{ - public abstract class MTProtoRequest - { - public MTProtoRequest() - { - Sended = false; - } - - public long MessageId { get; set; } - public int Sequence { get; set; } - - public bool Dirty { get; set; } - - public bool Sended { get; private set; } - public DateTime SendTime { get; private set; } - public bool ConfirmReceived { get; set; } - public abstract void OnSend(BinaryWriter writer); - public abstract void OnResponse(BinaryReader reader); - public abstract void OnException(Exception exception); - public abstract bool Confirmed { get; } - public abstract bool Responded { get; } - - public virtual void OnSendSuccess() - { - SendTime = DateTime.Now; - Sended = true; - } - - public virtual void OnConfirm() - { - ConfirmReceived = true; - } - - public bool NeedResend - { - get - { - return Dirty || (Confirmed && !ConfirmReceived && DateTime.Now - SendTime > TimeSpan.FromSeconds(3)); - } - } - } -} From 81bbe62c5cdabde91fed2edc1897c8262e8dc9fd Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Wed, 21 Mar 2018 01:12:52 +0100 Subject: [PATCH 05/10] [Core] Change .NET Full Framework from 4.7 to 4.6.1 --- TLSharp.Core/TLSharp.Core.csproj | 4 ++-- TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj | 2 +- TLSharp.Tests.VS/TLSharp.Tests.VS.csproj | 2 +- TLSharp.Tests/TLSharp.Tests.csproj | 2 +- TeleSharp.Generator/TeleSharp.Generator.csproj | 2 +- TeleSharp.TL/TeleSharp.TL.csproj | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TLSharp.Core/TLSharp.Core.csproj b/TLSharp.Core/TLSharp.Core.csproj index 55b79f73..2033ee08 100644 --- a/TLSharp.Core/TLSharp.Core.csproj +++ b/TLSharp.Core/TLSharp.Core.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net47 + netstandard2.0;net461 TLSharp.Core 1.0.1 TLSharp.Core @@ -13,7 +13,7 @@ - + diff --git a/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj b/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj index dcb982c9..1cb2d2e5 100644 --- a/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj +++ b/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj @@ -7,7 +7,7 @@ Library TLSharp.Tests.NUnit TLSharp.Tests.NUnit - v4.7 + v4.6.1 diff --git a/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj b/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj index 55797f22..8582dcf0 100644 --- a/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj +++ b/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj @@ -8,7 +8,7 @@ Properties TLSharp.Tests.VS TLSharp.Tests.VS - v4.7 + v4.6.1 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0 diff --git a/TLSharp.Tests/TLSharp.Tests.csproj b/TLSharp.Tests/TLSharp.Tests.csproj index c39c1956..f9974155 100644 --- a/TLSharp.Tests/TLSharp.Tests.csproj +++ b/TLSharp.Tests/TLSharp.Tests.csproj @@ -9,7 +9,7 @@ Properties TLSharp.Tests TLSharp.Tests - v4.7 + v4.6.1 512 diff --git a/TeleSharp.Generator/TeleSharp.Generator.csproj b/TeleSharp.Generator/TeleSharp.Generator.csproj index 71141207..dcdc6546 100644 --- a/TeleSharp.Generator/TeleSharp.Generator.csproj +++ b/TeleSharp.Generator/TeleSharp.Generator.csproj @@ -9,7 +9,7 @@ Properties TeleSharp.Generator TeleSharp.Generator - v4.7 + v4.6.1 512 true diff --git a/TeleSharp.TL/TeleSharp.TL.csproj b/TeleSharp.TL/TeleSharp.TL.csproj index 77b3f411..b1a1ce9f 100644 --- a/TeleSharp.TL/TeleSharp.TL.csproj +++ b/TeleSharp.TL/TeleSharp.TL.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net47 + netstandard2.0;net461 1.0.1.0 1.0.1.0 1.0.1 @@ -14,7 +14,7 @@ - + From 5eea677a93020cf3e061a20cb591f122b0e6eb82 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Wed, 21 Mar 2018 01:33:17 +0100 Subject: [PATCH 06/10] [Core] Avoid double loading if calling assembly is already loaded on runtime --- TeleSharp.TL/TLContext.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/TeleSharp.TL/TLContext.cs b/TeleSharp.TL/TLContext.cs index db686aa8..74b6cec2 100644 --- a/TeleSharp.TL/TLContext.cs +++ b/TeleSharp.TL/TLContext.cs @@ -14,13 +14,20 @@ public static class TLContext public static void Init() { - Types = new Dictionary(); - 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<>)); + try + { + Types = new Dictionary(); + 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) { From 5e060a160b6400f288c0473b683531df97e818dd Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Thu, 22 Mar 2018 03:13:06 +0100 Subject: [PATCH 07/10] [Core] Some fixes for Full 4.6.1 Framework --- TLSharp.Tests.NUnit/packages.config | 2 +- TLSharp.Tests/app.config | 3 ++- TeleSharp.Generator/App.config | 2 +- TeleSharp.Generator/packages.config | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TLSharp.Tests.NUnit/packages.config b/TLSharp.Tests.NUnit/packages.config index 64ebca7f..b93fa214 100644 --- a/TLSharp.Tests.NUnit/packages.config +++ b/TLSharp.Tests.NUnit/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/TLSharp.Tests/app.config b/TLSharp.Tests/app.config index f4f7640b..c6c8cfd7 100644 --- a/TLSharp.Tests/app.config +++ b/TLSharp.Tests/app.config @@ -12,4 +12,5 @@ - + + diff --git a/TeleSharp.Generator/App.config b/TeleSharp.Generator/App.config index 9d2c7adf..bae5d6d8 100644 --- a/TeleSharp.Generator/App.config +++ b/TeleSharp.Generator/App.config @@ -1,6 +1,6 @@ - + diff --git a/TeleSharp.Generator/packages.config b/TeleSharp.Generator/packages.config index e157ba14..e4ac9c6d 100644 --- a/TeleSharp.Generator/packages.config +++ b/TeleSharp.Generator/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file From e52f1caeee1810db5cc3023bf594f355b328a8ba Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Thu, 22 Mar 2018 03:53:52 +0100 Subject: [PATCH 08/10] [Core] Add proper method to check double loading --- TeleSharp.TL/TLContext.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/TeleSharp.TL/TLContext.cs b/TeleSharp.TL/TLContext.cs index 74b6cec2..8550c28c 100644 --- a/TeleSharp.TL/TLContext.cs +++ b/TeleSharp.TL/TLContext.cs @@ -14,20 +14,17 @@ public static class TLContext public static void Init() { - try + Types = new Dictionary(); + 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)) { - Types = new Dictionary(); - 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) { From b4024e101ee7867e07dc45301fb15381ba010626 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Thu, 22 Mar 2018 03:59:22 +0100 Subject: [PATCH 09/10] [Core] Readd old file with spaces for PR --- TLSharp.Tests/app.config | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/TLSharp.Tests/app.config b/TLSharp.Tests/app.config index c6c8cfd7..212c0c3c 100644 --- a/TLSharp.Tests/app.config +++ b/TLSharp.Tests/app.config @@ -1,10 +1,10 @@ - + - - - - + + + + @@ -12,5 +12,4 @@ - - + \ No newline at end of file From c443ad0cc0d6d7b72a787fd0124f33fbd1b388f0 Mon Sep 17 00:00:00 2001 From: LORDofDOOM Date: Thu, 22 Mar 2018 04:01:20 +0100 Subject: [PATCH 10/10] [Core] Changed type check as suggested by @knocte --- TeleSharp.TL/TLContext.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/TeleSharp.TL/TLContext.cs b/TeleSharp.TL/TLContext.cs index 8550c28c..f13d83e2 100644 --- a/TeleSharp.TL/TLContext.cs +++ b/TeleSharp.TL/TLContext.cs @@ -20,11 +20,7 @@ public static void Init() 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)) - { - Types.Add(481674261, typeof(TLVector<>)); - } + Types[481674261] = typeof(TLVector<>); } public static Type getType(int Constructor) {