32 أسطر
1.3 KiB
C#
32 أسطر
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Pingerino.Services.Interfaces
|
|
{
|
|
public interface INetworkService : IDisposable
|
|
{
|
|
System.Threading.Tasks.Task<string> GetPublicIpAddressAsync(CancellationToken cancellationToken = default);
|
|
System.Threading.Tasks.Task<List<NetworkAdapterInfo>> GetNetworkAdaptersAsync();
|
|
System.Threading.Tasks.Task<bool> ResetNetworkAdapterAsync(string adapterName, IProgress<int> progress = null, CancellationToken cancellationToken = default);
|
|
System.Threading.Tasks.Task<NetworkAdapterInfo> GetActiveEthernetAdapterAsync();
|
|
System.Threading.Tasks.Task<bool> IsNetworkAvailableAsync();
|
|
}
|
|
|
|
public class NetworkAdapterInfo
|
|
{
|
|
public string Name { get; set; }
|
|
public string Description { get; set; }
|
|
public string PhysicalAddress { get; set; }
|
|
public bool IsDhcpEnabled { get; set; }
|
|
public string IpAddress { get; set; }
|
|
public string SubnetMask { get; set; }
|
|
public string DefaultGateway { get; set; }
|
|
public string DhcpServer { get; set; }
|
|
public List<string> DnsServers { get; set; } = new List<string>();
|
|
public bool IsActive { get; set; }
|
|
public string InterfaceType { get; set; }
|
|
}
|
|
}
|