Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit 31dc16a

Browse files
Merge pull request #84 from theLosers106/master
Bug fix
2 parents 1ec1cd5 + 51e405b commit 31dc16a

File tree

9 files changed

+54
-36
lines changed

9 files changed

+54
-36
lines changed

NiceHashMiner/Ethereum.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ public static bool CreateDAGFile(string worker)
218218
{
219219
if (!GetCurrentBlock(worker)) throw new Exception("GetCurrentBlock returns null..");
220220

221-
Helpers.ConsolePrint("Ethereum", "Creating DAG file for " + worker + "..");
221+
// Check if dag-dir exist to avoid ethminer from crashing
222+
Helpers.ConsolePrint("Ethereum", "Creating DAG directory for " + worker + "..");
223+
if (!CreateDAGDirectory(worker)) throw new Exception("[" + worker + "] Cannot create directory for DAG files.");
222224

223225
if (worker.Equals("NVIDIA3.x"))
224226
{
@@ -254,6 +256,8 @@ public static bool CreateDAGFile(string worker)
254256
}
255257
}
256258

259+
Helpers.ConsolePrint("Ethereum", "Creating DAG file for " + worker + "..");
260+
257261
Process P = new Process();
258262
P.StartInfo.FileName = EtherMinerPath;
259263
P.StartInfo.Arguments = " --dag-dir " + Config.ConfigData.DAGDirectory + "\\" + worker + " --create-dag " + CurrentBlockNum;
@@ -274,6 +278,18 @@ public static bool CreateDAGFile(string worker)
274278
return true;
275279
}
276280

281+
public static bool CreateDAGDirectory(string worker)
282+
{
283+
try
284+
{
285+
if (!Directory.Exists(Config.ConfigData.DAGDirectory + "\\" + worker))
286+
Directory.CreateDirectory(Config.ConfigData.DAGDirectory + "\\" + worker);
287+
}
288+
catch { return false; }
289+
290+
return true;
291+
}
292+
277293
private static bool KillAllRunningProxy()
278294
{
279295
Process[] check = Process.GetProcessesByName("ether-proxy");

NiceHashMiner/Form1.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NiceHashMiner/Form1.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,5 +815,14 @@ private void toolStripStatusLabel10_MouseLeave(object sender, EventArgs e)
815815
{
816816
statusStrip1.Cursor = Cursors.Default;
817817
}
818+
819+
private void textBox1_Leave(object sender, EventArgs e)
820+
{
821+
// Commit to config.json
822+
Config.ConfigData.BitcoinAddress = textBox1.Text.Trim();
823+
Config.ConfigData.WorkerName = textBox2.Text.Trim();
824+
Config.ConfigData.Location = comboBox1.SelectedIndex;
825+
Config.Commit();
826+
}
818827
}
819828
}

NiceHashMiner/Form2.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NiceHashMiner/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.4.0.0")]
36-
[assembly: AssemblyFileVersion("1.4.0.0")]
35+
[assembly: AssemblyVersion("1.4.0.1")]
36+
[assembly: AssemblyFileVersion("1.4.0.1")]

