Skip to content

Commit

Permalink
Update .editorconfig; Remove primary constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
OoLunar committed Feb 27, 2024
1 parent 4f057c3 commit e7fbae1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
14 changes: 12 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@ charset = utf-8
###############################
[*.{cs,vb}]

# Suppress IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = none

# Disable require license header
dotnet_diagnostic.IDE0073.severity = none

# Organize usings
dotnet_sort_system_directives_first = true:error

# Using directive is unnecessary.
dotnet_diagnostic.IDE0005.severity = error

# Use regular consturctors over primary constructors
csharp_style_prefer_primary_constructors = false

# Yell at people when they don't include the file header template
dotnet_diagnostic.IDE0073.severity = error

Expand Down Expand Up @@ -100,7 +110,7 @@ dotnet_naming_symbols.async_methods.applicable_kinds = method
dotnet_naming_symbols.async_methods.required_modifiers = async

# Don't force namespaces to match their folder names
dotnet_diagnostic.IDE0130.severity = none
dotnet_style_namespace_match_folder = false

###############################
# C# Coding Conventions #
Expand Down Expand Up @@ -172,4 +182,4 @@ csharp_space_between_method_call_empty_parameter_list_parentheses = false

# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_blocks = true
21 changes: 15 additions & 6 deletions src/DSharpPlus.VoiceLink/VoiceLinkConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

namespace DSharpPlus.VoiceLink
{
public sealed partial class VoiceLinkConnection(VoiceLinkExtension extension, DiscordChannel channel, VoiceState voiceState)
public sealed partial class VoiceLinkConnection
{
public VoiceState VoiceState { get; init; } = voiceState;
public VoiceLinkExtension Extension { get; init; } = extension;
public DiscordChannel Channel { get; init; } = channel;
public VoiceState VoiceState { get; init; }
public VoiceLinkExtension Extension { get; init; }
public DiscordChannel Channel { get; init; }
public DiscordGuild Guild => Channel.Guild;
public DiscordClient Client => Extension.Client;
public DiscordUser User => Client.CurrentUser;
Expand All @@ -38,10 +38,10 @@ public sealed partial class VoiceLinkConnection(VoiceLinkExtension extension, Di
public TimeSpan UdpPing { get; private set; }

// Audio processing
private ILogger<VoiceLinkConnection> _logger { get; init; } = extension.Configuration.ServiceProvider.GetRequiredService<ILogger<VoiceLinkConnection>>();
private ILogger<VoiceLinkConnection> _logger { get; init; }
private CancellationTokenSource _cancellationTokenSource { get; init; } = new();
private Dictionary<uint, VoiceLinkUser> _speakers { get; init; } = [];
private IVoiceEncrypter _voiceEncrypter { get; init; } = extension.Configuration.VoiceEncrypter;
private IVoiceEncrypter _voiceEncrypter { get; init; }
private byte[] _secretKey { get; set; } = [];
private Pipe _audioPipe { get; init; } = new();

Expand All @@ -55,6 +55,15 @@ public sealed partial class VoiceLinkConnection(VoiceLinkExtension extension, Di
private string? _voiceToken { get; set; }
private SemaphoreSlim _readySemaphore { get; init; } = new(0, 1);

public VoiceLinkConnection(VoiceLinkExtension extension, DiscordChannel channel, VoiceState voiceState)
{
VoiceState = voiceState;
Extension = extension;
Channel = channel;
_logger = extension.Configuration.ServiceProvider.GetRequiredService<ILogger<VoiceLinkConnection>>();
_voiceEncrypter = extension.Configuration.VoiceEncrypter;
}

public async ValueTask ReconnectAsync()
{
_cancellationTokenSource.Cancel();
Expand Down

0 comments on commit e7fbae1

Please sign in to comment.