mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
use primary constructors
This commit is contained in:
parent
0738adc3bf
commit
d00725e234
2
.github/dev.yml
vendored
2
.github/dev.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<long, User> _users;
|
||||
|
|
|
|||
26
src/TL.cs
26
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;
|
||||
/// <summary>The value of X in the message, -1 if no variable X was found</summary>
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue