private void SettingsForm_Load(object sender, EventArgs e) { PopulatePriorities(); //populate before loading settings LoadSettings(); autoLaunchCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; sysTrayCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; }
private void AdvancedSettingsForm_Load(object sender, EventArgs e) { xgminerConfigurationBindingSource.DataSource = workingMinerConfiguration; applicationConfigurationBindingSource.DataSource = workingApplicationConfiguration; autoDesktopCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; LoadSettings(); }
private static void CheckAndShowCursor(Form activeForm) { if (OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix) { // Send WM_SETCURSOR NativeMethods.SendMessage(activeForm.Handle, 0x20, activeForm.Handle, (IntPtr)1); } }
public void SaveApplicationConfiguration() { ConfigurationReaderWriter.WriteConfiguration(this, ApplicationConfigurationFileName()); if (OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix) { ApplyLaunchOnWindowsStartup(); } }
public static string GetWorkGroupName() { string result = String.Empty; if (OSVersionPlatform.GetConcretePlatform() == PlatformID.MacOSX) { //OS X string configFilePath = @"/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist"; PlistParser parser = new PlistParser(configFilePath); const string workgroupKey = "Workgroup"; if (parser.ContainsKey(workgroupKey)) { result = parser[workgroupKey].ToString(); } else { const string defaultWorkgroup = "WORKGROUP"; result = defaultWorkgroup; } } else if (OSVersionPlatform.GetGenericPlatform() == PlatformID.Unix) { //Linux string configFilePath = @"/etc/samba/smb.conf"; IniFileParser parser = new IniFileParser(configFilePath); result = parser.GetValue("Global", "Workgroup"); } else { //Windows using (ManagementObject managementObject = new ManagementObject(String.Format("Win32_ComputerSystem.Name='{0}'", Environment.MachineName))) { object workgroup = managementObject["Workgroup"]; //Workgroup is NULL under XP and Server OS //instead read Domain if (workgroup == null) { workgroup = managementObject["Domain"]; const string LocalSuffix = ".local"; if (workgroup != null) { string domain = (string)workgroup; if (domain.EndsWith(LocalSuffix)) { domain = Path.GetFileNameWithoutExtension(domain); } workgroup = domain; } } result = workgroup.ToString(); } } return(result); }
private void CoinsForm_Load(object sender, EventArgs e) { //not supported on mono if (OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix) { coinListBox.AllowDrop = true; } PopulateConfigurations(); UpdateButtonStates(); }
private void SettingsForm_Load(object sender, EventArgs e) { PopulatePriorities(); //populate before loading settings LoadSettings(); autoLaunchCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; sysTrayCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; coinApiCombo.SelectedIndex = applicationConfiguration.UseCoinWarzApi ? 1 : 0; UpdateMobileMinerControls(); }
private static string GetWorkerName() { if (OSVersionPlatform.GetGenericPlatform() == PlatformID.Unix) { return("mmdonations"); } else { return(Fingerprint.Value().Replace("-", "")); } }
public void SaveApplicationConfiguration(string configDirectory = null) { InitializeConfigDirectory(configDirectory); ConfigurationReaderWriter.WriteConfiguration(this, ApplicationConfigurationFileName()); if (OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix) { ApplyLaunchOnWindowsStartup(); } }
private void AdvancedSettingsForm_Load(object sender, EventArgs e) { xgminerConfigurationBindingSource.DataSource = workingMinerConfiguration; applicationConfigurationBindingSource.DataSource = workingApplicationConfiguration; autoDesktopCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; PopulateIntervalCombo(); PopulateAlgorithmCombo(); LoadSettings(); algoArgCombo.Text = CoinAlgorithm.SHA256.ToString().ToSpaceDelimitedWords(); }
private void SettingsForm_Load(object sender, EventArgs e) { // adjust height for hidden MobileMiner settings Height = Height - 65; PopulatePriorities(); //populate before loading settings LoadSettings(); autoLaunchCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; sysTrayCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; coinApiCombo.SelectedIndex = applicationConfiguration.UseCoinWarzApi ? CoinWarzIndex : WhatToMineIndex; PopulateApiKey(); }
private void SettingsForm_Load(object sender, EventArgs e) { PopulatePriorities(); //populate before loading settings LoadSettings(); autoLaunchCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; sysTrayCheckBox.Enabled = OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix; coinApiCombo.SelectedIndex = applicationConfiguration.UseCoinWarzApi ? CoinWarzIndex : (applicationConfiguration.UseWhatMineApi ? WhatMineIndex : (applicationConfiguration.UseWhatToMineApi ? WhatToMineIndex : CoinChooseIndex)); PopulateApiKey(); }
public static void UnzipFileToFolder(string zipFilePath, string destionationFolder) { Directory.CreateDirectory(destionationFolder); if (OSVersionPlatform.GetGenericPlatform() == PlatformID.Unix) { UnzipFileToFolderUnix(zipFilePath, destionationFolder); } #if !__MonoCS__ else { UnzipFileToFolderWindows(zipFilePath, destionationFolder); } #endif }
private void coinListBox_MouseMove(object sender, MouseEventArgs e) { //not supported on mono if (OSVersionPlatform.GetGenericPlatform() == PlatformID.Unix) { return; } if (e.Button == System.Windows.Forms.MouseButtons.Left) { if (coinListBox.SelectedItem == null) { return; } coinListBox.DoDragDrop(coinListBox.SelectedItem, DragDropEffects.Move); } }
internal static string GetIPv4Mask(string networkInterfaceName) { if (OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix) { throw new NotImplementedException(); } IntPtr ifap; if (getifaddrs(out ifap) != 0) { throw new SystemException("getifaddrs() failed"); } try { var next = ifap; while (next != IntPtr.Zero) { var addr = (ifaddrs)Marshal.PtrToStructure(next, typeof(ifaddrs)); var name = addr.ifa_name; if (addr.ifa_addr != IntPtr.Zero) { var sockaddr = (sockaddr_in)Marshal.PtrToStructure(addr.ifa_addr, typeof(sockaddr_in)); switch (sockaddr.sin_family) { case AF_INET6: break; case AF_INET: if (name == networkInterfaceName) { var netmask = (sockaddr_in)Marshal.PtrToStructure(addr.ifa_netmask, typeof(sockaddr_in)); var ipAddr = new IPAddress(netmask.sin_addr); // IPAddress to format into default string notation return(ipAddr.ToString()); } break; case AF_PACKET: { var sockaddrll = (sockaddr_ll)Marshal.PtrToStructure(addr.ifa_addr, typeof(sockaddr_ll)); if (sockaddrll.sll_halen > sockaddrll.sll_addr.Length) { Console.Error.WriteLine("Got a bad hardware address length for an AF_PACKET {0} {1}", sockaddrll.sll_halen, sockaddrll.sll_addr.Length); next = addr.ifa_next; continue; } } break; } } next = addr.ifa_next; } } finally { freeifaddrs(ifap); } return(null); }
public static List <NetworkInterfaceInfo> GetLocalNetworkInterfaces( SubnetClass subnetClasses = SubnetClass.C, bool flushCache = false) { if (flushCache) { localNetworkInterfaces = null; } if (localNetworkInterfaces != null) { return(localNetworkInterfaces); } List <NetworkInterfaceInfo> workingInterfaces = new List <NetworkInterfaceInfo>(); NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface networkInterface in networkInterfaces) { if ((networkInterface.NetworkInterfaceType == NetworkInterfaceType.Loopback) || (networkInterface.NetworkInterfaceType == NetworkInterfaceType.Tunnel) || (networkInterface.OperationalStatus != OperationalStatus.Up)) { continue; } IPInterfaceProperties ipProperties = networkInterface.GetIPProperties(); foreach (UnicastIPAddressInformation ipInformation in ipProperties.UnicastAddresses) { IPAddress ipv4Mask = null; if (OSVersionPlatform.GetGenericPlatform() == PlatformID.Unix) { //Mono does not implement IPv4Mask //see https://bugzilla.xamarin.com/show_bug.cgi?id=2033 string mask = IPInfoTools.GetIPv4Mask(networkInterface.Name); if (mask == null || IPAddress.TryParse(mask, out ipv4Mask) == false) { ipv4Mask = IPAddress.Parse("255.255.255.0"); // default to this } } else { ipv4Mask = ipInformation.IPv4Mask; } SubnetClass interfaceClass = ipv4Mask.GetSubnetClass(); //optionally scan class A & B subnets if (!((subnetClasses & interfaceClass) == interfaceClass)) { continue; } IPAddress ipAddress = ipInformation.Address; if (ipAddress.AddressFamily == AddressFamily.InterNetwork) { NetworkInterfaceInfo interfaceInfo = new NetworkInterfaceInfo(); interfaceInfo.Host = ipAddress; interfaceInfo.Netmask = ipv4Mask; interfaceInfo.Broadcast = GetBroadcastAddress(interfaceInfo.Host, interfaceInfo.Netmask); //deprecations are known - we only support IPv4 scanning with this code //see above check for AddressFamily.InterNetwork long host = (long)(uint)IPAddress.NetworkToHostOrder((int)interfaceInfo.Host.Address); long netmask = (long)(uint)IPAddress.NetworkToHostOrder((int)interfaceInfo.Netmask.Address); long broadcast = (long)(uint)IPAddress.NetworkToHostOrder((int)interfaceInfo.Broadcast.Address); long network = host & netmask; long rangeStart = network + 1; long rangeEnd = broadcast - 1; //e.g. if host == broadcast, netmask == 255.255.255.255 if (rangeEnd < rangeStart) { long swap = rangeEnd; rangeEnd = rangeStart; rangeStart = swap; } interfaceInfo.RangeStart = new IPAddress((long)(uint)IPAddress.HostToNetworkOrder((int)rangeStart)); interfaceInfo.RangeEnd = new IPAddress((long)(uint)IPAddress.HostToNetworkOrder((int)rangeEnd)); workingInterfaces.Add(interfaceInfo); } } } //cache the results localNetworkInterfaces = workingInterfaces; return(localNetworkInterfaces); }
private void UpdateAutoCheckBox() { autoDesktopCheckBox.Enabled = !disableGpuCheckbox.Checked && (OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix); }