NiceHashMiner/SubmitResultDialog.Designer.cs

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NiceHashMiner/SubmitResultDialog.cs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public partial class SubmitResultDialog : Form
1212
{
1313
private bool InBenchmark;
1414
private int Time, TimeIndex, DeviceChecked_Index;
15+
private string CurrentAlgoName;
1516
private Miner mm;
1617

1718
public SubmitResultDialog(int tI)
@@ -60,10 +61,6 @@ private void BenchmarkBtn_Click(object sender, EventArgs e)
6061
if (DevicesListView.Items[i].Selected)
6162
{
6263
DeviceChecked = true;
63-
//Helpers.ConsolePrint("DEBUG TEXT", "SubItems0: " + DevicesListView.Items[i].SubItems[0].Text);
64-
//Helpers.ConsolePrint("DEBUG TEXT", "SubItems1: " + DevicesListView.Items[i].SubItems[1].Text);
65-
//Helpers.ConsolePrint("DEBUG TEXT", "SubItems2: " + DevicesListView.Items[i].SubItems[2].Text);
66-
//Helpers.ConsolePrint("DEBUG TEXT", "SubItems3: " + DevicesListView.Items[i].SubItems[3].Text);
6764
Int32.TryParse(DevicesListView.Items[i].SubItems[2].Text, out DeviceChecked_Index);
6865

6966
mm = DevicesListView.Items[i].Tag as Miner;
@@ -87,7 +84,6 @@ private void BenchmarkBtn_Click(object sender, EventArgs e)
8784
// Temporarily disable the other ComputeDevices in the same Group
8885
for (int i = 0; i < mm.CDevs.Count; i++)
8986
{
90-
Helpers.ConsolePrint("DEBUG", "ID: " + mm.CDevs[i].ID + " .. DeviceChecked_Index: " + DeviceChecked_Index);
9187
if (mm.CDevs[i].ID != DeviceChecked_Index)
9288
mm.CDevs[i].Enabled = false;
9389
else
@@ -96,10 +92,8 @@ private void BenchmarkBtn_Click(object sender, EventArgs e)
9692

9793
index = 0;
9894

99-
Helpers.ConsolePrint("DEBUG", "Items.Count: " + DevicesListView.Items.Count);
10095
BenchmarkProgressBar.Maximum = mm.SupportedAlgorithms.Length;
10196

102-
Helpers.ConsolePrint("DEBUG", "Index: " + index + " .. algo: " + mm.SupportedAlgorithms[index].NiceHashName + " .. length: " + mm.SupportedAlgorithms.Length);
10397
url = "https://www.nicehash.com/?p=calc&name=" + DeviceName;
10498
InitiateBenchmark();
10599
}
@@ -114,8 +108,6 @@ private void InitiateBenchmark()
114108

115109
if (algoIndex < mm.SupportedAlgorithms.Length)
116110
{
117-
Helpers.ConsolePrint("DEBUG IN", "algoIndex: " + algoIndex + " .. algo: " + mm.SupportedAlgorithms[algoIndex].NiceHashName + " .. NiceHashID: " + mm.SupportedAlgorithms[algoIndex].NiceHashID); //9
118-
119111
if (!mm.SupportedAlgorithms[algoIndex].Skip)
120112
{
121113
if (mm is cpuminer)
@@ -131,19 +123,18 @@ private void InitiateBenchmark()
131123
Time += 1;
132124
}
133125

134-
Helpers.ConsolePrint("DEBUG IN", "Benchmark should be starting here.. algoIndex: " + algoIndex + " .. Time: " + Time);
126+
CurrentAlgoName = mm.SupportedAlgorithms[algoIndex].NiceHashName;
127+
UpdateProgressBar(false);
135128
mm.BenchmarkStart(algoIndex, Time, BenchmarkCompleted, DevicesListView.Items[DeviceChecked_Index].Tag);
136129
}
137130
else
138131
{
139-
Helpers.ConsolePrint("DEBUG IN", "ELSE PART");
140-
UpdateProgressBar();
132+
UpdateProgressBar(true);
141133
InitiateBenchmark();
142134
}
143135
}
144136
else
145137
{
146-
Helpers.ConsolePrint("DEBUG", "DONE!!");
147138
double[] div = { 1000000, // Scrypt MH/s
148139
1000000000000, // SHA256 TH/s
149140
1000000, // ScryptNf MH/s
@@ -169,7 +160,6 @@ private void InitiateBenchmark()
169160
{
170161
if (!mm.SupportedAlgorithms[i].Skip)
171162
{
172-
Helpers.ConsolePrint("DEBUG", "Algo: " + mm.SupportedAlgorithms[i].NiceHashName + " .. Speed: " + mm.SupportedAlgorithms[i].BenchmarkSpeed);
173163
int id = mm.SupportedAlgorithms[i].NiceHashID;
174164
if (!mm.SupportedAlgorithms[i].NiceHashName.Equals("ethereum"))
175165
{
@@ -189,7 +179,6 @@ private void InitiateBenchmark()
189179
BenchmarkProgressBar.Value = 0;
190180
LabelProgressPercentage.Text = "Completed!";
191181

192-
//Helpers.ConsolePrint("DEBUG", "Now it is really done .. url: " + url + " .. escaped: " + Uri.EscapeDataString(url));
193182
if (mm.BenchmarkSignalQuit)
194183
{
195184
LabelProgressPercentage.Text = "Stopped!";
@@ -204,7 +193,7 @@ private void BenchmarkCompleted(bool success, string text, object tag)
204193
{
205194
if (this.InvokeRequired)
206195
{
207-
UpdateProgressBar();
196+
UpdateProgressBar(true);
208197
BenchmarkComplete d = new BenchmarkComplete(BenchmarkCompleted);
209198
this.Invoke(d, new object[] { success, text, tag });
210199
}
@@ -214,10 +203,11 @@ private void BenchmarkCompleted(bool success, string text, object tag)
214203
}
215204
}
216205

217-
private void UpdateProgressBar()
206+
private void UpdateProgressBar(bool step)
218207
{
219-
BenchmarkProgressBar.PerformStep();
220-
LabelProgressPercentage.Text = ((double)((double)BenchmarkProgressBar.Value / (double)BenchmarkProgressBar.Maximum) * 100).ToString("F2") + "%";
208+
if (step) BenchmarkProgressBar.PerformStep();
209+
LabelProgressPercentage.Text = ((double)((double)BenchmarkProgressBar.Value / (double)BenchmarkProgressBar.Maximum) * 100).ToString("F2") + "%" +
210+
" : Benchmarking " + CurrentAlgoName + ".. Please wait..";
221211
}
222212
}
223213
}

NiceHashMiner/ccminer.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ protected override string BenchmarkCreateCommandLine(int index, int time)
5252
CommandLine += " --benchmark ";
5353
if (Ethereum.GetCurrentBlock(MinerDeviceName))
5454
CommandLine += Ethereum.CurrentBlockNum;
55+
56+
// Check if dag-dir exist to avoid ethminer from crashing
57+
if (!Ethereum.CreateDAGDirectory(MinerDeviceName)) return "";
5558
}
5659
else
5760
{
@@ -89,10 +92,6 @@ public override void Start(int nhalgo, string url, string username)
8992
{
9093
StartingUpDelay = true;
9194

92-
// Check if dag-dir exist to avoid ethminer from crashing
93-
if (!Directory.Exists(Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName))
94-
Directory.CreateDirectory(Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName);
95-
9695
// Create DAG file ahead of time
9796
if (!Ethereum.CreateDAGFile(MinerDeviceName)) return;
9897

NiceHashMiner/sgminer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ protected override string BenchmarkCreateCommandLine(int index, int time)
301301
CommandLine += " --benchmark ";
302302
if (Ethereum.GetCurrentBlock(MinerDeviceName))
303303
CommandLine += Ethereum.CurrentBlockNum;
304+
305+
// Check if dag-dir exist to avoid ethminer from crashing
306+
if (!Ethereum.CreateDAGDirectory(MinerDeviceName)) return "";
304307
}
305308
else
306309
{

0 commit comments

Comments
 (0)