mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Update alerts file loading
Fix issue with blank lines. Avoid duplicate entries. Issue fixed with an alerts file provided by TRTrident
This commit is contained in:
parent
dbefe16831
commit
2a8a6fadd3
1 changed files with 12 additions and 12 deletions
|
|
@ -18,23 +18,23 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
if (System.IO.File.Exists(Settings.Alerts_MatchesFile))
|
if (System.IO.File.Exists(Settings.Alerts_MatchesFile))
|
||||||
{
|
{
|
||||||
dictionary = System.IO.File.ReadAllLines(Settings.Alerts_MatchesFile);
|
List<string> tmp_dictionary = new List<string>();
|
||||||
|
string[] file_lines = System.IO.File.ReadAllLines(Settings.Alerts_MatchesFile);
|
||||||
for (int i = 0; i < dictionary.Length; i++)
|
foreach (string line in file_lines)
|
||||||
{
|
if (line.Trim().Length > 0 && !tmp_dictionary.Contains(line.ToLower()))
|
||||||
dictionary[i] = dictionary[i].ToLower();
|
tmp_dictionary.Add(line.ToLower());
|
||||||
}
|
dictionary = tmp_dictionary.ToArray();
|
||||||
}
|
}
|
||||||
else LogToConsole("File not found: " + Settings.Alerts_MatchesFile);
|
else LogToConsole("File not found: " + Settings.Alerts_MatchesFile);
|
||||||
|
|
||||||
if (System.IO.File.Exists(Settings.Alerts_ExcludesFile))
|
if (System.IO.File.Exists(Settings.Alerts_ExcludesFile))
|
||||||
{
|
{
|
||||||
excludelist = System.IO.File.ReadAllLines(Settings.Alerts_ExcludesFile);
|
List<string> tmp_excludelist = new List<string>();
|
||||||
|
string[] file_lines = System.IO.File.ReadAllLines(Settings.Alerts_ExcludesFile);
|
||||||
for (int i = 0; i < excludelist.Length; i++)
|
foreach (string line in file_lines)
|
||||||
{
|
if (line.Trim().Length > 0 && !tmp_excludelist.Contains(line.Trim().ToLower()))
|
||||||
excludelist[i] = excludelist[i].ToLower();
|
tmp_excludelist.Add(line.ToLower());
|
||||||
}
|
excludelist = tmp_excludelist.ToArray();
|
||||||
}
|
}
|
||||||
else LogToConsole("File not found : " + Settings.Alerts_ExcludesFile);
|
else LogToConsole("File not found : " + Settings.Alerts_ExcludesFile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue