using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
|
|
using System.Net.Sockets;
|
using System.Net.NetworkInformation;
|
|
namespace Shared
|
{
|
[System.Serializable]
|
public static class Global
|
{
|
/// <summary>
|
/// ±¾µØ×ÓÍøºÅ
|
/// </summary>
|
public static readonly byte LocalSubnetID = 252;
|
/// <summary>
|
/// ±¾µØÉ豸ºÅ
|
/// </summary>
|
public static readonly byte LocalDeviceID = 252;
|
/// <summary>
|
/// ±¾µØÉ豸ÀàÐÍ
|
/// </summary>
|
public static readonly int DeviceType = 0xFFFC;
|
|
/// <summary>
|
/// »ñÈ¡µ±Ç°wifiµÄIPµØÖ·
|
/// </summary>
|
/// <returns></returns>
|
public static string IpAddress
|
{
|
get
|
{
|
foreach (var networkInterface in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
|
{
|
foreach (var unicastAddresses in networkInterface.GetIPProperties().UnicastAddresses)
|
{
|
if (unicastAddresses.Address.AddressFamily == AddressFamily.InterNetwork && unicastAddresses.Address.ToString() != "127.0.0.1")
|
{
|
return unicastAddresses.Address.ToString();
|
}
|
}
|
}
|
return "127.0.0.1";
|
}
|
}
|
}
|
}
|