コード例 #1
0
ファイル: Network.cs プロジェクト: pengyancai/cs-util
 /// <summary>
 /// Gets the network info
 /// </summary>
 /// <param name="Name">Computer name</param>
 /// <param name="Password">Password</param>
 /// <param name="UserName">Username</param>
 private void GetNetworkInfo(string Name, string UserName, string Password)
 {
     NetworkAddresses = new List<NetworkAddress>();
     IPHostEntry HostEntry = Dns.GetHostEntry(Name);
     foreach (IPAddress Address in HostEntry.AddressList)
     {
         NetworkAddress TempAddress = new NetworkAddress();
         TempAddress.Type = Address.AddressFamily.ToString();
         TempAddress.Address = Address.ToString();
         NetworkAddresses.Add(TempAddress);
     }
 }
コード例 #2
0
 /// <summary>
 /// Gets the network info
 /// </summary>
 /// <param name="Name">Computer name</param>
 /// <param name="Password">Password</param>
 /// <param name="UserName">Username</param>
 protected virtual void GetNetworkInfo(string Name, string UserName, string Password)
 {
     Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(Name),"Name");
     NetworkAddresses = new List<NetworkAddress>();
     IPHostEntry HostEntry = Dns.GetHostEntry(Name);
     foreach (IPAddress Address in HostEntry.AddressList)
     {
         NetworkAddress TempAddress = new NetworkAddress();
         TempAddress.Type = Address.AddressFamily.ToString();
         TempAddress.Address = Address.ToString();
         NetworkAddresses.Add(TempAddress);
     }
 }