public void ApplyMachineInformation(string ipAddress, Remoting.Data.Transfer.Machine machine) { if (ipAddress.Equals("localhost")) { ipAddress = ThisPCInstance.IpAddress; } Instance instance = Instances.SingleOrDefault(i => i.IpAddress.Equals(ipAddress)); if (instance != null) { instanceUpdateDates[instance] = DateTime.Now; instanceMachines[instance] = machine; } TreeNode[] nodes = treeView1.Nodes[0].Nodes.Find(ipAddress, false); if (nodes.Length > 0) { if ((machine.TotalSha256Hashrate > 0) && (machine.TotalScryptHashrate > 0)) { nodes[0].Text = String.Format("{0} ({1}, {2})", GetMachineName(ipAddress), machine.TotalSha256Hashrate.ToHashrateString(), machine.TotalScryptHashrate.ToHashrateString()); } else if (machine.TotalSha256Hashrate > 0) { nodes[0].Text = String.Format("{0} ({1})", GetMachineName(ipAddress), machine.TotalSha256Hashrate.ToHashrateString()); } else if (machine.TotalScryptHashrate > 0) { nodes[0].Text = String.Format("{0} ({1})", GetMachineName(ipAddress), machine.TotalScryptHashrate.ToHashrateString()); } else { nodes[0].Text = GetMachineName(ipAddress); } } RemoveOrphans(); RefreshNetworkTotals(); }
private void RefreshNetworkTotals() { Dictionary <string, double> algorithmTotals = new Dictionary <string, double>(); foreach (KeyValuePair <Instance, Remoting.Data.Transfer.Machine> instanceMachine in instanceMachines) { Instance instance = instanceMachine.Key; Remoting.Data.Transfer.Machine machine = instanceMachine.Value; foreach (KeyValuePair <string, double> totalHashrate in machine.TotalHashrates) { string algorithm = totalHashrate.Key; double hashrate = totalHashrate.Value; if (hashrate > 0.00) { if (algorithmTotals.ContainsKey(algorithm)) { hashrate += algorithmTotals[algorithm]; } algorithmTotals[algorithm] = hashrate; } } } string text = String.Empty; foreach (KeyValuePair <string, double> algorithmTotal in algorithmTotals) { string algorithm = algorithmTotal.Key; double hashrate = algorithmTotal.Value; if (!String.IsNullOrEmpty(text)) { text = text + ", "; } text = String.Format("{0}{1}: {2}", text, algorithm, hashrate.ToHashrateString()); } if (!String.IsNullOrEmpty(text)) { treeView1.Nodes[0].Text = String.Format("{0}, ({1})", NetworkText, text); } else { treeView1.Nodes[0].Text = NetworkText; } }
public void ApplyMachineInformation(string ipAddress, Remoting.Data.Transfer.Machine machine) { if (ipAddress.Equals("localhost")) { ipAddress = instanceManager.ThisPCInstance.IpAddress; } Instance instance = instanceManager.Instances.SingleOrDefault(i => i.IpAddress.Equals(ipAddress)); if (instance != null) { instanceUpdateDates[instance] = DateTime.Now; instanceMachines[instance] = machine; } TreeNode[] nodes = treeView1.Nodes[0].Nodes.Find(ipAddress, false); if (nodes.Length > 0) { if (machine.TotalHashrates.Keys.Count > 0) { string text = String.Empty; foreach (string algorithm in machine.TotalHashrates.Keys) { if (!String.IsNullOrEmpty(text)) { text = text + ", "; } text = String.Format("{0}{1}: {2}", text, algorithm, machine.TotalHashrates[algorithm].ToHashrateString()); } nodes[0].Text = String.Format("{0} ({1})", GetMachineName(ipAddress), text); } else { nodes[0].Text = GetMachineName(ipAddress); } } RemoveOrphans(); RefreshNetworkTotals(); }
private void BroadcastHashrate() { //broadcast 0 (e.g. even if not mining) Remoting.Data.Transfer.Machine machine = new Remoting.Data.Transfer.Machine(); PopulateLocalMachineHashrates(machine, false); try { Remoting.Broadcast.Broadcaster.Broadcast(machine); } catch (SocketException ex) { //e.g. no network connection on Linux ShowMultiMinerRemotingError(ex); } }
private void UpdateInstancesStatsFromLocal() { if (instancesControl.Visible) { Remoting.Data.Transfer.Machine machine = new Remoting.Data.Transfer.Machine(); PopulateLocalMachineHashrates(machine, true); instancesControl.ApplyMachineInformation("localhost", machine); UpdateInstancesVisibility(); } }
private void SendHashrate(string ipAddress) { Remoting.Data.Transfer.Machine machine = new Remoting.Data.Transfer.Machine(); PopulateLocalMachineHashrates(machine, false); Remoting.Broadcast.Sender.Send(IPAddress.Parse(ipAddress), machine); }
private void BroadcastHashrate() { //broadcast 0 (e.g. even if not mining) Remoting.Data.Transfer.Machine machine = new Remoting.Data.Transfer.Machine(); machine.TotalScryptHashrate = GetLocalInstanceHashrate(CoinAlgorithm.Scrypt, false); machine.TotalSha256Hashrate = GetLocalInstanceHashrate(CoinAlgorithm.SHA256, false); try { Remoting.Broadcast.Broadcaster.Broadcast(machine); } catch (SocketException ex) { //e.g. no network connection on Linux ShowMultiMinerRemotingError(ex); } }
private void UpdateInstancesStatsFromLocal() { if (instancesControl.Visible) { Remoting.Data.Transfer.Machine machine = new Remoting.Data.Transfer.Machine(); machine.TotalScryptHashrate = GetLocalInstanceHashrate(CoinAlgorithm.Scrypt, true); machine.TotalSha256Hashrate = GetLocalInstanceHashrate(CoinAlgorithm.SHA256, true); instancesControl.ApplyMachineInformation("localhost", machine); UpdateInstancesVisibility(); } }
private void SendHashrate(string ipAddress) { Remoting.Data.Transfer.Machine machine = new Remoting.Data.Transfer.Machine(); machine.TotalScryptHashrate = GetLocalInstanceHashrate(CoinAlgorithm.Scrypt, false); machine.TotalSha256Hashrate = GetLocalInstanceHashrate(CoinAlgorithm.SHA256, false); Remoting.Broadcast.Sender.Send(IPAddress.Parse(ipAddress), machine); }