Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Jan 4, 2024
1 parent 15aae50 commit a91827c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions JL.Core/Audio/AudioUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace JL.Core.Audio;

public static class AudioUtils
{
private static readonly AudioResponse s_audioResponse = new(AudioSourceType.TextToSpeech, "wav", null);
private static readonly AudioResponse s_textToSpeechAudioResponse = new(AudioSourceType.TextToSpeech, "wav", null);

public static readonly Dictionary<string, AudioSource> AudioSources = new();

Expand Down Expand Up @@ -161,7 +161,7 @@ public static class AudioUtils

case AudioSourceType.TextToSpeech:
await Utils.Frontend.TextToSpeech(uri, reading, CoreConfig.AudioVolume).ConfigureAwait(false);
return s_audioResponse;
return s_textToSpeechAudioResponse;

default:
throw new ArgumentOutOfRangeException(null, "Invalid AudioSourceType");
Expand Down
2 changes: 1 addition & 1 deletion JL.Core/Dicts/EDICT/JMdict/JmdictDBManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static void InsertRecordsToDB(Dict dict)
connection.Open();
using DbTransaction transaction = connection.BeginTransaction();

Dictionary<JmdictRecord, List<string>> recordToKeysDict = new(dict.Contents.Count);
Dictionary<JmdictRecord, List<string>> recordToKeysDict = new();
foreach ((string key, IList<IDictRecord> records) in dict.Contents)
{
for (int i = 0; i < records.Count; i++)
Expand Down
6 changes: 3 additions & 3 deletions JL.Core/Utilities/JapaneseUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public static string FindSentence(string text, int position)

if (s_bracketsDict.TryGetValue(sentence.FirstOrDefault(), out char rightBracket))
{
if (sentence.Last() == rightBracket)
if (sentence[^1] == rightBracket)
{
sentence = sentence[1..^1];
}
Expand All @@ -339,7 +339,7 @@ public static string FindSentence(string text, int position)

else if (s_bracketsDict.ContainsValue(sentence.LastOrDefault()))
{
char leftBracket = s_bracketsDict.First(p => p.Value == sentence.Last()).Key;
char leftBracket = s_bracketsDict.First(p => p.Value == sentence[^1]).Key;

if (!sentence.Contains(leftBracket, StringComparison.Ordinal))
{
Expand All @@ -348,7 +348,7 @@ public static string FindSentence(string text, int position)
else
{
int numberOfLeftBrackets = sentence.Count(p => p == leftBracket);
int numberOfRightBrackets = sentence.Count(p => p == sentence.Last());
int numberOfRightBrackets = sentence.Count(p => p == sentence[^1]);

if (numberOfRightBrackets == numberOfLeftBrackets + 1)
{
Expand Down

0 comments on commit a91827c

Please sign in to comment.