Skip to content

Commit

Permalink
Decode game names, closes #99
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Feb 5, 2016
1 parent b20423e commit 3b61043
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ArchiSteamFarm/ArchiHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ internal PurchaseResponseCallback(JobID jobID, CMsgClientPurchaseResponse msg) {
}

foreach (KeyValue lineItem in ReceiptInfo["lineitems"].Children) {
Items.Add((uint) lineItem["PackageID"].AsUnsignedLong(), lineItem["ItemDescription"].AsString());
uint appID = (uint) lineItem["PackageID"].AsUnsignedLong();
string gameName = lineItem["ItemDescription"].AsString();
gameName = Utilities.UrlDecode(gameName); // Apparently steam expects client to decode sent HTML
Items.Add(appID, gameName);
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions ArchiSteamFarm/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ limitations under the License.
*/

using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

Expand Down Expand Up @@ -71,5 +72,13 @@ internal static uint GetCharCountInString(string s, char c) {

return count;
}

internal static string UrlDecode(string message) {
if (string.IsNullOrEmpty(message)) {
return null;
}

return WebUtility.UrlDecode(message);
}
}
}

0 comments on commit 3b61043

Please sign in to comment.