This commit is contained in:
JustArchi
2017-02-26 15:01:37 +01:00
parent bb7924f184
commit dec88184ab
3 changed files with 47 additions and 29 deletions

View File

@@ -406,7 +406,7 @@ namespace ArchiSteamFarm {
return appID;
}
string[] dlcAppIDsString = listOfDlc.Split(',');
string[] dlcAppIDsString = listOfDlc.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string dlcAppIDString in dlcAppIDsString) {
uint dlcAppID;
if (!uint.TryParse(dlcAppIDString, out dlcAppID)) {
@@ -794,7 +794,7 @@ namespace ArchiSteamFarm {
string[] botNames = args.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
HashSet<Bot> result = new HashSet<Bot>();
foreach (string botName in botNames.Where(botName => !string.IsNullOrEmpty(botName))) {
foreach (string botName in botNames) {
if (botName.Equals(SharedInfo.ASF, StringComparison.OrdinalIgnoreCase)) {
foreach (Bot bot in Bots.OrderBy(bot => bot.Key).Select(bot => bot.Value)) {
result.Add(bot);
@@ -1912,7 +1912,7 @@ namespace ArchiSteamFarm {
string[] gameIDs = games.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
HashSet<uint> gamesToRedeem = new HashSet<uint>();
foreach (string game in gameIDs.Where(game => !string.IsNullOrEmpty(game))) {
foreach (string game in gameIDs) {
uint gameID;
if (!uint.TryParse(game, out gameID)) {
return FormatBotResponse(string.Format(Strings.ErrorParsingObject, nameof(gameID)));
@@ -2250,19 +2250,24 @@ namespace ArchiSteamFarm {
StringBuilder response = new StringBuilder();
string[] games = query.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string game in games.Where(game => !string.IsNullOrEmpty(game))) {
// Check if this is appID
uint appID;
if (uint.TryParse(game, out appID)) {
foreach (string game in games) {
// Check if this is gameID
uint gameID;
if (uint.TryParse(game, out gameID)) {
if (OwnedPackageIDs.Contains(gameID)) {
response.Append(FormatBotResponse(string.Format(Strings.BotOwnedAlready, gameID)));
continue;
}
string ownedName;
response.Append(FormatBotResponse(ownedGames.TryGetValue(appID, out ownedName) ? string.Format(Strings.BotOwnedAlready, appID, ownedName) : string.Format(Strings.BotNotOwnedYet, appID)));
response.Append(FormatBotResponse(ownedGames.TryGetValue(gameID, out ownedName) ? string.Format(Strings.BotOwnedAlreadyWithName, gameID, ownedName) : string.Format(Strings.BotNotOwnedYet, gameID)));
continue;
}
// This is a string, so check our entire library
foreach (KeyValuePair<uint, string> ownedGame in ownedGames.Where(ownedGame => ownedGame.Value.IndexOf(game, StringComparison.OrdinalIgnoreCase) >= 0)) {
response.Append(FormatBotResponse(string.Format(Strings.BotOwnedAlready, ownedGame.Key, ownedGame.Value)));
response.Append(FormatBotResponse(string.Format(Strings.BotOwnedAlreadyWithName, ownedGame.Key, ownedGame.Value)));
}
}
@@ -2442,7 +2447,7 @@ namespace ArchiSteamFarm {
string[] gameIDs = games.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
HashSet<uint> gamesToPlay = new HashSet<uint>();
foreach (string game in gameIDs.Where(game => !string.IsNullOrEmpty(game))) {
foreach (string game in gameIDs) {
uint gameID;
if (!uint.TryParse(game, out gameID)) {
return FormatBotResponse(string.Format(Strings.ErrorParsingObject, nameof(gameID)));

View File

@@ -475,7 +475,7 @@ namespace ArchiSteamFarm.Localization {
}
/// <summary>
/// Looks up a localized string similar to Owned already: {0} | {1}.
/// Looks up a localized string similar to Owned already: {0}.
/// </summary>
internal static string BotOwnedAlready {
get {
@@ -483,6 +483,15 @@ namespace ArchiSteamFarm.Localization {
}
}
/// <summary>
/// Looks up a localized string similar to Owned already: {0} | {1}.
/// </summary>
internal static string BotOwnedAlreadyWithName {
get {
return ResourceManager.GetString("BotOwnedAlreadyWithName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Rate limit exceeded, we will retry after {0} minutes of cooldown....
/// </summary>

View File

@@ -381,11 +381,11 @@ StackTrace:
</data>
<data name="BotStatusIdling" xml:space="preserve">
<value>Bot is idling game: {0} ({1}, {2} card drops remaining) from a total of {3} games ({4} cards) left to idle (~{5} remaining).</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name, {2} will be replaced by number of cards left to idle, {3} will be replaced by total number of games to idle, {4} will be replaced by total number of cards to idle, {5} will be replaced by translated TimeSpan string built from TimeSpan* translation parts</comment>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name, {2} will be replaced by number of cards left to idle, {3} will be replaced by total number of games to idle, {4} will be replaced by total number of cards to idle, {5} will be replaced by translated TimeSpan string built from TimeSpan* translation parts</comment>
</data>
<data name="BotStatusIdlingList" xml:space="preserve">
<value>Bot is idling games: {0} from a total of {1} games ({2} cards) left to idle (~{3} remaining).</value>
<comment>{0} will be replaced by list of the games (appIDs, numbers), {1} will be replaced by total number of games to idle, {2} will be replaced by total number of cards to idle, {3} will be replaced by translated TimeSpan string built from TimeSpan* translation parts</comment>
<comment>{0} will be replaced by list of the games (IDs, numbers), {1} will be replaced by total number of games to idle, {2} will be replaced by total number of cards to idle, {3} will be replaced by translated TimeSpan string built from TimeSpan* translation parts</comment>
</data>
<data name="CheckingFirstBadgePage" xml:space="preserve">
<value>Checking first badge page...</value>
@@ -409,15 +409,15 @@ StackTrace:
</data>
<data name="IdlingFinishedForGame" xml:space="preserve">
<value>Finished idling: {0} ({1}) after {2} of playtime!</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name, {2} will be replaced by translated TimeSpan string built from TimeSpan* translation parts</comment>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name, {2} will be replaced by translated TimeSpan string built from TimeSpan* translation parts</comment>
</data>
<data name="IdlingFinishedForGames" xml:space="preserve">
<value>Finished idling games: {0}</value>
<comment>{0} will be replaced by list of the games (appIDs, numbers), separated by a comma</comment>
<comment>{0} will be replaced by list of the games (IDs, numbers), separated by a comma</comment>
</data>
<data name="IdlingStatusForGame" xml:space="preserve">
<value>Idling status for {0} ({1}): {2} cards remaining</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name, {2} will be replaced by number of cards left to idle</comment>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name, {2} will be replaced by number of cards left to idle</comment>
</data>
<data name="IdlingStopped" xml:space="preserve">
<value>Idling stopped!</value>
@@ -430,30 +430,30 @@ StackTrace:
</data>
<data name="NowIdling" xml:space="preserve">
<value>Now idling: {0} ({1})</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name</comment>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name</comment>
</data>
<data name="NowIdlingList" xml:space="preserve">
<value>Now idling: {0}</value>
<comment>{0} will be replaced by list of the games (appIDs, numbers), separated by a comma</comment>
<comment>{0} will be replaced by list of the games (IDs, numbers), separated by a comma</comment>
</data>
<data name="PlayingNotAvailable" xml:space="preserve">
<value>Playing is currently unavailable, we'll try again later!</value>
</data>
<data name="StillIdling" xml:space="preserve">
<value>Still idling: {0} ({1})</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name</comment>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name</comment>
</data>
<data name="StillIdlingList" xml:space="preserve">
<value>Still idling: {0}</value>
<comment>{0} will be replaced by list of the games (appIDs, numbers), separated by a comma</comment>
<comment>{0} will be replaced by list of the games (IDs, numbers), separated by a comma</comment>
</data>
<data name="StoppedIdling" xml:space="preserve">
<value>Stopped idling: {0} ({1})</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name</comment>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name</comment>
</data>
<data name="StoppedIdlingList" xml:space="preserve">
<value>Stopped idling: {0}</value>
<comment>{0} will be replaced by list of the games (appIDs, numbers), separated by a comma</comment>
<comment>{0} will be replaced by list of the games (IDs, numbers), separated by a comma</comment>
</data>
<data name="UnknownCommand" xml:space="preserve">
<value>Unknown command!</value>
@@ -463,7 +463,7 @@ StackTrace:
</data>
<data name="WarningCouldNotCheckCardsStatus" xml:space="preserve">
<value>Could not check cards status for: {0} ({1}), we will try again later!</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name</comment>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name</comment>
</data>
<data name="BotAcceptingGift" xml:space="preserve">
<value>Accepting gift: {0}...</value>
@@ -478,7 +478,7 @@ StackTrace:
</data>
<data name="BotAddLicenseWithItems" xml:space="preserve">
<value>GameID: {0} | Status: {1} | Items: {2}</value>
<comment>{0} will be replaced by gameID (number), {1} will be replaced by status string, {2} will be replaced by list of granted appIDs (numbers), separated by a comma</comment>
<comment>{0} will be replaced by gameID (number), {1} will be replaced by status string, {2} will be replaced by list of granted IDs (numbers), separated by a comma</comment>
</data>
<data name="BotAlreadyRunning" xml:space="preserve">
<value>This bot is already running!</value>
@@ -580,9 +580,9 @@ StackTrace:
<value>Not owned yet: {0}</value>
<comment>{0} will be replaced by query (string)</comment>
</data>
<data name="BotOwnedAlready" xml:space="preserve">
<data name="BotOwnedAlreadyWithName" xml:space="preserve">
<value>Owned already: {0} | {1}</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name</comment>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name</comment>
</data>
<data name="BotRateLimitExceeded" xml:space="preserve">
<value>Rate limit exceeded, we will retry after {0} minutes of cooldown...</value>
@@ -691,11 +691,11 @@ StackTrace:
</data>
<data name="IdlingGameNotPossible" xml:space="preserve">
<value>Idling {0} ({1}) is temporarily disabled, as ASF is not able to play that game at the moment.</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name</comment>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name</comment>
</data>
<data name="WarningIdlingGameMismatch" xml:space="preserve">
<value>ASF detected appID mismatch for {0} ({1}) and will use appID of {2} instead.</value>
<comment>{0} will be replaced by game's appID (number), {1} will be replaced by game's name, {2} will be replaced by game's appID (number)</comment>
<value>ASF detected ID mismatch for {0} ({1}) and will use ID of {2} instead.</value>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name, {2} will be replaced by game's ID (number)</comment>
</data>
<data name="BotVersion" xml:space="preserve">
<value>{0} V{1}</value>
@@ -710,4 +710,8 @@ StackTrace:
<data name="ErrorFunctionOnlyInHeadlessMode" xml:space="preserve">
<value>This function is available only in headless mode!</value>
</data>
<data name="BotOwnedAlready" xml:space="preserve">
<value>Owned already: {0}</value>
<comment>{0} will be replaced by game's ID (number), {1} will be replaced by game's name</comment>
</data>
</root>