Home

Awesome

phonedata port to CSharp

It can download from Nuget.com use Powershell

Install-Package Phonedata -Version 1.2.1

Test Platform:

Windows 7 x64/Widnwos 10 x64
Net Framework v4.6.1
dotnet core 6.0 

手机号码库

phone type沿用源数据的定义:

其他语言实现

go: https://github.com/xluohome/phonedata

python: https://github.com/lovedboy/phone

php : https://github.com/shitoudev/phone-location , https://github.com/iwantofun/php_phone

php ext: https://github.com/jonnywang/phone

java: https://github.com/fengjiajie/phone-number-geo

Node: https://github.com/conzi/phone

C++: https://github.com/yanxijian/phonedata

C#: https://github.com/sndnvaps/Phonedata

Rust: https://github.com/vincascm/phonedata

Kotlin: https://github.com/bytebeats/phone-geo

下载 phone.dat 文件,用其他语言解析即可。

phone.dat文件格式


        | 4 bytes |                     <- phone.dat 版本号
        ------------
        | 4 bytes |                     <-  第一个索引的偏移
        -----------------------
        |  offset - 8            |      <-  记录区
        -----------------------
        |  index                 |      <-  索引区
        -----------------------

解析步骤:

How to use it

import phonedata.dll to you C# project after build from source code or just use Powershell to install it 

example code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Phonedata;

namespace phonedatacmd
{
    class Program
    {


        static void Main(string[] args)
        {
            Phonedata.Phonedata pd = new Phonedata.Phonedata("phone.dat");
            string output;
            output = pd.Lookup("13822399111").ToString();
            Console.WriteLine(output);
        }
    }
}

安全保证

手机号归属地信息是通过网上公开数据进行收集整理。

对手机号归属地信息数据的绝对正确,我不做任何保证。因此在生产环境使用前请您自行校对测试。


Buy me a beer

<a href="https://liberapay.com/sndnvaps/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>

License

MIT