feat: check for and remove diacritics

This commit is contained in:
citizen-VM 2020-10-19 13:51:13 +02:00
parent 3410ebe3de
commit 048c46567f
Signed by: wanderer
GPG Key ID: 6391444A736EEE7E
3 changed files with 17 additions and 2 deletions

View File

@ -33,6 +33,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MMLib.Core, Version=1.0.5305.36249, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\MMLib.Extensions.1.0.10.13\lib\MMLib.Core.dll</HintPath>
</Reference>
<Reference Include="MMLib.Extensions, Version=1.0.2.6, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\MMLib.Extensions.1.0.10.13\lib\MMLib.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -66,6 +72,7 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@ -36,6 +36,7 @@ namespace KRY_0x01_ng
string introduce_chaos(string str)
{
string nustr = Regex.Replace(str, " ", "SPACEBRO");
nustr = MMLib.Extensions.StringExtensions.RemoveDiacritics(nustr);
nustr = Regex.Replace(nustr, "W", "V");
nustr = Regex.Replace(nustr, ",", "COMMABRO");
return nustr.Replace(".", "DOTBRO");
@ -88,8 +89,9 @@ namespace KRY_0x01_ng
MessageBox.Show("Empty key.", "Warning");
return false;
}
string str_to_check = String.Join("", tb_k.Text.ToUpper().Distinct());
string str_to_check = MMLib.Extensions.StringExtensions.RemoveDiacritics(tb_k.Text.ToUpper());
str_to_check = String.Join("", str_to_check.Distinct());
if (str_to_check.Length < 9)
{
/* because why not, 8 is still lame */
@ -165,6 +167,7 @@ namespace KRY_0x01_ng
return;
}
string msg = introduce_chaos(tb_m.Text.ToUpper());
msg = MMLib.Extensions.StringExtensions.RemoveDiacritics(msg);
Match match = Regex.Match(msg, @"\d|\s+");
if (match.Success)
{
@ -183,6 +186,7 @@ namespace KRY_0x01_ng
return false;
}
string msg = tb_m.Text.ToUpper();
msg = MMLib.Extensions.StringExtensions.RemoveDiacritics(msg);
Match match = Regex.Match(msg, @"\d|\s+|W");
if (match.Success)
{

4
packages.config Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MMLib.Extensions" version="1.0.10.13" targetFramework="net48" />
</packages>