This commit is contained in:
2dust
2024-09-18 19:54:38 +08:00
parent 073eaa9a26
commit 243dbab06a
6 changed files with 24 additions and 16 deletions
+10 -3
View File
@@ -15,11 +15,19 @@
this.version = $"{major}.{minor}.{patch}";
}
public SemanticVersion(string version)
public SemanticVersion(string? version)
{
this.version = version.RemovePrefix('v');
try
{
if (version.IsNullOrEmpty())
{
this.major = 0;
this.minor = 0;
this.patch = 0;
return;
}
this.version = version.RemovePrefix('v');
string[] parts = this.version.Split('.');
if (parts.Length == 2)
{
@@ -43,7 +51,6 @@
this.major = 0;
this.minor = 0;
this.patch = 0;
//this.version = "0.0.0";
}
}
+4 -3
View File
@@ -158,10 +158,11 @@ namespace ServiceLib.Common
/// </summary>
/// <param name="plainText"></param>
/// <returns></returns>
public static string Base64Decode(string plainText)
public static string Base64Decode(string? plainText)
{
try
{
if (plainText.IsNullOrEmpty()) return "";
plainText = plainText.Trim()
.Replace(Environment.NewLine, "")
.Replace("\n", "")
@@ -365,7 +366,7 @@ namespace ServiceLib.Common
}
}
public static bool IsBase64String(string plainText)
public static bool IsBase64String(string? plainText)
{
if (plainText.IsNullOrEmpty()) return false;
var buffer = new Span<byte>(new byte[plainText.Length]);
@@ -812,7 +813,7 @@ namespace ServiceLib.Common
}
if (coreType != null)
{
_tempPath = Path.Combine(_tempPath, coreType.ToString()!);
_tempPath = Path.Combine(_tempPath, coreType.ToString());
if (!Directory.Exists(_tempPath))
{
Directory.CreateDirectory(_tempPath);