├── IP区间合并工具 ├── IP区间合并工具.sln ├── IP区间合并工具.v12.suo └── IP区间合并工具 │ ├── IP区间合并工具.Designer.vb │ ├── IP区间合并工具.resx │ ├── IP区间合并工具.vb │ ├── IP区间合并工具.vbproj │ ├── IP区间合并工具.vbproj.user │ ├── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings │ ├── bin │ └── Release │ │ └── IP区间合并工具.exe │ ├── img │ └── demo.png │ └── obj │ ├── Debug │ ├── DesignTimeResolveAssemblyReferences.cache │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── IP区间合并工具.Form1.resources │ ├── IP区间合并工具.Resources.resources │ ├── IP区间合并工具.exe │ ├── IP区间合并工具.pdb │ ├── IP区间合并工具.vbproj.FileListAbsolute.txt │ ├── IP区间合并工具.vbproj.GenerateResource.Cache │ ├── IP区间合并工具.xml │ └── TempPE │ │ └── My Project.Resources.Designer.vb.dll │ └── Release │ ├── DesignTimeResolveAssemblyReferences.cache │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── IP区间合并工具.IP区间合并工具.resources │ ├── IP区间合并工具.Resources.resources │ ├── IP区间合并工具.exe │ ├── IP区间合并工具.vbproj.FileListAbsolute.txt │ ├── IP区间合并工具.vbproj.GenerateResource.Cache │ └── TempPE │ └── My Project.Resources.Designer.vb.dll └── README.md /IP区间合并工具/IP区间合并工具.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "IP区间合并工具", "IP区间合并工具\IP区间合并工具.vbproj", "{072F3A3D-ABCD-4182-9C6E-C725E4E1B79F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {072F3A3D-ABCD-4182-9C6E-C725E4E1B79F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {072F3A3D-ABCD-4182-9C6E-C725E4E1B79F}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {072F3A3D-ABCD-4182-9C6E-C725E4E1B79F}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {072F3A3D-ABCD-4182-9C6E-C725E4E1B79F}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具.v12.suo -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/IP区间合并工具.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class IP区间合并工具 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form 重写 Dispose,以清理组件列表。 6 | _ 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Windows 窗体设计器所必需的 18 | Private components As System.ComponentModel.IContainer 19 | 20 | '注意: 以下过程是 Windows 窗体设计器所必需的 21 | '可以使用 Windows 窗体设计器修改它。 22 | '不要使用代码编辑器修改它。 23 | _ 24 | Private Sub InitializeComponent() 25 | Me.RichTextBox2 = New System.Windows.Forms.RichTextBox() 26 | Me.Button1 = New System.Windows.Forms.Button() 27 | Me.Label1 = New System.Windows.Forms.Label() 28 | Me.TextBox1 = New System.Windows.Forms.TextBox() 29 | Me.Label2 = New System.Windows.Forms.Label() 30 | Me.RichTextBox1 = New System.Windows.Forms.RichTextBox() 31 | Me.Label3 = New System.Windows.Forms.Label() 32 | Me.Label4 = New System.Windows.Forms.Label() 33 | Me.TextBox2 = New System.Windows.Forms.TextBox() 34 | Me.SuspendLayout() 35 | ' 36 | 'RichTextBox2 37 | ' 38 | Me.RichTextBox2.Location = New System.Drawing.Point(282, 107) 39 | Me.RichTextBox2.Name = "RichTextBox2" 40 | Me.RichTextBox2.Size = New System.Drawing.Size(274, 257) 41 | Me.RichTextBox2.TabIndex = 0 42 | Me.RichTextBox2.Text = "" 43 | Me.RichTextBox2.WordWrap = False 44 | ' 45 | 'Button1 46 | ' 47 | Me.Button1.Location = New System.Drawing.Point(481, 24) 48 | Me.Button1.Name = "Button1" 49 | Me.Button1.Size = New System.Drawing.Size(75, 60) 50 | Me.Button1.TabIndex = 1 51 | Me.Button1.Text = "合并" 52 | Me.Button1.UseVisualStyleBackColor = True 53 | ' 54 | 'Label1 55 | ' 56 | Me.Label1.AutoSize = True 57 | Me.Label1.Location = New System.Drawing.Point(12, 9) 58 | Me.Label1.Name = "Label1" 59 | Me.Label1.Size = New System.Drawing.Size(149, 12) 60 | Me.Label1.TabIndex = 2 61 | Me.Label1.Text = "IP文件路径(支持文件拖拽)" 62 | ' 63 | 'TextBox1 64 | ' 65 | Me.TextBox1.AllowDrop = True 66 | Me.TextBox1.Location = New System.Drawing.Point(14, 24) 67 | Me.TextBox1.Name = "TextBox1" 68 | Me.TextBox1.Size = New System.Drawing.Size(461, 21) 69 | Me.TextBox1.TabIndex = 3 70 | ' 71 | 'Label2 72 | ' 73 | Me.Label2.AutoSize = True 74 | Me.Label2.Location = New System.Drawing.Point(282, 92) 75 | Me.Label2.Name = "Label2" 76 | Me.Label2.Size = New System.Drawing.Size(101, 12) 77 | Me.Label2.TabIndex = 4 78 | Me.Label2.Text = "区间合并结果预览" 79 | ' 80 | 'RichTextBox1 81 | ' 82 | Me.RichTextBox1.Location = New System.Drawing.Point(17, 107) 83 | Me.RichTextBox1.Name = "RichTextBox1" 84 | Me.RichTextBox1.Size = New System.Drawing.Size(259, 257) 85 | Me.RichTextBox1.TabIndex = 5 86 | Me.RichTextBox1.Text = "" 87 | Me.RichTextBox1.WordWrap = False 88 | ' 89 | 'Label3 90 | ' 91 | Me.Label3.AutoSize = True 92 | Me.Label3.Location = New System.Drawing.Point(15, 92) 93 | Me.Label3.Name = "Label3" 94 | Me.Label3.Size = New System.Drawing.Size(89, 12) 95 | Me.Label3.TabIndex = 6 96 | Me.Label3.Text = "原文件内容预览" 97 | ' 98 | 'Label4 99 | ' 100 | Me.Label4.AutoSize = True 101 | Me.Label4.Location = New System.Drawing.Point(12, 48) 102 | Me.Label4.Name = "Label4" 103 | Me.Label4.Size = New System.Drawing.Size(113, 12) 104 | Me.Label4.TabIndex = 7 105 | Me.Label4.Text = "IP区间合并后的文件" 106 | ' 107 | 'TextBox2 108 | ' 109 | Me.TextBox2.Location = New System.Drawing.Point(14, 63) 110 | Me.TextBox2.Name = "TextBox2" 111 | Me.TextBox2.Size = New System.Drawing.Size(461, 21) 112 | Me.TextBox2.TabIndex = 8 113 | ' 114 | 'Form1 115 | ' 116 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) 117 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 118 | Me.ClientSize = New System.Drawing.Size(568, 376) 119 | Me.Controls.Add(Me.TextBox2) 120 | Me.Controls.Add(Me.Label4) 121 | Me.Controls.Add(Me.Label3) 122 | Me.Controls.Add(Me.RichTextBox1) 123 | Me.Controls.Add(Me.Label2) 124 | Me.Controls.Add(Me.TextBox1) 125 | Me.Controls.Add(Me.Label1) 126 | Me.Controls.Add(Me.Button1) 127 | Me.Controls.Add(Me.RichTextBox2) 128 | Me.MaximizeBox = False 129 | Me.MaximumSize = New System.Drawing.Size(584, 415) 130 | Me.MinimumSize = New System.Drawing.Size(584, 415) 131 | Me.Name = "Form1" 132 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen 133 | Me.Text = "IP区间合并工具(御剑数据处理工具集)" 134 | Me.ResumeLayout(False) 135 | Me.PerformLayout() 136 | 137 | End Sub 138 | Friend WithEvents RichTextBox2 As System.Windows.Forms.RichTextBox 139 | Friend WithEvents Button1 As System.Windows.Forms.Button 140 | Friend WithEvents Label1 As System.Windows.Forms.Label 141 | Friend WithEvents TextBox1 As System.Windows.Forms.TextBox 142 | Friend WithEvents Label2 As System.Windows.Forms.Label 143 | Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox 144 | Friend WithEvents Label3 As System.Windows.Forms.Label 145 | Friend WithEvents Label4 As System.Windows.Forms.Label 146 | Friend WithEvents TextBox2 As System.Windows.Forms.TextBox 147 | 148 | End Class 149 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/IP区间合并工具.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/IP区间合并工具.vb: -------------------------------------------------------------------------------- 1 | Imports System.Text 2 | 3 | Public Class IP区间合并工具 4 | Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 5 | If TextBox1.TextLength > 0 Then 6 | If IO.File.Exists(TextBox1.Text) Then 7 | Button1.Enabled = False 8 | Threading.ThreadPool.QueueUserWorkItem(AddressOf go, TextBox1.Text) 9 | End If 10 | End If 11 | End Sub 12 | 13 | Private Sub go(ByVal file As String) 14 | Dim intervals As New List(Of Interval) 15 | Dim tmp() As String 16 | Dim ip(3) As Integer 17 | Dim st, ed As Long 18 | Dim i As Integer 19 | Dim Past As Integer 20 | For Each txt In IO.File.ReadLines(file) 21 | If txt.Length = 0 Then Continue For 22 | Past += 1 23 | If txt.Contains("-") Then 24 | tmp = txt.Split("-") 25 | If tmp.Length = 2 Then 26 | st = IpToLong(tmp(0)) 27 | ed = IpToLong(tmp(1)) 28 | intervals.Add(New Interval(st, ed)) 29 | End If 30 | ElseIf txt.Contains("/") Then 31 | tmp = txt.Split("/") 32 | If tmp.Length = 2 Then 33 | Dim ip1 As String = tmp(0) 34 | Dim ip2 As String = tmp(1) 35 | tmp = ip1.Split(".") 36 | For x As Integer = 0 To 3 37 | ip(x) = Integer.Parse(tmp(x)) 38 | tmp(x) = Convert.ToString(ip(x), 2).PadLeft(8, "0") 39 | Next 40 | Dim BitString As String = String.Join("", tmp) 41 | BitString = BitString.Substring(0, CInt(ip2)).PadRight(32, "1") 42 | i = 0 43 | For x As Integer = 0 To 31 Step 8 44 | tmp(i) = BitString.Substring(x, 8) 45 | ip(i) = Convert.ToInt32(tmp(i), 2) 46 | i += 1 47 | Next 48 | ip2 = String.Join(".", ip) 49 | st = IpToLong(ip1) 50 | ed = IpToLong(ip2) 51 | intervals.Add(New Interval(st, ed)) 52 | End If 53 | Else 54 | intervals.Add(New Interval(IpToLong(txt), IpToLong(txt))) 55 | End If 56 | Next 57 | Dim fi As New IO.FileInfo(file) 58 | Dim newfile As String = fi.DirectoryName & "\New_" & fi.Name 59 | Dim IPRes = Merge(intervals) 60 | Dim appstr As New System.Text.StringBuilder 61 | For Each item In IPRes 62 | If item.st <> item.ed Then 63 | appstr.AppendLine(LongToIP(item.st) & "-" & LongToIP(item.ed)) 64 | Else 65 | appstr.AppendLine(LongToIP(item.st)) 66 | End If 67 | Next 68 | IO.File.WriteAllText(newfile, appstr.ToString) 69 | Invoke(Sub() 70 | TextBox2.Text = newfile 71 | RichTextBox2.Text = YuLan(newfile) 72 | Button1.Enabled = True 73 | End Sub) 74 | MsgBox("合并前:" & Past & vbCrLf & "合并后:" & IPRes.Count) 75 | End Sub 76 | 77 | Public Shared Function IpToLong(strIP As String) As Long 78 | Try 79 | Dim ip(3) As Long 80 | Dim s As String() = strIP.Split(".") 81 | ip(0) = Long.Parse(s(0)) 82 | ip(1) = Long.Parse(s(1)) 83 | ip(2) = Long.Parse(s(2)) 84 | ip(3) = Long.Parse(s(3)) 85 | Return (ip(0) << 24) + (ip(1) << 16) + (ip(2) << 8) + ip(3) 86 | Catch ex As Exception 87 | Return 0 88 | End Try 89 | End Function 90 | 91 | Public Shared Function LongToIP(longIP As Long) As String 92 | Dim sb As New StringBuilder 93 | sb.Append(longIP >> 24) 94 | sb.Append(".") 95 | sb.Append((longIP And &HFFFFFF) >> 16) 96 | sb.Append(".") 97 | sb.Append((longIP And &HFFFF) >> 8) 98 | sb.Append(".") 99 | sb.Append((longIP And &HFF)) 100 | Return sb.ToString() 101 | End Function 102 | 103 | Public Function Merge(ByVal intervals As List(Of Interval)) As List(Of Interval) 104 | Dim res As New List(Of Interval) 105 | If intervals.Count = 0 Then Return res 106 | intervals = intervals.OrderBy(Function(i) i.st).ToList 107 | res.Add(intervals(0)) 108 | For i As Long = 1 To intervals.Count - 1 109 | If intervals(i).st <= res(res.Count - 1).ed Then 110 | res(res.Count - 1).ed = Math.Max(intervals(i).ed, res(res.Count - 1).ed) 111 | Else 112 | res.Add(intervals(i)) 113 | End If 114 | Next 115 | Return res 116 | End Function 117 | 118 | Private Sub TextBox1_DragDrop(sender As Object, e As DragEventArgs) Handles TextBox1.DragDrop 119 | TextBox1.Text = e.Data.GetData(DataFormats.FileDrop).getvalue(0).ToString 120 | RichTextBox1.Text = YuLan(TextBox1.Text) 121 | End Sub 122 | 123 | Private Function YuLan(ByVal file As String) As String 124 | Dim appstr As New System.Text.StringBuilder 125 | If IO.File.Exists(file) Then 126 | Dim x As Integer 127 | For Each s In IO.File.ReadLines(file) 128 | If s.Length = 0 Then Continue For 129 | x += 1 130 | If x > 100 Then Exit For 131 | appstr.AppendLine(s) 132 | Next 133 | End If 134 | Return appstr.ToString 135 | End Function 136 | 137 | Private Sub TextBox1_DragEnter(sender As Object, e As DragEventArgs) Handles TextBox1.DragEnter 138 | If e.Data.GetDataPresent(DataFormats.FileDrop, False) = True Then 139 | e.Effect = DragDropEffects.Copy '指针变成+号,表示正在拖入数据 140 | End If 141 | End Sub 142 | 143 | End Class 144 | 145 | Public Class Interval 146 | Public st As Long 147 | Public ed As Long 148 | 149 | Public Sub New() 150 | st = 0 151 | ed = 0 152 | End Sub 153 | 154 | Public Sub New(ByVal s As Long, ByVal e As Long) 155 | st = s 156 | ed = e 157 | End Sub 158 | End Class 159 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/IP区间合并工具.vbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {072F3A3D-ABCD-4182-9C6E-C725E4E1B79F} 8 | WinExe 9 | IP区间合并工具.My.MyApplication 10 | IP区间合并工具 11 | IP区间合并工具 12 | 512 13 | WindowsForms 14 | v4.0 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | true 21 | true 22 | bin\Debug\ 23 | 24 | 25 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 26 | 27 | 28 | AnyCPU 29 | None 30 | false 31 | true 32 | true 33 | bin\Release\ 34 | 35 | 36 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 37 | true 38 | false 39 | 40 | 41 | On 42 | 43 | 44 | Binary 45 | 46 | 47 | Off 48 | 49 | 50 | On 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | Form 70 | 71 | 72 | IP区间合并工具.vb 73 | Form 74 | 75 | 76 | 77 | True 78 | Application.myapp 79 | 80 | 81 | True 82 | True 83 | Resources.resx 84 | 85 | 86 | True 87 | Settings.settings 88 | True 89 | 90 | 91 | 92 | 93 | IP区间合并工具.vb 94 | 95 | 96 | VbMyResourcesResXFileCodeGenerator 97 | Resources.Designer.vb 98 | My.Resources 99 | Designer 100 | 101 | 102 | 103 | 104 | MyApplicationCodeGenerator 105 | Application.Designer.vb 106 | 107 | 108 | SettingsSingleFileGenerator 109 | My 110 | Settings.Designer.vb 111 | 112 | 113 | 114 | 121 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/IP区间合并工具.vbproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes, 18 | ' or if you encounter build errors in this file, go to the Project Designer 19 | ' (go to Project Properties or double-click the My Project node in 20 | ' Solution Explorer), and make changes on the Application tab. 21 | ' 22 | Partial Friend Class MyApplication 23 | 24 | _ 25 | Public Sub New() 26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) 27 | Me.IsSingleInstance = false 28 | Me.EnableVisualStyles = true 29 | Me.SaveMySettingsOnExit = true 30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses 31 | End Sub 32 | 33 | _ 34 | Protected Overrides Sub OnCreateMainForm() 35 | Me.MainForm = Global.IP区间合并工具.IP区间合并工具 36 | End Sub 37 | End Class 38 | End Namespace 39 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | true 4 | IP区间合并工具 5 | false 6 | 0 7 | true 8 | 0 9 | true 10 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' 有关程序集的常规信息通过下列特性集 6 | ' 控制。更改这些特性值可修改 7 | ' 与程序集关联的信息。 8 | 9 | ' 查看程序集特性的值 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | '如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 21 | 22 | 23 | ' 程序集的版本信息由下面四个值组成: 24 | ' 25 | ' 主版本 26 | ' 次版本 27 | ' 生成号 28 | ' 修订号 29 | ' 30 | ' 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 31 | ' 方法是按如下所示使用“*”: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/My Project/Resources.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My.Resources 16 | 17 | 'This class was auto-generated by the StronglyTypedResourceBuilder 18 | 'class via a tool like ResGen or Visual Studio. 19 | 'To add or remove a member, edit your .ResX file then rerun ResGen 20 | 'with the /str option, or rebuild your VS project. 21 | ''' 22 | ''' A strongly-typed resource class, for looking up localized strings, etc. 23 | ''' 24 | _ 28 | Friend Module Resources 29 | 30 | Private resourceMan As Global.System.Resources.ResourceManager 31 | 32 | Private resourceCulture As Global.System.Globalization.CultureInfo 33 | 34 | ''' 35 | ''' Returns the cached ResourceManager instance used by this class. 36 | ''' 37 | _ 38 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager 39 | Get 40 | If Object.ReferenceEquals(resourceMan, Nothing) Then 41 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("IP区间合并工具.Resources", GetType(Resources).Assembly) 42 | resourceMan = temp 43 | End If 44 | Return resourceMan 45 | End Get 46 | End Property 47 | 48 | ''' 49 | ''' Overrides the current thread's CurrentUICulture property for all 50 | ''' resource lookups using this strongly typed resource class. 51 | ''' 52 | _ 53 | Friend Property Culture() As Global.System.Globalization.CultureInfo 54 | Get 55 | Return resourceCulture 56 | End Get 57 | Set(ByVal value As Global.System.Globalization.CultureInfo) 58 | resourceCulture = value 59 | End Set 60 | End Property 61 | End Module 62 | End Namespace 63 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/My Project/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/My Project/Settings.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | _ 20 | Partial Friend NotInheritable Class MySettings 21 | Inherits Global.System.Configuration.ApplicationSettingsBase 22 | 23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) 24 | 25 | #Region "My.Settings Auto-Save Functionality" 26 | #If _MyType = "WindowsForms" Then 27 | Private Shared addedHandler As Boolean 28 | 29 | Private Shared addedHandlerLockObject As New Object 30 | 31 | _ 32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) 33 | If My.Application.SaveMySettingsOnExit Then 34 | My.Settings.Save() 35 | End If 36 | End Sub 37 | #End If 38 | #End Region 39 | 40 | Public Shared ReadOnly Property [Default]() As MySettings 41 | Get 42 | 43 | #If _MyType = "WindowsForms" Then 44 | If Not addedHandler Then 45 | SyncLock addedHandlerLockObject 46 | If Not addedHandler Then 47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings 48 | addedHandler = True 49 | End If 50 | End SyncLock 51 | End If 52 | #End If 53 | Return defaultInstance 54 | End Get 55 | End Property 56 | End Class 57 | End Namespace 58 | 59 | Namespace My 60 | 61 | _ 64 | Friend Module MySettingsProperty 65 | 66 | _ 67 | Friend ReadOnly Property Settings() As Global.IP区间合并工具.My.MySettings 68 | Get 69 | Return Global.IP区间合并工具.My.MySettings.Default 70 | End Get 71 | End Property 72 | End Module 73 | End Namespace 74 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/bin/Release/IP区间合并工具.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/bin/Release/IP区间合并工具.exe -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/img/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/img/demo.png -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.Form1.resources -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.Resources.resources -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.exe -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.pdb -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.vbproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\bin\Debug\IP区间合并工具.exe 2 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\bin\Debug\IP区间合并工具.pdb 3 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\bin\Debug\IP区间合并工具.xml 4 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Debug\IP区间合并工具.Form1.resources 5 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Debug\IP区间合并工具.Resources.resources 6 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Debug\IP区间合并工具.vbproj.GenerateResource.Cache 7 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Debug\IP区间合并工具.exe 8 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Debug\IP区间合并工具.xml 9 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Debug\IP区间合并工具.pdb 10 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\bin\Debug\IP区间合并工具.exe 11 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\bin\Debug\IP区间合并工具.pdb 12 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\obj\Debug\IP区间合并工具.Form1.resources 13 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\obj\Debug\IP区间合并工具.Resources.resources 14 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\obj\Debug\IP区间合并工具.vbproj.GenerateResource.Cache 15 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\obj\Debug\IP区间合并工具.exe 16 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\obj\Debug\IP区间合并工具.pdb 17 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.vbproj.GenerateResource.Cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.vbproj.GenerateResource.Cache -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/IP区间合并工具.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | IP区间合并工具 6 | 7 | 8 | 9 | 10 | 11 | Returns the cached ResourceManager instance used by this class. 12 | 13 | 14 | 15 | Overrides the current thread's CurrentUICulture property for all 16 | resource lookups using this strongly typed resource class. 17 | 18 | 19 | 20 | A strongly-typed resource class, for looking up localized strings, etc. 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Debug/TempPE/My Project.Resources.Designer.vb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Debug/TempPE/My Project.Resources.Designer.vb.dll -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Release/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Release/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Release/IP区间合并工具.IP区间合并工具.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Release/IP区间合并工具.IP区间合并工具.resources -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Release/IP区间合并工具.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Release/IP区间合并工具.Resources.resources -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Release/IP区间合并工具.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Release/IP区间合并工具.exe -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Release/IP区间合并工具.vbproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\bin\Release\IP区间合并工具.exe 2 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Release\IP区间合并工具.Form1.resources 3 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Release\IP区间合并工具.Resources.resources 4 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Release\IP区间合并工具.vbproj.GenerateResource.Cache 5 | C:\Users\root\AppData\Local\Temporary Projects\IP区间合并工具\obj\Release\IP区间合并工具.exe 6 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\bin\Release\IP区间合并工具.exe 7 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\obj\Release\IP区间合并工具.Resources.resources 8 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\obj\Release\IP区间合并工具.vbproj.GenerateResource.Cache 9 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\obj\Release\IP区间合并工具.exe 10 | C:\Users\root\Desktop\IP区间合并工具\IP区间合并工具\obj\Release\IP区间合并工具.IP区间合并工具.resources 11 | -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Release/IP区间合并工具.vbproj.GenerateResource.Cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Release/IP区间合并工具.vbproj.GenerateResource.Cache -------------------------------------------------------------------------------- /IP区间合并工具/IP区间合并工具/obj/Release/TempPE/My Project.Resources.Designer.vb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foryujian/ipintervalmerge/1fc0c1c66d9c29b267a7d1c9291af8b853a10b6a/IP区间合并工具/IP区间合并工具/obj/Release/TempPE/My Project.Resources.Designer.vb.dll -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ipintervalmerge 2 | IP区间批量合并工具,合并重叠交集的IP范围
3 | 4 | 依赖:.net framework 4.0
5 | 6 | 什么是IP区间合并
7 | 8 | 192.168.0.0/24
9 | 192.168.24.0/22
10 | 192.168.1.3-192.168.1.5
11 | 192.168.1.2-192.168.1.6
12 | 192.168.1.1
13 | 14 | 15 | IP合并区间就是把重叠的IP段进行扩充,比如以上结果经过合并处理后变成
16 | 17 | 192.168.0.0-192.168.0.255
18 | 192.168.1.1
19 | 192.168.1.2-192.168.1.6
20 | 192.168.24.0-192.168.27.255
21 | 22 | 更新记录:
23 | 2019/3/28 20:03
24 | 1、新增加了CIDR格式的支持
25 | 2、修改单个IP不再显示成IP段格式
26 | 27 | 更新记录:
28 | 2019/3/29 00:17
29 | 1、修复了CIDR格式的偷懒式编码方式,完全兼容标准CIDR格式
30 | 31 | ![/IP区间合并工具/IP区间合并工具/img/demo.png](/IP区间合并工具/IP区间合并工具/img/demo.png) 32 | --------------------------------------------------------------------------------