Added ability to enter more than one address (comma separated) as well as prevent adding a local IP4 (192.168...)
This commit is contained in:
		
							parent
							
								
									f90ad8ff41
								
							
						
					
					
						commit
						570c3243b5
					
				
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -76,7 +76,7 @@
 | 
			
		|||
              "RelativeDocumentMoniker": "Program.cs",
 | 
			
		||||
              "ToolTip": "C:\\Repos\\BlockIPAddr\\Program.cs",
 | 
			
		||||
              "RelativeToolTip": "Program.cs",
 | 
			
		||||
              "ViewState": "AgIAAB4AAAAAAAAAAAAAADsAAAAKAAAAAAAAAA==",
 | 
			
		||||
              "ViewState": "AgIAAFwAAAAAAAAAAAAAAHYAAAAIAAAAAAAAAA==",
 | 
			
		||||
              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
 | 
			
		||||
              "WhenOpened": "2025-06-27T16:11:33.579Z",
 | 
			
		||||
              "EditorCaption": ""
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,7 @@
 | 
			
		|||
              "RelativeDocumentMoniker": "Program.cs",
 | 
			
		||||
              "ToolTip": "C:\\Repos\\BlockIPAddr\\Program.cs",
 | 
			
		||||
              "RelativeToolTip": "Program.cs",
 | 
			
		||||
              "ViewState": "AgIAACAAAAAAAAAAAAAAADsAAAAKAAAAAAAAAA==",
 | 
			
		||||
              "ViewState": "AgIAAFwAAAAAAAAAAAAAAHYAAAAIAAAAAAAAAA==",
 | 
			
		||||
              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
 | 
			
		||||
              "WhenOpened": "2025-06-27T16:11:33.579Z",
 | 
			
		||||
              "EditorCaption": ""
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										13
									
								
								Program.cs
								
								
								
								
							
							
						
						
									
										13
									
								
								Program.cs
								
								
								
								
							| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
using Microsoft.Data.SqlClient;
 | 
			
		||||
using BlockIPAddr.ClassObj;
 | 
			
		||||
using static BlockIPAddr.ClassObj.ANSI;
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
 | 
			
		||||
namespace BlockIPAddr;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +30,7 @@ internal class Program
 | 
			
		|||
          theEntries.Clear();
 | 
			
		||||
          theEntries.AddRange(arg.Split(','));
 | 
			
		||||
 | 
			
		||||
          foreach(var entry in theEntries)
 | 
			
		||||
          foreach (var entry in theEntries)
 | 
			
		||||
          {
 | 
			
		||||
            string ip4 = entry.Trim();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -101,10 +102,12 @@ internal class Program
 | 
			
		|||
          System.Net.IPAddress? ip4 = null;
 | 
			
		||||
          byte subMask = 0;
 | 
			
		||||
 | 
			
		||||
          if (System.Net.IPAddress.TryParse(part[0].Trim(), out ip4))
 | 
			
		||||
          if (Regex.IsMatch(part[0].Trim(), "^192.168.18[567]"))
 | 
			
		||||
            rv = false;
 | 
			
		||||
          else if (System.Net.IPAddress.TryParse(part[0].Trim(), out ip4))
 | 
			
		||||
            rv = true;
 | 
			
		||||
 | 
			
		||||
          if (rv && byte.TryParse(part[1].Trim(), out subMask))
 | 
			
		||||
          if (rv && byte.TryParse(part[1].Trim(), out subMask) && subMask <= 32)
 | 
			
		||||
            rv = true;
 | 
			
		||||
          else
 | 
			
		||||
            rv = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +116,9 @@ internal class Program
 | 
			
		|||
      else
 | 
			
		||||
      {
 | 
			
		||||
        System.Net.IPAddress? ip4 = null;
 | 
			
		||||
        if (System.Net.IPAddress.TryParse(ip.Trim(), out ip4))
 | 
			
		||||
        if (Regex.IsMatch(ip.Trim(), "^192.168.18[567]"))
 | 
			
		||||
          rv = false;
 | 
			
		||||
        else if(System.Net.IPAddress.TryParse(ip.Trim(), out ip4))
 | 
			
		||||
          rv = true;
 | 
			
		||||
        else
 | 
			
		||||
          rv = false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
 | 
			
		||||
<Project>
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <History>True|2025-08-04T07:56:39.0297504Z||;True|2025-06-30T04:59:56.4591901-04:00||;True|2025-06-30T04:39:28.6629030-04:00||;True|2025-06-30T04:04:51.2689872-04:00||;True|2025-06-30T04:02:09.8676131-04:00||;True|2025-06-27T12:28:32.0039427-04:00||;True|2025-06-27T12:27:16.4031564-04:00||;True|2025-06-27T12:23:51.7850485-04:00||;True|2025-06-27T12:13:48.5390689-04:00||;True|2025-06-27T12:12:59.9985493-04:00||;</History>
 | 
			
		||||
    <History>True|2025-08-04T08:14:15.2400225Z||;True|2025-08-04T03:56:39.0297504-04:00||;True|2025-06-30T04:59:56.4591901-04:00||;True|2025-06-30T04:39:28.6629030-04:00||;True|2025-06-30T04:04:51.2689872-04:00||;True|2025-06-30T04:02:09.8676131-04:00||;True|2025-06-27T12:28:32.0039427-04:00||;True|2025-06-27T12:27:16.4031564-04:00||;True|2025-06-27T12:23:51.7850485-04:00||;True|2025-06-27T12:13:48.5390689-04:00||;True|2025-06-27T12:12:59.9985493-04:00||;</History>
 | 
			
		||||
    <LastFailureDetails />
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
</Project>
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -14,7 +14,7 @@ using System.Reflection;
 | 
			
		|||
[assembly: System.Reflection.AssemblyCompanyAttribute("BlockIPAddr")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3a151ec7332e36d0958a5c09f93437c9a579cb48")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f90ad8ff41b147dbced82108f8df7d93f1ece3fe")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyProductAttribute("BlockIPAddr")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyTitleAttribute("BlockIPAddr")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
276cbed3fbbab18a3b26cb223ec73efcf37677ae68e069f3d99726445b29012a
 | 
			
		||||
36656971181fdbad6e97912fe5d4b72fd62419fa9de21427f1bd5b633b2b87b9
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -14,7 +14,7 @@ using System.Reflection;
 | 
			
		|||
[assembly: System.Reflection.AssemblyCompanyAttribute("BlockIPAddr")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3a151ec7332e36d0958a5c09f93437c9a579cb48")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f90ad8ff41b147dbced82108f8df7d93f1ece3fe")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyProductAttribute("BlockIPAddr")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyTitleAttribute("BlockIPAddr")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
401f24aa58a13e7b8158c38eb59a40f9d51e22db33d5f6481ad85ad0cbf73ff9
 | 
			
		||||
1acf25e339094d4b551fb2dd35326bf2166c840a5c2ac01841faadb560f9a69a
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -14,7 +14,7 @@ using System.Reflection;
 | 
			
		|||
[assembly: System.Reflection.AssemblyCompanyAttribute("BlockIPAddr")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3a151ec7332e36d0958a5c09f93437c9a579cb48")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f90ad8ff41b147dbced82108f8df7d93f1ece3fe")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyProductAttribute("BlockIPAddr")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyTitleAttribute("BlockIPAddr")]
 | 
			
		||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
401f24aa58a13e7b8158c38eb59a40f9d51e22db33d5f6481ad85ad0cbf73ff9
 | 
			
		||||
1acf25e339094d4b551fb2dd35326bf2166c840a5c2ac01841faadb560f9a69a
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue