From 502a63f131c993201d52d32cbb95be12139b7d66 Mon Sep 17 00:00:00 2001 From: Scott Alfter Date: Wed, 29 May 2013 11:46:34 -0700 Subject: [PATCH] improved documentation, with Mono registry import --- .gitignore | 3 +++ CoinProfitability.reg.tar.gz | Bin 0 -> 559 bytes CoinProfitability/App.config | 2 +- CoinProfitability/CoinProfitability.csproj | 7 ++++--- CoinProfitability/Form1.cs | 14 +++++++++----- README.md => README | 8 ++++++++ 6 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 CoinProfitability.reg.tar.gz rename README.md => README (75%) diff --git a/.gitignore b/.gitignore index b9d6bd9..08e711c 100644 --- a/.gitignore +++ b/.gitignore @@ -213,3 +213,6 @@ pip-log.txt #Mr Developer .mr.developer.cfg + +# don't include binary releases +CoinProfitability.zip diff --git a/CoinProfitability.reg.tar.gz b/CoinProfitability.reg.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..bea7f53687ff00b72e2f74cdf97e8f68fd23a9d8 GIT binary patch literal 559 zcmV+~0?_>*iwFQ&Or}u)1MQXHZksR^#<|{8pgaJ^V8S$YmDa9OwRM}+Ef>9-3^Iuo z0?0mW;q7Na+9{}zk|Mf4=XVhki(|mw@%K5KJj;m^OQ}Is4evjIu-hed;lzzdOYS{O9_gHL9JzYA)=I zZ^YZ#)wW1;CDaAiVsU#jv!N=?v}qBUEobK|fZ`1yQJTl=c*SMr$Sldvnhxk#>YG`i zz0O6wz}5Eg!uKNKWeV3^uWmVrMJAzL|LL0OCl$8~8Dqce$o&?)v=%SH2Wi?KKjd1?WkLXQ+VgB#e{?A;B{yzm{>fe_2qmBuL>8NCE^w5ClOG1VIo4K@j9$ - + diff --git a/CoinProfitability/CoinProfitability.csproj b/CoinProfitability/CoinProfitability.csproj index 564602e..d6ac6b0 100644 --- a/CoinProfitability/CoinProfitability.csproj +++ b/CoinProfitability/CoinProfitability.csproj @@ -9,7 +9,7 @@ Properties CoinProfitability CoinProfitability - v4.5 + v4.0 512 publish\ @@ -50,8 +50,9 @@ false - - ..\..\Newtonsoft.Json\Src\Newtonsoft.Json\bin\Release\Net45\Newtonsoft.Json.dll + + False + bin\Release\Newtonsoft.Json.dll diff --git a/CoinProfitability/Form1.cs b/CoinProfitability/Form1.cs index 6b94231..c20bd52 100644 --- a/CoinProfitability/Form1.cs +++ b/CoinProfitability/Form1.cs @@ -313,11 +313,15 @@ namespace CoinProfitability for (int c = 0; c < cbHashrateUnit.Items.Count; c++) if (((Item)cbHashrateUnit.Items[c]).Name == i.DefaultHashRateUnit) cbHashrateUnit.SelectedIndex = c; - if (i.ExchangeURL != null) - tbExchangeRate.Text = GetExchangeRate(i.ExchangeURL, i.ExchangeJSONKey).ToString(); - else - tbExchangeRate.Text = ""; - if (cbCoinType.Items[cbCoinType.SelectedIndex].ToString() == "Bitcoin") + try + { + if (i.ExchangeURL != null) + tbExchangeRate.Text = GetExchangeRate(i.ExchangeURL, i.ExchangeJSONKey).ToString(); + else + tbExchangeRate.Text = ""; + } + catch { tbExchangeRate.Text = "Unavailable"; } + if (cbCoinType.Items[cbCoinType.SelectedIndex].ToString().ToLower() == "bitcoin") // case-insensitive for Mono compatibility tbExchangeRate.Text = "1"; tbHashrate.Text = i.DefaultHashRate; lblUpdating.Visible = false; diff --git a/README.md b/README similarity index 75% rename from README.md rename to README index 09904d3..6c3a2bf 100644 --- a/README.md +++ b/README @@ -13,3 +13,11 @@ You most likely know your hashrate for SHA-256 and scrypt coins. Difficulty is I built this in Visual Studio 2012 Express against .NET Framework 4.0 (needed that version because it's the first that includes BigInteger support). I've also tested it under Mono; its implementation of Decimal.ToString() is a bit different and needed some adjustment. In this release, I've added the ability to store configuration information for the coins of your choice in the registry, and to select a coin from a drop-down list. A sample registry file (with configurations for three coins) is included. Most items are self-explanatory. Valid choices for ExplorerType are BlockEx (for blockexplorer.com and blockchain.info) and Abe (for block explorers running Abe). DefaultHashRate is optional; you can set it to whatever's appropriate for your hardware. I've only tested exchange-rate lookup against bter.com; other exchanges that offer a JSON API may also work. For Bitcoin, the exchange rate is automatically set to 1. + +Json.NET is used to handle exchange data: + +http://json.codeplex.com/releases/view/106328 + +I built against v5.0r5. Use the DLL built for .NET Framework 4.0 to maintain compatibility with Windows XP. Unfortunately, it doesn't seem to play well on Mono; the exchange rate will be filled in as "Unavailable." I probably need to find another parser. + +If you don't have any configuration stored in the registry, an error will pop up at startup. On Windows, import CoinProfitability.reg. On Linux, unpack CoinProfitability.reg.tar.gz in your home directory.