This repository has been archived by the owner on Jun 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 322
/
Copy pathGlobals.cs
54 lines (48 loc) · 2.1 KB
/
Globals.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using NiceHashMiner.Enums;
using Newtonsoft.Json;
namespace NiceHashMiner {
public class Globals {
// Constants
public static string[] MiningLocation = { "eu", "usa", "hk", "jp", "in", "br" };
public static readonly string DemoUser = "3DJhaQaKA6oyRaGyDZYdkZcise4b9DrCi2";
// change this if TOS changes
public static int CURRENT_TOS_VER = 3;
// Variables
public static Dictionary<AlgorithmType, NiceHashSMA> NiceHashData = null;
public static double BitcoinUSDRate;
public static JsonSerializerSettings JsonSettings = null;
public static int ThreadsPerCPU;
// quickfix guard for checking internet conection
public static bool IsFirstNetworkCheckTimeout = true;
public static int FirstNetworkCheckTimeoutTimeMS = 500;
public static int FirstNetworkCheckTimeoutTries = 10;
public static string GetLocationURL(AlgorithmType AlgorithmType, string miningLocation, NHMConectionType ConectionType) {
if (Globals.NiceHashData != null && Globals.NiceHashData.ContainsKey(AlgorithmType)) {
string name = Globals.NiceHashData[AlgorithmType].name;
int n_port = Globals.NiceHashData[AlgorithmType].port;
int ssl_port = 30000 + n_port;
// NHMConectionType.NONE
string prefix = "";
int port = n_port;
if (NHMConectionType.LOCKED == ConectionType) {
return miningLocation;
}
if (NHMConectionType.STRATUM_TCP == ConectionType) {
prefix = "stratum+tcp://";
}
if (NHMConectionType.STRATUM_SSL == ConectionType) {
prefix = "stratum+ssl://";
port = ssl_port;
}
return prefix
+ name
+ "." + miningLocation
+ ".nicehash.com:"
+ port;
}
return "";
}
}
}