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 { /// /// ���������� /// public static readonly byte LocalSubnetID = 0; /// /// �����豸�� /// public static readonly byte LocalDeviceID = 252; /// /// �����豸���� /// public static readonly int DeviceType = 0xFFFC; /// /// ��ȡ��ǰwifi��IP��ַ /// /// 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"; } } } }