static void Main(string[] args) { /* "255.255.255.128 */ IPV4 IP = new IPV4(); var aa1 = IP.GetSubnetMask(25); var aa11 = IP.GetSubnetMaskFast(25); var aa2 = aa1.ToIp(); var aa3 = aa1 & "2.0.254.1".ToInteger(); var aa4 = aa3.ToIp(); var aa5 = IP.CalcMinCidr(512); var result = new string[0]; IP.Subnet("192.168.1.1", "192.168.1.12", ref result); var a1 = "255.255.255.128"; var a2 = "255.255.255.255"; var b1 = a1.ToInteger(); var b2 = a2.ToInteger(); var c1 = b1 ^ b2; var c2 = Math.Log(c1 + 1, 2); var mmmm = "1.0.1.0".ToInteger(); var nnnn = 16777472u.ToIp(); var cfg = new HTTPHelper.Config() { UseProxy = false, ManualSetIp = false }; cfg = null; //var content = HTTPHelper.Get("http://ftp.arin.net/pub/stats/apnic/delegated-apnic-latest", 3000, cfg: cfg); var content = File.ReadAllText("D:/TMP/delegated-apnic-latest.txt"); InternetResource res = new InternetResource(); res.Parse(content); var data = res.IPV4; //var ipv4 = res.IPV4.Where(I => I.CC == "CN").Select(I => I.ConvertTo(AddressFamily.InterNetwork)).ToList(); var ipv4 = res.IPV4.Where(I => I.CC == "CN").Select(I => I.ConvertToCIDR(AddressFamily.InterNetwork)).ToList(); }
/// <summary> /// apnic|CN|ipv4|1.0.1.0|256|20110414|allocated /// </summary> /// <param name="data"></param> /// <returns></returns> public static List <InternetResource_Record> IP(this InternetResource data, string ipType = "ipv4") { return(data.Records.Where(R => R.Type == ipType).Select(R => R).ToList());; }
private void buttonOK_Click(object sender, EventArgs e) { switch (ComboBoxSelected.SelectedIndex) { case 0: { Book book = new Book(this); book.Show(); Hide(); break; } case 1: { MagazineArticle article = new MagazineArticle(this); article.Show(); Hide(); break; } case 2: { DigestArticle article = new DigestArticle(this); article.Show(); Hide(); break; } case 3: { NewspaperArticle article = new NewspaperArticle(this); article.Show(); Hide(); break; } case 4: { Dissertation dis = new Dissertation(this); dis.Show(); Hide(); break; } case 5: { Abstract abs = new Abstract(this); abs.Show(); Hide(); break; } case 6: { InternetResource res = new InternetResource(this); res.Show(); Hide(); break; } default: break; } }