mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Improve owns command to take into account owned packageIDs
Idea thanks to @ryzhehvost
This commit is contained in:
@@ -373,25 +373,27 @@ namespace ArchiSteamFarm {
|
||||
if (botName.StartsWith("r!", StringComparison.OrdinalIgnoreCase)) {
|
||||
string botsPattern = botName.Substring(2);
|
||||
|
||||
RegexOptions botsRegex = RegexOptions.None;
|
||||
|
||||
if ((BotsComparer == StringComparer.InvariantCulture) || (BotsComparer == StringComparer.Ordinal)) {
|
||||
botsRegex |= RegexOptions.CultureInvariant;
|
||||
} else if ((BotsComparer == StringComparer.InvariantCultureIgnoreCase) || (BotsComparer == StringComparer.OrdinalIgnoreCase)) {
|
||||
botsRegex |= RegexOptions.CultureInvariant | RegexOptions.IgnoreCase;
|
||||
}
|
||||
|
||||
Regex regex;
|
||||
|
||||
try {
|
||||
RegexOptions botsRegex = RegexOptions.None;
|
||||
|
||||
if ((BotsComparer == StringComparer.InvariantCulture) || (BotsComparer == StringComparer.Ordinal)) {
|
||||
botsRegex |= RegexOptions.CultureInvariant;
|
||||
} else if ((BotsComparer == StringComparer.InvariantCultureIgnoreCase) || (BotsComparer == StringComparer.OrdinalIgnoreCase)) {
|
||||
botsRegex |= RegexOptions.CultureInvariant | RegexOptions.IgnoreCase;
|
||||
}
|
||||
|
||||
Regex regex = new Regex(botsPattern, botsRegex);
|
||||
|
||||
IEnumerable<Bot> regexMatches = Bots.Where(kvp => regex.IsMatch(kvp.Key)).Select(kvp => kvp.Value);
|
||||
result.UnionWith(regexMatches);
|
||||
regex = new Regex(botsPattern, botsRegex);
|
||||
} catch (ArgumentException e) {
|
||||
ASF.ArchiLogger.LogGenericWarningException(e);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
IEnumerable<Bot> regexMatches = Bots.Where(kvp => regex.IsMatch(kvp.Key)).Select(kvp => kvp.Value);
|
||||
result.UnionWith(regexMatches);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user