From e69e25a1f1a634e04ed1ca840c458ec0987de548 Mon Sep 17 00:00:00 2001 From: Rohan Singh Date: Sun, 2 Dec 2018 13:57:09 -0500 Subject: [PATCH] Formats for more currencies, and make that format function public --- Facepunch.Steamworks/Utility.cs | 47 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/Facepunch.Steamworks/Utility.cs b/Facepunch.Steamworks/Utility.cs index 86e70e3..cdf1e8a 100644 --- a/Facepunch.Steamworks/Utility.cs +++ b/Facepunch.Steamworks/Utility.cs @@ -60,22 +60,55 @@ public static uint FromDateTime( DateTime dt ) } - internal static string FormatPrice(string currency, ulong price) + public static string FormatPrice(string currency, ulong price) { var decimaled = (price / 100.0).ToString("0.00"); - switch (currency ) + switch (currency) { - case "GBP": return $"£{decimaled}"; - case "USD": return $"${decimaled}"; + case "AED": return $"{decimaled}د.إ"; + case "ARS": return $"${decimaled} ARS"; + case "AUD": return $"${decimaled} AUD"; + case "BRL": return $"R$ {decimaled}"; case "CAD": return $"${decimaled} CAD"; + case "CHF": return $"Fr. {decimaled}"; + case "CLP": return $"${decimaled} CLP"; + case "CNY": return $"{decimaled}元"; + case "COP": return $"COL$ {decimaled}"; + case "CRC": return $"₡{decimaled}"; case "EUR": return $"€{decimaled}"; - case "RUB": return $"₽{decimaled}"; + case "GBP": return $"£{decimaled}"; + case "HKD": return $"HK$ {decimaled}"; + case "ILS": return $"₪{decimaled}"; + case "IDR": return $"Rp{decimaled}"; + case "INR": return $"₹{decimaled}"; + case "JPY": return $"¥{decimaled}"; + case "KRW": return $"₩{decimaled}"; + case "KWD": return $"KD {decimaled}"; + case "KZT": return $"{decimaled}₸"; + case "MXN": return $"Mex$ {decimaled}"; + case "MYR": return $"RM {decimaled}"; + case "NOK": return $"{decimaled} kr"; case "NZD": return $"${decimaled} NZD"; + case "PEN": return $"S/. {decimaled}"; + case "PHP": return $"₱{decimaled}"; + case "PLN": return $"zł {decimaled}"; + case "QAR": return $"QR {decimaled}"; + case "RUB": return $"₽{decimaled}"; + case "SAR": return $"SR {decimaled}"; + case "SGD": return $"S$ {decimaled}"; + case "THB": return $"฿{decimaled}"; + case "TRY": return $"₺{decimaled}"; + case "TWD": return $"NT$ {decimaled}"; + case "UAH": return $"₴{decimaled}"; + case "USD": return $"${decimaled}"; + case "UYU": return $"$U {decimaled}"; // yes the U goes after $ + case "VND": return $"₫{decimaled}"; + case "ZAR": return $"R {decimaled}"; - // TODO - all of them + // TODO - check all of them https://partner.steamgames.com/doc/store/pricing/currencies - default: return $"{decimaled}{currency}"; + default: return $"{decimaled} {currency}"; } }