Skip to content

Commit

Permalink
Use HashSet<> instead of List<>
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Dec 28, 2024
1 parent 325ce21 commit 765531c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions TwitchDownloaderCore/TwitchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ private static async Task<List<EmoteResponseItem>> GetStvEmotesMetadata(int stre
public static async Task<List<TwitchEmote>> GetThirdPartyEmotes(List<Comment> comments, int streamerId, string cacheFolder, ITaskLogger logger, EmbeddedData embeddedData = null, bool bttv = true, bool ffz = true, bool stv = true, bool allowUnlistedEmotes = true, bool offline = false, CancellationToken cancellationToken = default)
{
List<TwitchEmote> returnList = new List<TwitchEmote>();
List<string> alreadyAdded = new List<string>();
HashSet<string> alreadyAdded = new HashSet<string>();

// No 3rd party emotes are wanted
if (!bttv && !ffz && !stv)
Expand Down Expand Up @@ -459,7 +459,7 @@ public static async Task<List<TwitchEmote>> GetThirdPartyEmotes(List<Comment> co
return returnList;

static async Task FetchEmoteImages(IReadOnlyCollection<Comment> comments, IEnumerable<EmoteResponseItem> emoteResponse, ICollection<TwitchEmote> returnList,
ICollection<string> alreadyAdded, DirectoryInfo cacheFolder, ITaskLogger logger, CancellationToken cancellationToken)
ISet<string> alreadyAdded, DirectoryInfo cacheFolder, ITaskLogger logger, CancellationToken cancellationToken)
{
if (!cacheFolder.Exists)
cacheFolder = CreateDirectory(cacheFolder.FullName);
Expand Down Expand Up @@ -500,8 +500,8 @@ where comments.Any(comment => Regex.IsMatch(comment.message.body, pattern))
public static async Task<List<TwitchEmote>> GetEmotes(List<Comment> comments, string cacheFolder, ITaskLogger logger, EmbeddedData embeddedData = null, bool offline = false, CancellationToken cancellationToken = default)
{
List<TwitchEmote> returnList = new List<TwitchEmote>();
List<string> alreadyAdded = new List<string>();
List<string> failedEmotes = new List<string>();
HashSet<string> alreadyAdded = new HashSet<string>();
HashSet<string> failedEmotes = new HashSet<string>();

DirectoryInfo emoteFolder = new DirectoryInfo(Path.Combine(cacheFolder, "emotes"));
if (!emoteFolder.Exists)
Expand Down Expand Up @@ -633,7 +633,7 @@ public static async Task<List<TwitchEmote>> GetEmotes(List<Comment> comments, st
public static async Task<List<ChatBadge>> GetChatBadges(List<Comment> comments, int streamerId, string cacheFolder, ITaskLogger logger, EmbeddedData embeddedData = null, bool offline = false, CancellationToken cancellationToken = default)
{
List<ChatBadge> returnList = new List<ChatBadge>();
List<string> alreadyAdded = new List<string>();
HashSet<string> alreadyAdded = new HashSet<string>();

// Load our embedded data from file
if (embeddedData?.twitchBadges != null)
Expand Down Expand Up @@ -781,7 +781,7 @@ public static async Task<Dictionary<string, SKBitmap>> GetEmojis(string cacheFol
public static async Task<List<CheerEmote>> GetBits(List<Comment> comments, string cacheFolder, string channelId, ITaskLogger logger, EmbeddedData embeddedData = null, bool offline = false, CancellationToken cancellationToken = default)
{
List<CheerEmote> returnList = new List<CheerEmote>();
List<string> alreadyAdded = new List<string>();
HashSet<string> alreadyAdded = new HashSet<string>();

// Load our embedded data from file
if (embeddedData?.twitchBits != null)
Expand Down

0 comments on commit 765531c

Please sign in to comment.