Add IsNotEmpty function

This commit is contained in:
2dust
2024-09-17 16:52:41 +08:00
parent 4c0a59a715
commit 61635db5b5
33 changed files with 140 additions and 135 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ namespace ServiceLib.Common
Uri uri = new(url);
//Authorization Header
var headers = new WebHeaderCollection();
if (!Utils.IsNullOrEmpty(uri.UserInfo))
if (Utils.IsNotEmpty(uri.UserInfo))
{
headers.Add(HttpRequestHeader.Authorization, "Basic " + Utils.Base64Encode(uri.UserInfo));
}
+2 -2
View File
@@ -82,7 +82,7 @@ namespace ServiceLib.Common
}
try
{
if (!Utils.IsNullOrEmpty(ignoredName) && entry.Name.Contains(ignoredName))
if (Utils.IsNotEmpty(ignoredName) && entry.Name.Contains(ignoredName))
{
continue;
}
@@ -157,7 +157,7 @@ namespace ServiceLib.Common
// Get the files in the source directory and copy to the destination directory
foreach (FileInfo file in dir.GetFiles())
{
if (!Utils.IsNullOrEmpty(ignoredName) && file.Name.Contains(ignoredName))
if (Utils.IsNotEmpty(ignoredName) && file.Name.Contains(ignoredName))
{
continue;
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace ServiceLib.Common
public async Task<string?> TryGetAsync(string url)
{
if (string.IsNullOrEmpty(url))
if (Utils.IsNullOrEmpty(url))
return null;
try
+5
View File
@@ -417,6 +417,11 @@ namespace ServiceLib.Common
return false;
}
public static bool IsNotEmpty(string? text)
{
return !string.IsNullOrEmpty(text);
}
/// <summary>
/// 验证IP地址是否合法
/// </summary>