本帖最后由 ranmer 于 2009-11-06 15:15:58 编辑

解决方案 »

  1.   

    //区间头
    Search_Set = IndexInfoAtPos(Search_Index_Set);
    //区间尾
    Search_End = IndexInfoAtPos(Search_Index_End);
    看看这两个值
      

  2.   

    纯真ip库 它没有存储IP地址字符串,
    也不是一条条“IP、国家、地区” 这样的信息。
    它IP是用UInt32 来表示的。你要把这个UInt32表示的IP,转成"0.0.0.0"形式。其中IndexInfoAtPos(i).Offset就是这个UInt32吧。。没有仔细研究过这个库
      

  3.   

    根据网上的介绍,他的排列是[ip][国家][地区]
    [ip]是7个字节 4节点是起始ip 3个节点是结束ip(也叫上限)他的ip址址转成uint的代码如下
     public UInt32 IPToUInt32(string IpValue)
            {
                string[] IpByte = IpValue.Split('.');
                Int32 nUpperBound = IpByte.GetUpperBound(0);
                if (nUpperBound != 3)
                {
                    IpByte = new string[4];
                    for (Int32 i = 1; i <= 3 - nUpperBound; i++)
                        IpByte[nUpperBound + i] = "0";
                }            byte[] TempByte4 = new byte[4];
                for (Int32 i = 0; i <= 3; i++)
                {
                    //'如果是.Net 2.0可以支持TryParse。
                    //'If Not (Byte.TryParse(IpByte(i), TempByte4(3 - i))) Then
                    //'    TempByte4(3 - i) = &H0
                    //'End If
                    if (IsNumeric(IpByte[i]))
                        TempByte4[3 - i] = (byte)(Convert.ToInt32(IpByte[i]) & 0xff);
                }            return BitConverter.ToUInt32(TempByte4, 0);
            }
      

  4.   

    看下,他怎么传递string IpValue这个值
      

  5.   

    private static string IntToIP(long ip_Int)
            {
                long num = (long)((ip_Int & 0xff000000L) >> 0x18);
                if (num < 0L)
                {
                    num += 0x100L;
                }
                long num2 = (ip_Int & 0xff0000L) >> 0x10;
                if (num2 < 0L)
                {
                    num2 += 0x100L;
                }
                long num3 = (ip_Int & 0xff00L) >> 8;
                if (num3 < 0L)
                {
                    num3 += 0x100L;
                }
                long num4 = ip_Int & 0xffL;
                if (num4 < 0L)
                {
                    num4 += 0x100L;
                }
                return (num.ToString() + "." + num2.ToString() + "." + num3.ToString() + "." + num4.ToString());
            }
    public static string IntToIP(uint ipAddress)
        {
            long ui1 = ipAddress & 0xFF000000;
            ui1 = ui1 >> 24;
            long ui2 = ipAddress & 0x00FF0000;
            ui2 = ui2 >> 16;
            long ui3 = ipAddress & 0x0000FF00;
            ui3 = ui3 >> 8;
            long ui4 = ipAddress & 0x000000FF;
            string IPstr = "";
            IPstr = System.Convert.ToString(ui1) + "." + System.Convert.ToString(ui2) + "." + System.Convert.ToString(ui3) + "." + System.Convert.ToString(ui4);
            return IPstr;
        }