コード例 #1
0
ファイル: NetworkDevice.cs プロジェクト: priestofpsi/EasyDNS
        public void UpdateDNSConfiguration(DNSConfiguration configuration)
        {
            if (configuration == null)
            {
                return;
            }

            this.adapterInfo.DNSConfiguration = configuration;
        }
コード例 #2
0
        public bool Equals(DNSConfiguration other)
        {
            if (other == null)
            {
                return(false);
            }

            bool primary, secondary;

            primary   = (this.PrimaryDNS == null && other.PrimaryDNS == null) || (this.PrimaryDNS != null && this.PrimaryDNS.Equals(other.PrimaryDNS));
            secondary = (this.SecondaryDNS == null && other.SecondaryDNS == null) || (this.SecondaryDNS != null && this.SecondaryDNS.Equals(other.SecondaryDNS));
            return(primary && secondary);
        }
コード例 #3
0
ファイル: DNSService.cs プロジェクト: priestofpsi/EasyDNS
        public void ChangeDNS(DNSConfiguration newConfiguration, byte[] macAddress)
        {
            PhysicalAddress physicalAddress = new PhysicalAddress(macAddress);

            try
            {
                this.WriteEventLog($"{nameof(ChangeDNS)}({newConfiguration}, {macAddress})");
                this.VerifyAndInitializeCallback();
                NetworkAdapterInfo adapter = new NetworkAdapterInfo(physicalAddress);
                NetworkAdapterInfo originalConfiguration = adapter.Clone();
                uint responseCode = adapter.SetDNSConfiguration(newConfiguration);
                this.OnNetworkConfigurationChanged(adapter, new NetworkAdapterInfo(physicalAddress));
            }
            catch (Exception ex)
            {
                this.WriteEventLog($"Error Exeucuting: {nameof(ChangeDNS)}({newConfiguration}, {physicalAddress}): {ex.Message}", System.Diagnostics.EventLogEntryType.Error);
            }
        }
コード例 #4
0
 private void UpdateDeviceDNSStatus(DNSConfiguration configuration = null)
 {
     Task.Run(() =>
     {
         BindDNSSettings();
         this.UpdateStatusMessage("Fetching DNS Configuration...");
         if (configuration == null)
         {
             configuration = this.proxy.GetDNSConfiguration(this.SelectedNetworkDevice.MACAddress.GetAddressBytes()).Result;
         }
         this.Invoke(() =>
         {
             this.lblCPrimaryDNS.Text   = $"Primary: {configuration.PrimaryDNS}";
             this.lblCSecondaryDNS.Text = (configuration.SecondaryDNS != null) ? $"Secondary: {configuration.SecondaryDNS}" : string.Empty;
             this.pnlDeviceDNS.Visible  = (this.SelectedNetworkDevice != null);
         });
         this.UpdateStatusMessage();
     });
 }