コード例 #1
0
        /// <summary>
        /// Retrieve Information
        /// </summary>
        /// <param name="queryValue">What you want to query, usually an IP address</param>
        /// <param name="queryType">Typically an ipaddress, but also able to query a domain or email</param>
        /// <returns></returns>
        public IpifyGeoInformation Get(string queryValue, QueryType queryType = QueryType.IP_Address)
        {
            string ipifyIdentifier = typeof(QueryType).GetField(Enum.GetName(typeof(QueryType), queryType)).GetCustomAttributes(false).OfType <QueryNameAttribute>().SingleOrDefault().name;

            return(JsonConvert.DeserializeObject <IpifyGeoInformation>(Download.IpifiyString(string.Format(ipifyAddress, APIKey, ipifyIdentifier, queryValue))));
        }
コード例 #2
0
ファイル: Ipify.cs プロジェクト: spreedated/IpifyLibrary
 /// <summary>
 /// Get public IPv6 Address as System.Net.IPAddress
 /// </summary>
 /// <param name="useHttps">Using SSL path of ipify.org (HTTPS)</param>
 /// <returns>System.Net.IPAddress</returns>
 public static IPAddress GetPublicIPv6Address(bool useHttps = true)
 {
     return(IPAddress.Parse(Download.IpifiyString(useHttps ? ipifyAdressv6Secure : ipifyAdressv6)));
 }