Ejemplo n.º 1
0
        public SteamIPAddress_t(IPAddress iPAddress)
        {
            byte[] addressBytes = iPAddress.GetAddressBytes();
            switch (iPAddress.AddressFamily)
            {
            case AddressFamily.InterNetwork:
                if (addressBytes.Length != 4)
                {
                    throw new TypeInitializationException("SteamIPAddress_t: Unexpected byte length for Ipv4." + addressBytes.Length, null);
                }
                m_ip0   = (addressBytes[0] << 24) | (addressBytes[1] << 16) | (addressBytes[2] << 8) | addressBytes[3];
                m_ip1   = 0L;
                m_eType = ESteamIPType.k_ESteamIPTypeIPv4;
                break;

            case AddressFamily.InterNetworkV6:
                if (addressBytes.Length != 16)
                {
                    throw new TypeInitializationException("SteamIPAddress_t: Unexpected byte length for Ipv6: " + addressBytes.Length, null);
                }
                m_ip0   = (addressBytes[1] << 24) | (addressBytes[0] << 16) | (addressBytes[3] << 8) | addressBytes[2] | (addressBytes[5] << 24) | (addressBytes[4] << 16) | (addressBytes[7] << 8) | addressBytes[6];
                m_ip1   = (addressBytes[9] << 24) | (addressBytes[8] << 16) | (addressBytes[11] << 8) | addressBytes[10] | (addressBytes[13] << 24) | (addressBytes[12] << 16) | (addressBytes[15] << 8) | addressBytes[14];
                m_eType = ESteamIPType.k_ESteamIPTypeIPv6;
                break;

            default:
                throw new TypeInitializationException("SteamIPAddress_t: Unexpected address family " + iPAddress.AddressFamily, null);
            }
        }
Ejemplo n.º 2
0
		public SteamIPAddress_t(System.Net.IPAddress iPAddress)
		{
			byte[] bytes = iPAddress.GetAddressBytes();
			switch (iPAddress.AddressFamily)
			{
				case System.Net.Sockets.AddressFamily.InterNetwork:
				{
					if (bytes.Length != 4)
					{
						throw new System.TypeInitializationException("SteamIPAddress_t: Unexpected byte length for Ipv4." + bytes.Length, null);
					}

					m_ip0 = (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3];
					m_ip1 = 0;
					m_eType = ESteamIPType.k_ESteamIPTypeIPv4;
					break;
				}
				case System.Net.Sockets.AddressFamily.InterNetworkV6:
				{
					if (bytes.Length != 16)
					{
						throw new System.TypeInitializationException("SteamIPAddress_t: Unexpected byte length for Ipv6: " + bytes.Length, null);
					}

					m_ip0 = (bytes[1] << 56) | (bytes[0] << 48) | (bytes[3] << 40) | (bytes[2] << 32) | (bytes[5] << 24) | (bytes[4] << 16) | (bytes[7] << 8) | bytes[6];
					m_ip1 = (bytes[9] << 56) | (bytes[8] << 48) | (bytes[11] << 40) | (bytes[10] << 32) | (bytes[13] << 24) | (bytes[12] << 16) | (bytes[15] << 8) | bytes[14];
					m_eType = ESteamIPType.k_ESteamIPTypeIPv6;
					break;
				}
				default:
				{
					throw new System.TypeInitializationException("SteamIPAddress_t: Unexpected address family " + iPAddress.AddressFamily, null);
				}
			}
		}
Ejemplo n.º 3
0
        private ESteamIPType m_eType; // 0x10

        // Constructors
        public SteamIPAddress_t(IPAddress iPAddress)
        {
            m_ip0   = default;
            m_ip1   = default;
            m_eType = default;
        }         // 0x000000018002AC30-0x000000018002AC90