From 07dc63e76aa0a52bd26fb296d2c9881f30dee775 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 29 Dec 2019 10:48:38 +0100 Subject: [PATCH] Ofc Blockchain.info had changed too --- Backend/Backend.csproj | 9 +++- Backend/BackendLoop.cs | 2 - Backend/Properties/app.manifest | 70 +++++++++++++++++++++++++ Logic/Financial/BitcoinUtility.cs | 2 +- Logic/Financial/ExchangeRateSnapshot.cs | 7 +++ 5 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 Backend/Properties/app.manifest diff --git a/Backend/Backend.csproj b/Backend/Backend.csproj index 9d94aca9..76521d8b 100644 --- a/Backend/Backend.csproj +++ b/Backend/Backend.csproj @@ -15,7 +15,7 @@ false 2280FA0F5C408893812C70CF59D1DEF99F19AAA5 Monobot_TemporaryKey.pfx - true + false false \\skybird\piratebot\ false @@ -58,6 +58,12 @@ 4 false + + LocalIntranet + + + Properties\app.manifest + ..\packages\Mono.Posix-4.5.4.5.0\lib\net45\Mono.Posix.dll @@ -133,6 +139,7 @@ + diff --git a/Backend/BackendLoop.cs b/Backend/BackendLoop.cs index 799435dc..679179c8 100644 --- a/Backend/BackendLoop.cs +++ b/Backend/BackendLoop.cs @@ -153,8 +153,6 @@ namespace Swarmops.Backend // ------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------- - ExchangeRateSnapshot.Create(); - Organizations allOrganizations = Organizations.GetAll(); foreach (Organization organization in allOrganizations) { diff --git a/Backend/Properties/app.manifest b/Backend/Properties/app.manifest new file mode 100644 index 00000000..cd90d8ba --- /dev/null +++ b/Backend/Properties/app.manifest @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Logic/Financial/BitcoinUtility.cs b/Logic/Financial/BitcoinUtility.cs index 34b2a296..109efba2 100644 --- a/Logic/Financial/BitcoinUtility.cs +++ b/Logic/Financial/BitcoinUtility.cs @@ -786,7 +786,7 @@ namespace Swarmops.Logic.Financial Dictionary addressAccountLookup) { JObject addressData = JObject.Parse( - new WebClient().DownloadString("https://blockchain.info/address/" + bitcoinMachineAddress + + new WebClient().DownloadString("https://blockchain.info/rawaddr/" + bitcoinMachineAddress + "?format=json&api_key=" + SystemSettings.BlockchainSwarmopsApiKey)); //int transactionCount = (int) (addressData["n_tx"]); diff --git a/Logic/Financial/ExchangeRateSnapshot.cs b/Logic/Financial/ExchangeRateSnapshot.cs index 7959c006..438116e1 100644 --- a/Logic/Financial/ExchangeRateSnapshot.cs +++ b/Logic/Financial/ExchangeRateSnapshot.cs @@ -120,6 +120,13 @@ namespace Swarmops.Logic.Financial { string currencyCode = match.Groups[1].Value; string currencyName = match.Groups[2].Value; + + if (currencyCode == "BTC") + { + match = match.NextMatch(); + continue; // we don't need to know that BTC has rate 1:1 against itself + } + double btcRate = Double.Parse (match.Groups[3].Value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture); // rounding errors and loss of precision ok, don't use Formatting fn