SVN r1205

SVN-Revision: r1205
This commit is contained in:
cyf
2026-06-01 02:19:36 +00:00
parent 41a12f4938
commit b44599cc2c
3 changed files with 58 additions and 27 deletions
+18
View File
@@ -123,6 +123,24 @@ namespace Lskj.Util
}
/// <summary>
/// 签章打印临时文件
/// </summary>
public static string SignatureFilePath
{
get
{
string path = AbsolutelyPath + "TempFiles\\SignatureFile/";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
return path;
}
}
public static void ClearFilesInDirectory(string targetDir)
{
// 校验目录是否存在
+31 -3
View File
@@ -193,8 +193,26 @@ namespace Lskj.Util
/// <returns><c>true</c> if the specified default value is select; otherwise, <c>false</c>.</returns>
public static bool IsSelect(string defaultValue)
{
return defaultValue.ToLower().Trim().Trim(new char[] { '\r', '\t', '\n' }).StartsWith(_selectFlag);
//return defaultValue.ToLower().Trim().Trim(new char[] { '\r', '\t', '\n' }).StartsWith(_selectFlag);
//2026-4-17 之前判断不了开头有注释的情况
if (string.IsNullOrWhiteSpace(defaultValue))return false;
// 清理:开头所有空白 + 所有单行注释 + 所有多行注释
string cleaned = Regex.Replace(
defaultValue,
@"^\s*(/\*.*?\*/|\s|--.*?$)*",
"",
RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Multiline
);
return cleaned.StartsWith("select", StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// <para>说明:替换userid、username、groupid</para>
/// <para>创建人:龚宇超</para>
@@ -226,6 +244,16 @@ namespace Lskj.Util
/// <returns>System.String.</returns>
public static string ReplaceUserInfo(string defaultValue, string userId, string userName, string groupId, string password)
{
if (string.IsNullOrEmpty(defaultValue))
{
return defaultValue;
}
if (defaultValue.IndexOf('{') < 0)
{
return defaultValue;
}
return defaultValue = defaultValue.Replace(_loginid_key, userId, true)
.Replace(_loginname_key, userName, true)
.Replace(_groupid_key, groupId, true)
@@ -241,8 +269,8 @@ namespace Lskj.Util
.Replace(_loginaccount_key, ERPInfo.Instance.LoginAccount + "", true)
.Replace(_accountBook, ERPInfo.Instance.AccountBook + "", true)
.Replace(_loginUserLinkPhone_key, ERPInfo.Instance.UserLinkPhone + "", true)
.Replace(_mrpTag_key, ERPInfo.Instance.MrpTag + "", true)
.Replace(_macAddressy, ERPInfo.Instance.MacAddress + "", true);
.Replace(_mrpTag_key, ERPInfo.Instance.MrpTag + "", true);
//.Replace(_macAddressy, ERPInfo.Instance.MacAddress + "", true);
}
/// <summary>
+9 -24
View File
@@ -91,30 +91,15 @@ namespace Lskj.Util
/// <returns>System.String.</returns>
public static string Replace(this string str, string key, string value, bool ignoreCase)
{
if (string.IsNullOrEmpty(str)) return str;
//if (string.IsNullOrEmpty(str)) return str;
return Regex.IsMatch(str, key, RegexOptions.IgnoreCase) ?
System.Text.RegularExpressions.Regex.Replace(str, key, value, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None)
: str;
}
/// <summary>
/// <para>说明:</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="text">The text.</param>
public static bool IsChinese(this string text)
{
for (int i = 0; i < text.Length; i++)
//return Regex.IsMatch(str, key, RegexOptions.IgnoreCase) ?
// System.Text.RegularExpressions.Regex.Replace(str, key, value, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None)
// : str;
if (string.IsNullOrEmpty(str) || string.IsNullOrEmpty(key))
{
if ((int)text[i] > 127)
return true;
return str;
}
return false;
}
}
}
var comparison = ignoreCase
? StringComparison.Ordinal