Skip to content

Commit

Permalink
Mark most classes as sealed & partial
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Mar 26, 2024
1 parent 018f535 commit 9fe1196
Show file tree
Hide file tree
Showing 15 changed files with 1,933 additions and 1,932 deletions.
2 changes: 1 addition & 1 deletion .github/dev.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pr: none
trigger: [ master ]

name: 3.7.2-dev.$(Rev:r)
name: 4.0.0-dev.$(Rev:r)

pool:
vmImage: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pr: none
trigger: none

name: 3.7.$(Rev:r)
name: 4.0.0

pool:
vmImage: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

launchSettings.json

# User-specific files
*.rsuser
*.suo
Expand Down
2 changes: 1 addition & 1 deletion src/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ private RpcResult ReadRpcResult(BinaryReader reader)
return new RpcResult { req_msg_id = msgId, result = result };
}

class Rpc
private sealed class Rpc
{
internal Type type;
internal TaskCompletionSource<object> tcs = new(TaskCreationOptions.RunContinuationsAsynchronously);
Expand Down
4 changes: 2 additions & 2 deletions src/Encryption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ internal static byte[] AES_IGE_EncryptDecrypt(Span<byte> input, byte[] aes_key,
}

#if OBFUSCATION
internal class AesCtr(byte[] key, byte[] ivec) : IDisposable
internal sealed class AesCtr(byte[] key, byte[] ivec) : IDisposable
{
readonly ICryptoTransform _encryptor = AesECB.CreateEncryptor(key, null);
readonly byte[] _ecount = new byte[16];
Expand Down Expand Up @@ -518,7 +518,7 @@ private static byte[] PBKDF2_SHA512(byte[] password, byte[] salt, int iterationC
#endif
}

internal class AES_IGE_Stream : Helpers.IndirectStream
internal sealed class AES_IGE_Stream : Helpers.IndirectStream
{
private readonly ICryptoTransform _aesCrypto;
private readonly byte[] _prevBytes;
Expand Down
2 changes: 1 addition & 1 deletion src/SecretChats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public sealed class SecretChats : IDisposable
private const int ThresholdPFS = 100;

[TLDef(0xFEFEFEFE)]
internal class SecretChat : IObject, ISecretChat
internal sealed class SecretChat : IObject, ISecretChat
{
[Flags] public enum Flags : uint { requestChat = 1, renewKey = 2, acceptKey = 4, originator = 8, commitKey = 16 }
public Flags flags;
Expand Down
8 changes: 4 additions & 4 deletions src/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

namespace WTelegram
{
internal class Session : IDisposable
internal sealed partial class Session : IDisposable
{
public int ApiId;
public long UserId;
public int MainDC;
public Dictionary<int, DCSession> DCSessions = [];
public TL.DcOption[] DcOptions;

public class DCSession
public sealed class DCSession
{
public long Id;
public long AuthKeyID;
Expand Down Expand Up @@ -158,7 +158,7 @@ internal static Session LoadOrCreate(Stream store, byte[] rgbKey)
}
}

internal class SessionStore : FileStream // This class is designed to be high-performance and failure-resilient with Writes (but when you're Andrei, you can't understand that)
internal sealed class SessionStore : FileStream // This class is designed to be high-performance and failure-resilient with Writes (but when you're Andrei, you can't understand that)
{
public override long Length { get; }
public override long Position { get => base.Position; set { } }
Expand Down Expand Up @@ -192,7 +192,7 @@ public override void Write(byte[] buffer, int offset, int count)
}
}

internal class ActionStore(byte[] initial, Action<byte[]> save) : MemoryStream(initial ?? [])
internal sealed class ActionStore(byte[] initial, Action<byte[]> save) : MemoryStream(initial ?? [])
{
public override void Write(byte[] buffer, int offset, int count) => save(buffer[offset..(offset + count)]);
public override void SetLength(long value) { }
Expand Down
2 changes: 1 addition & 1 deletion src/TL.Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace TL
{
public static class Extensions
{
internal class CollectorPeer : Peer
internal sealed partial class CollectorPeer : Peer
{
public override long ID => 0;
internal IDictionary<long, User> _users;
Expand Down
Loading

0 comments on commit 9fe1196

Please sign in to comment.