Permalink
Browse files

Initial checkin.

  • Loading branch information...
1 parent 1dbc64a commit 6fa574b174c7f55edf1bbd22f81cff3ba21b8ae5 @StuffOfInterest committed Oct 6, 2014
Showing with 16,167 additions and 0 deletions.
  1. +28 −0 MinerControl.sln
  2. +14 −0 MinerControl/AlgorithmEntry.cs
  3. +6 −0 MinerControl/App.config
  4. +34 −0 MinerControl/ErrorLogger.cs
  5. +67 −0 MinerControl/Extensions.cs
  6. +434 −0 MinerControl/Hardware/NVAPI.cs
  7. +92 −0 MinerControl/Hardware/PInvokeDelegateFactory.cs
  8. +25 −0 MinerControl/IService.cs
  9. +672 −0 MinerControl/MainWindow.Designer.cs
  10. +221 −0 MinerControl/MainWindow.cs
  11. +12,588 −0 MinerControl/MainWindow.resx
  12. +84 −0 MinerControl/MinerControl.conf
  13. +115 −0 MinerControl/MinerControl.csproj
  14. +449 −0 MinerControl/MiningEngine.cs
  15. +15 −0 MinerControl/MiningModeEnum.cs
  16. +23 −0 MinerControl/PriceEntries/ManualPriceEntry.cs
  17. +23 −0 MinerControl/PriceEntries/NiceHashPriceEntry.cs
  18. +126 −0 MinerControl/PriceEntries/PriceEntryBase.cs
  19. +21 −0 MinerControl/PriceEntries/TradeMyBitPriceEntry.cs
  20. +23 −0 MinerControl/PriceEntries/YaampPriceEntry.cs
  21. +59 −0 MinerControl/Program.cs
  22. +36 −0 MinerControl/Properties/AssemblyInfo.cs
  23. +16 −0 MinerControl/ServiceEnum.cs
  24. +39 −0 MinerControl/Services/ManualService.cs
  25. +21 −0 MinerControl/Services/NiceHashService.cs
  26. +150 −0 MinerControl/Services/NiceHashServiceBase.cs
  27. +135 −0 MinerControl/Services/ServiceBase.cs
  28. +123 −0 MinerControl/Services/TradeMyBitService.cs
  29. +19 −0 MinerControl/Services/WestHashService.cs
  30. +111 −0 MinerControl/Services/YaampService.cs
  31. +84 −0 MinerControl/Utility/ProcessUtil.cs
  32. +54 −0 MinerControl/Utility/PropertyChangedBase.cs
  33. +127 −0 MinerControl/Utility/SortableBindingList.cs
  34. BIN MinerControl/bitcoin.ico
  35. +7 −0 MinerControl/test-run.bat
  36. +6 −0 TestMiner/App.config
  37. +25 −0 TestMiner/Program.cs
  38. +36 −0 TestMiner/Properties/AssemblyInfo.cs
  39. +59 −0 TestMiner/TestMiner.csproj
View
@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.30501.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinerControl", "MinerControl\MinerControl.csproj", "{94CC3F87-4215-4F3F-9524-695BF16FEBD0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestMiner", "TestMiner\TestMiner.csproj", "{63721D21-B76A-40AE-9A37-0C6F392CEE63}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {94CC3F87-4215-4F3F-9524-695BF16FEBD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {94CC3F87-4215-4F3F-9524-695BF16FEBD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {94CC3F87-4215-4F3F-9524-695BF16FEBD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {94CC3F87-4215-4F3F-9524-695BF16FEBD0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {63721D21-B76A-40AE-9A37-0C6F392CEE63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {63721D21-B76A-40AE-9A37-0C6F392CEE63}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {63721D21-B76A-40AE-9A37-0C6F392CEE63}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {63721D21-B76A-40AE-9A37-0C6F392CEE63}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MinerControl
+{
+ public class AlgorithmEntry
+ {
+ public string Name { get; set; }
+ public decimal Hashrate { get; set; }
+ public decimal Power { get; set; }
+ }
+}
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
+ </startup>
+</configuration>
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace MinerControl
+{
+ public static class ErrorLogger
+ {
+ const string logfile = "error.log";
+
+ public static bool LogExceptions { get; set; }
+
+ public static void Log(Exception ex)
+ {
+ var sb = new StringBuilder();
+ sb.AppendLine();
+ sb.AppendLine(DateTime.Now.ToString());
+ sb.AppendLine("----------------------------------------------");
+ sb.AppendLine(string.Format("Type: {0}", ex.GetType().Name));
+ sb.AppendLine(string.Format("Message: {0}", ex.Message));
+ sb.AppendLine(string.Format("Stack trace: {0}", ex.StackTrace));
+
+ using (var w = File.Exists(logfile) ? File.AppendText(logfile) : File.CreateText(logfile))
+ {
+ w.Write(sb.ToString());
+ }
+
+ if (ex.InnerException != null)
+ Log(ex.InnerException);
+ }
+ }
+}
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+
+namespace MinerControl
+{
+ public static class Extensions
+ {
+ public static string FormatTime(this TimeSpan timeSpan, bool zeroAsEmpty = false)
+ {
+ if (timeSpan == TimeSpan.Zero && zeroAsEmpty)
+ return string.Empty;
+
+ return timeSpan.TotalDays > 1
+ ? timeSpan.ToString(@"dd\.hh\:mm\:ss")
+ : timeSpan.ToString(@"hh\:mm\:ss");
+ }
+
+ public static string FormatTime(this TimeSpan? timeSpan)
+ {
+ if (!timeSpan.HasValue)
+ return string.Empty;
+
+ return timeSpan.Value.FormatTime();
+ }
+
+ public static void AddRange<T>(this IList<T> list, IEnumerable<T> items)
+ {
+ foreach (var item in items)
+ list.Add(item);
+ }
+
+ public static decimal ExtractDecimal(this object raw)
+ {
+ var decimalValue = raw as decimal?;
+ if (decimalValue.HasValue) return decimalValue.Value;
+
+ var doubleValue = raw as double?;
+ if (doubleValue.HasValue) return (decimal)doubleValue.Value;
+
+ var floatValue = raw as float?;
+ if (floatValue.HasValue) return (decimal)floatValue.Value;
+
+ var longValue = raw as long?;
+ if (longValue.HasValue) return (decimal)longValue.Value;
+
+ var intValue = raw as int?;
+ if (intValue.HasValue) return (decimal)intValue.Value;
+
+ decimal parseValue;
+ var style = NumberStyles.AllowDecimalPoint;
+ var culture = CultureInfo.CreateSpecificCulture("en-US");
+
+ if (decimal.TryParse(raw.ToString(), style, culture, out parseValue)) return parseValue;
+
+ return 0;
+ }
+
+ public static string GetString(this IDictionary<string, object> data, string key)
+ {
+ if (!data.ContainsKey(key)) return null;
+ return data[key] as string;
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit 6fa574b

Please sign in to comment.