Skip to content

Commit

Permalink
Compatibility fix
Browse files Browse the repository at this point in the history
NiceHashBot now compatible with NiceHash API v1.2.0
  • Loading branch information
nicehashdev committed Jul 29, 2015
1 parent b7e46ba commit 8243485
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk
*.cache
src/NHB.v12.suo
*.exe
src/NiceHashBot/bin/Debug/NiceHashBot.exe.config
*.config
src/NiceHashBot/bin/Debug/NiceHashBot.vshost.exe.manifest
src/NiceHashBot/bin/Release/NiceHashBot.vshost.exe.manifest
src/NiceHashBot/obj/x86/Debug/NiceHashBot.csproj.FileListAbsolute.txt
4 changes: 2 additions & 2 deletions src/NiceHashBot/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.4")]
[assembly: AssemblyFileVersion("1.0.1.4")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
25 changes: 21 additions & 4 deletions src/NiceHashBotLib/APIWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ public class APIWrapper
/// <summary>
/// API Version compatible with.
/// </summary>
public readonly static string API_VERSION_COMPATIBLE = "1.0.10";
public readonly static string API_VERSION_COMPATIBLE = "1.2.0";

/// <summary>
/// URLs for NiceHash services.
/// </summary>
public readonly static string[] SERVICE_LOCATION = { "https://www.nicehash.com", "https://www.westhash.com" };
public readonly static string SERVICE_LOCATION = "https://www.nicehash.com";

/// <summary>
/// Names for NiceHash services.
/// </summary>
public readonly static string[] SERVICE_NAME = { "NiceHash", "WestHash" };
public readonly static string[] SERVICE_NAME = { "Europe (NiceHash)", " USA (WestHash)" };

/// <summary>
/// Names for algorithms.
Expand Down Expand Up @@ -161,6 +161,20 @@ public static List<Order> GetAllOrders(int ServiceLocation, int Algorithm, bool
{
CachedOList[ServiceLocation, Algorithm] = new CachedOrderList();
CachedOList[ServiceLocation, Algorithm].OrderList = GetOrders(ServiceLocation, Algorithm, "orders.get", false);

// Get missing data for my orders
List<Order> MyOrders = GetMyOrders(ServiceLocation, Algorithm);

// Fill missing data
foreach (Order O1 in MyOrders)
{
foreach (Order O2 in CachedOList[ServiceLocation, Algorithm].OrderList)
{
if (O2.ID == O1.ID)
O2.BTCAvailable = O1.BTCAvailable;
}
}

CachedOList[ServiceLocation, Algorithm].ObtainTime = DateTime.Now;
}

Expand Down Expand Up @@ -381,7 +395,7 @@ private static double GetTotalSpeedForAlgorithm(int ServiceLocation, int Algorit

private static T Request<T>(int ServiceLocation, string Method, bool AppendCredentials, Dictionary<string, string> Parameters)
{
string URL = SERVICE_LOCATION[ServiceLocation] + "/api";
string URL = SERVICE_LOCATION + "/api";

if (Method != null)
{
Expand All @@ -392,6 +406,9 @@ private static T Request<T>(int ServiceLocation, string Method, bool AppendCrede
URL += "&key=" + APIKey;
}

// Append location
URL += "&location=" + ServiceLocation.ToString();

if (Parameters != null)
{
// Append all parameters
Expand Down

0 comments on commit 8243485

Please sign in to comment.