From a4014c0b7f3be62ddc509978fbfa455fb9517667 Mon Sep 17 00:00:00 2001 From: Timerix22 Date: Sat, 18 Mar 2023 06:23:09 +0600 Subject: [PATCH] ReplaceRestrictedChars --- DTLib/DTLib.csproj | 2 +- DTLib/Filesystem/IOPath.cs | 2 ++ DTLib/Filesystem/Path.cs | 15 ++++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/DTLib/DTLib.csproj b/DTLib/DTLib.csproj index 4f84074..d3a3feb 100644 --- a/DTLib/DTLib.csproj +++ b/DTLib/DTLib.csproj @@ -2,7 +2,7 @@ DTLib - 1.1.5 + 1.1.7 Timerix Library for all my C# projects GIT diff --git a/DTLib/Filesystem/IOPath.cs b/DTLib/Filesystem/IOPath.cs index eff25f9..d06c9ca 100644 --- a/DTLib/Filesystem/IOPath.cs +++ b/DTLib/Filesystem/IOPath.cs @@ -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()); } diff --git a/DTLib/Filesystem/Path.cs b/DTLib/Filesystem/Path.cs index 1c4dff6..e066c52 100644 --- a/DTLib/Filesystem/Path.cs +++ b/DTLib/Filesystem/Path.cs @@ -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; }