diff --git a/.github/dev.yml b/.github/dev.yml index 7b6b9f6..7ca15b3 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.7.1-dev.$(Rev:r) +name: 3.7.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index cd808eb..3f568f4 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -815,7 +815,7 @@ namespace WTelegram _paddedMode = true; secret = secret[1..17]; } - else if (secret.Length != 16) throw new ArgumentException("Invalid/unsupported secret", nameof(secret)); + else if (secret.Length != 16) throw new ArgumentException("Invalid/unsupported secret"); Helpers.Log(2, $"Connecting to DC {dcId} via MTProxy {server}:{port}..."); _tcpClient = await TcpHandler(server, port); _networkStream = _tcpClient.GetStream(); diff --git a/src/Helpers.cs b/src/Helpers.cs index decf66c..f1569c0 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -235,11 +235,10 @@ namespace WTelegram internal static string GetAppVersion() => (Assembly.GetEntryAssembly() ?? Array.Find(AppDomain.CurrentDomain.GetAssemblies(), a => a.EntryPoint != null))?.GetName().Version.ToString() ?? "0.0"; - public class IndirectStream : Stream + public class IndirectStream(Stream innerStream) : Stream { - public IndirectStream(Stream innerStream) => _innerStream = innerStream; public long? ContentLength; - protected readonly Stream _innerStream; + protected readonly Stream _innerStream = innerStream; public override bool CanRead => _innerStream.CanRead; public override bool CanSeek => ContentLength.HasValue || _innerStream.CanSeek; public override bool CanWrite => _innerStream.CanWrite; diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index a4baf3a..15ce256 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -11,7 +11,7 @@ namespace TL { public static class Extensions { - private class CollectorPeer : Peer + internal class CollectorPeer : Peer { public override long ID => 0; internal IDictionary _users; diff --git a/src/TL.cs b/src/TL.cs index 77e8087..d3872a1 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -16,26 +16,23 @@ namespace TL public interface IPeerResolver { IPeerInfo UserOrChat(Peer peer); } [AttributeUsage(AttributeTargets.Class)] - public class TLDefAttribute : Attribute + public class TLDefAttribute(uint ctorNb) : Attribute { - public readonly uint CtorNb; - public TLDefAttribute(uint ctorNb) => CtorNb = ctorNb; + public readonly uint CtorNb = ctorNb; public bool inheritBefore; } [AttributeUsage(AttributeTargets.Field)] - public class IfFlagAttribute : Attribute + public class IfFlagAttribute(int bit) : Attribute { - public readonly int Bit; - public IfFlagAttribute(int bit) => Bit = bit; + public readonly int Bit = bit; } - public class RpcException : WTelegram.WTException + public class RpcException(int code, string message, int x = -1) : WTelegram.WTException(message) { - public readonly int Code; + public readonly int Code = code; /// The value of X in the message, -1 if no variable X was found - public readonly int X; - public RpcException(int code, string message, int x = -1) : base(message) { Code = code; X = x; } + public readonly int X = x; public override string ToString() { var str = base.ToString(); return str.Insert(str.IndexOf(':') + 1, " " + Code); } } @@ -372,13 +369,12 @@ namespace TL } [TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message - public class _Message : IObject + public class _Message(long msgId, int seqNo, IObject obj) : IObject { - public _Message(long msgId, int seqNo, IObject obj) { msg_id = msgId; seq_no = seqNo; body = obj; } - public long msg_id; - public int seq_no; + public long msg_id = msgId; + public int seq_no = seqNo; public int bytes; - public IObject body; + public IObject body = obj; } [TLDef(0x73F1F8DC)] //msg_container#73f1f8dc messages:vector<%Message> = MessageContainer