improved documentation, with Mono registry import

This commit is contained in:
2013-05-29 11:46:34 -07:00
parent f66239d6bf
commit 502a63f131
6 changed files with 25 additions and 9 deletions

3
.gitignore vendored
View File

@@ -213,3 +213,6 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
# don't include binary releases
CoinProfitability.zip

View File

Binary file not shown.

View File

@@ -2,5 +2,5 @@
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>

View File

@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CoinProfitability</RootNamespace>
<AssemblyName>CoinProfitability</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
@@ -50,8 +50,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\Newtonsoft.Json\Src\Newtonsoft.Json\bin\Release\Net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Release\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

@@ -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;

View File

@@ -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.