CardIdleRemastered icon indicating copy to clipboard operation
CardIdleRemastered copied to clipboard

Errors caused by language preference, at least, in Japanese

Open yak1ex opened this issue 6 years ago • 1 comments

I try to use CardIdleRemastered but it it necessary to change language preference to English due to errors.

https://github.com/AlexanderSharykin/CardIdleRemastered/blob/07b732352f8171fcb24f92888f0ae1c73ec5a962/SourceCode/CardIdleRemastered/SteamParser.cs#L243

InnerText of ".//div[@class=\"badge_progress_info\"]" in English: 4 of 5 cards collected Same in Japanese: 5 枚中 4 枚のカードを獲得

So, numbers are reversed. This means gCurrent and gTotal are reversed here: https://github.com/AlexanderSharykin/CardIdleRemastered/blob/07b732352f8171fcb24f92888f0ae1c73ec5a962/SourceCode/CardIdleRemastered/SteamParser.cs#L249-L251

Thus, gTotal - gCurrent have a negative value in, at least, Japanese, which leads the following error:

  • An original error:
     2018/09/14 23:12:48   LoadBadgesAsync
     System.ArgumentOutOfRangeException: 'count' を負の値にすることはできません。
     パラメーター名:count
        場所 System.String.CtorCharCount(Char c, Int32 count)
        場所 CardIdleRemastered.BadgeModel.UpdateProgress()
       場所 CardIdleRemastered.SteamParser.ProcessBadgesOnPage(IList`1 badges, HtmlDocument document)
        場所 CardIdleRemastered.SteamParser.<LoadBadgesAsync>d__29.MoveNext()
    
  • Translated to English:
    2018/09/14 23:12:48   LoadBadgesAsync
    System.ArgumentOutOfRangeException: 'count' must not have a negative value.
    parameter name:count
       location System.String.CtorCharCount(Char c, Int32 count)
       location CardIdleRemastered.BadgeModel.UpdateProgress()
       location CardIdleRemastered.SteamParser.ProcessBadgesOnPage(IList`1 badges, HtmlDocument  document)
       location CardIdleRemastered.SteamParser.<LoadBadgesAsync>d__29.MoveNext()
    

I guess an imperfect but simple solution is swap values if gCurrent > gTotal.

yak1ex avatar Sep 14 '18 14:09 yak1ex

Thank you for your report and investigation! As you can probably guess I had no particular reason to change my language preferences to Japanese. "swap values if gCurrent > gTotal" sounds like a reasonable fix. I will add it in the next release

AlexanderSharykin avatar Sep 27 '18 17:09 AlexanderSharykin