Skip to content

Commit 56986b3

Browse files
author
zzzprojects
committed
Move sign directory
Move sign directory
1 parent 48fd44e commit 56986b3

File tree

5 files changed

+44
-45
lines changed

5 files changed

+44
-45
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ Z.Lab/
99
*.userprefs
1010
_ReSharper.*
1111
*.ReSharper.user
12-
*.resharper.user
13-
*.pfx
12+
*.resharper.user

src/FindAndReplace.App/ValidationUtils.cs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,49 +18,49 @@ public class ValidationResult
1818

1919
public static class ValidationUtils
2020
{
21-
public static ValidationResult IsDirValid(string dir, string itemName)
22-
{
23-
var result = new ValidationResult() {IsSuccess = true, FieldName = itemName};
24-
25-
if (dir.Trim() == "")
26-
{
27-
result.IsSuccess = false;
28-
result.ErrorMessage = "Dir is required";
29-
return result;
30-
}
31-
32-
Regex dirRegex = new Regex(@"^(([a-zA-Z]:)|(\\{2}[^\/\\:*?<>|]+)) (\\([^\/\\:*?<>|]*))*(\\)?$");
33-
Regex dirRegexNotRooted = new Regex(@"(\\([^\/\\:*?<>|]*))*(\\)?$");
34-
if (Path.IsPathRooted(dir))
35-
{
36-
if (!dirRegex.IsMatch(dir))
37-
{
38-
result.IsSuccess = false;
39-
result.ErrorMessage = "Dir is invalid";
40-
return result;
41-
}
42-
}
43-
else
44-
{
45-
if (!dirRegexNotRooted.IsMatch(dir))
46-
{
47-
result.IsSuccess = false;
48-
result.ErrorMessage = "Dir is invalid";
49-
return result;
50-
}
51-
}
52-
53-
if (!Directory.Exists(dir))
54-
{
55-
result.IsSuccess = false;
56-
result.ErrorMessage = "Dir does not exist";
57-
return result;
58-
}
59-
60-
return result;
61-
}
62-
63-
public static ValidationResult IsNotEmpty(string text, string itemName)
21+
public static ValidationResult IsDirValid(string dir, string itemName)
22+
{
23+
var result = new ValidationResult() {IsSuccess = true, FieldName = itemName};
24+
25+
if (dir.Trim() == "")
26+
{
27+
result.IsSuccess = false;
28+
result.ErrorMessage = "Dir is required";
29+
return result;
30+
}
31+
32+
Regex dirRegex = new Regex(@"^(([a-zA-Z]:)|(\\{2}[^\/\\:*?<>|]+))(\\([^\/\\:*?<>|]*))*(\\)?$");
33+
Regex dirRegexNotRooted = new Regex(@"(\\([^\/\\:*?<>|]*))*(\\)?$");
34+
if (Path.IsPathRooted(dir))
35+
{
36+
if (!dirRegex.IsMatch(dir))
37+
{
38+
result.IsSuccess = false;
39+
result.ErrorMessage = "Dir is invalid";
40+
return result;
41+
}
42+
}
43+
else
44+
{
45+
if (!dirRegexNotRooted.IsMatch(dir))
46+
{
47+
result.IsSuccess = false;
48+
result.ErrorMessage = "Dir is invalid";
49+
return result;
50+
}
51+
}
52+
53+
if (!Directory.Exists(dir))
54+
{
55+
result.IsSuccess = false;
56+
result.ErrorMessage = "Dir does not exist";
57+
return result;
58+
}
59+
60+
return result;
61+
}
62+
63+
public static ValidationResult IsNotEmpty(string text, string itemName)
6464
{
6565
var result = new ValidationResult() {IsSuccess = true, FieldName = itemName};
6666

File renamed without changes.

0 commit comments

Comments
 (0)