Edit Username, New Chat Dialog

This commit is contained in:
Patrick Hellebrand
2021-09-21 11:01:06 +02:00
parent 9533c9b666
commit d1a7963670
8 changed files with 173 additions and 23 deletions

31
PolyChat/Util/IP.cs Normal file
View File

@@ -0,0 +1,31 @@
using System;
using System.Text.RegularExpressions;
namespace PolyChat.Util
{
static class IP
{
private const string REGEX_IP = @"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$";
public static string GetIPfromCode(string code)
{
return code;
}
public static string GetCodeFromIP(string ip)
{
string[] arr = ip.Split('.');
for (int i = 0; i < arr.Length; i++)
{
arr[i] = int.Parse(arr[i]).ToString("X");
Console.WriteLine(arr[i]);
}
return ip;
}
public static bool ValidateIP(string ip)
{
return Regex.IsMatch(ip, REGEX_IP);
}
}
}