Baby steps on code refactoring

This commit is contained in:
2023-01-07 23:56:22 -08:00
parent 1ee556eb4e
commit 1a3450f6f9
6 changed files with 142 additions and 4 deletions

View File

@@ -0,0 +1,26 @@
namespace AS1024.CommunityDocumentationPage.DIScopes
{
public static class ValidateBgpCommunity
{
/// <summary>
/// validates if this is a valid standard BGP Community
/// </summary>
/// <param name="Community">Community string represented as NNN:XXX</param>
/// <returns>true if it's a valid bgp community, false if it isn't</returns>
public static bool IsValidBgpCommunity(this string Community)
{
var splitStrings =
Community.Split(":", StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < 1; i++)
{
if (!int.TryParse(splitStrings[i], out int communityParsed)
&& communityParsed > 65536)
{
return false;
}
}
return true;
}
}
}