Fixed some of the compiler warnings.

This commit is contained in:
Tom
2024-12-28 21:19:28 +00:00
parent db1d57c218
commit 4f5dd8f24e
20 changed files with 93 additions and 131 deletions

View File

@@ -83,12 +83,12 @@ namespace TwitchChatTTS.Twitch.Redemptions
switch (action.Type)
{
case "WRITE_TO_FILE":
Directory.CreateDirectory(Path.GetDirectoryName(action.Data["file_path"]));
Directory.CreateDirectory(Path.GetDirectoryName(action.Data["file_path"])!);
await File.WriteAllTextAsync(action.Data["file_path"], ReplaceContentText(action.Data["file_content"], senderDisplayName));
_logger.Debug($"Overwritten text to file [file: {action.Data["file_path"]}][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;
case "APPEND_TO_FILE":
Directory.CreateDirectory(Path.GetDirectoryName(action.Data["file_path"]));
Directory.CreateDirectory(Path.GetDirectoryName(action.Data["file_path"])!);
await File.AppendAllTextAsync(action.Data["file_path"], ReplaceContentText(action.Data["file_content"], senderDisplayName));
_logger.Debug($"Appended text to file [file: {action.Data["file_path"]}][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;
@@ -193,12 +193,12 @@ namespace TwitchChatTTS.Twitch.Redemptions
if (_user.VoicesSelected.ContainsKey(senderId))
{
await _hermes.UpdateTTSUser(senderId, voiceId);
_logger.Debug($"Sent request to create chat TTS voice [voice: {voiceName}][chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
_logger.Debug($"Sent request to update chat TTS voice [voice: {voiceName}][chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
}
else
{
await _hermes.CreateTTSUser(senderId, voiceId);
_logger.Debug($"Sent request to update chat TTS voice [voice: {voiceName}][chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
_logger.Debug($"Sent request to create chat TTS voice [voice: {voiceName}][chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
}
break;
case "AUDIO_FILE":

View File

@@ -47,6 +47,7 @@ namespace TwitchChatTTS.Twitch.Socket.Handlers
else
_logger.Debug($"No redeemable actions for ad break begin was found");
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
Task.Run(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(message.DurationSeconds));
@@ -73,6 +74,7 @@ namespace TwitchChatTTS.Twitch.Socket.Handlers
else
_logger.Debug($"No redeemable actions for ad break end was found");
});
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
}
catch (Exception ex)
{

View File

@@ -52,7 +52,9 @@ namespace TwitchChatTTS.Twitch.Socket.Handlers
}
}
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
Task.Run(async () => await EndOfRaidSpamProtection(message.ToBroadcasterUserId, endDate));
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
}
private async Task EndOfRaidSpamProtection(string raidedId, DateTime endDate)

View File

@@ -29,7 +29,9 @@ namespace TwitchChatTTS.Twitch.Socket.Handlers
long broadcasterId = long.Parse(message.BroadcasterUserId);
long chatterId = message.UserId == null ? 0 : long.Parse(message.UserId);
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
Task.Run(async () => await _reader.Read(sender, broadcasterId, chatterId, message.UserLogin, null, null, message.Message.Fragments, 100));
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
try
{

View File

@@ -93,7 +93,7 @@ namespace TwitchChatTTS.Twitch.Socket
_disconnected = false;
};
OnDisconnected += async (sender, e) =>
OnDisconnected += (sender, e) =>
{
lock (_lock)
{