ReplaceRestrictedChars

This commit is contained in:
Timerix22 2023-03-18 06:23:09 +06:00
parent 1388959ad2
commit a4014c0b7f
3 changed files with 11 additions and 8 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<!--package info-->
<PackageId>DTLib</PackageId>
<Version>1.1.5</Version>
<Version>1.1.7</Version>
<Authors>Timerix</Authors>
<Description>Library for all my C# projects</Description>
<RepositoryType>GIT</RepositoryType>

View File

@ -20,6 +20,8 @@ public readonly struct IOPath
public IOPath(string path, bool separatorsFixed=false)
{
if (path.IsNullOrEmpty())
throw new Exception("path is null or empty");
Str = separatorsFixed ? path : FixSeparators(path.ToCharArray());
}

View File

@ -32,13 +32,14 @@ public static class Path
case ':': case ';':
r[i] = '-';
break;
case '\n': case '\r': case ' ':
case '#': case '%': case '&':
case '{': case '}': case '<':
case '>': case '*': case '?':
case '$': case '!': case '\'':
case '"': case '@': case '+':
case '`': case '|': case '=':
case '\n': case '\r': case '\'':
case '"': case '`':
break;
case ' ': case '&': case '{': case '}':
case '<': case '>': case '*': case '?':
case '$': case '%': case '@': case '|':
// case '!':
// case '#':
r[i] = '_';
break;
}