2.14.0.0
This commit is contained in:
@@ -6,12 +6,12 @@ Public Module ModBase
|
||||
#Region "声明"
|
||||
|
||||
'下列版本信息由更新器自动修改
|
||||
Public Const VersionBaseName As String = "2.13.1.1" '显示用版本名
|
||||
Public Const VersionBaseName As String = "2.14.0.0" '显示用版本名
|
||||
Public Const CommitHash As String = "" 'Commit Hash,由 GitHub Workflow 自动替换
|
||||
#If RELEASE Then
|
||||
Public Const VersionCode As Integer = 408 '正式版
|
||||
Public Const VersionCode As Integer = 411 '正式版
|
||||
#Else
|
||||
Public Const VersionCode As Integer = 410 '快照版
|
||||
Public Const VersionCode As Integer = 412 '快照版
|
||||
#End If
|
||||
|
||||
'版本信息
|
||||
@@ -47,7 +47,7 @@ Public Module ModBase
|
||||
''' <summary>
|
||||
''' 程序的缓存文件夹路径,以 \ 结尾。
|
||||
''' </summary>
|
||||
Public PathTemp As String = If(Settings.Get(Of String)("SystemSystemCache") = "", Path.GetTempPath() & "PCL\", Settings.Get(Of String)("SystemSystemCache")).ToString.Replace("/", "\").TrimEnd("\") & "\"
|
||||
Public PathTemp As String = PathUtils.AddSlashSuffix(If(Settings.Get(Of String)("SystemSystemCache") = "", Path.GetTempPath() & "PCL\", Settings.Get(Of String)("SystemSystemCache")).Replace("/", "\"))
|
||||
''' <summary>
|
||||
''' 当前程序的语言。
|
||||
''' </summary>
|
||||
@@ -75,7 +75,7 @@ Public Module ModBase
|
||||
''' <summary>
|
||||
''' 系统盘盘符,以 \ 结尾。例如 “C:\”。
|
||||
''' </summary>
|
||||
Public OsDrive As String = Environment.GetLogicalDrives().Where(Function(p) Directory.Exists(p)).First.Upper.First & ":\" '#3799
|
||||
Public OsDrive As String = Environment.GetLogicalDrives().First(Function(p) Directory.Exists(p)) '#3799
|
||||
|
||||
Public ReadOnly Property ModeDebug As Boolean
|
||||
Get
|
||||
@@ -576,7 +576,7 @@ Public Module ModBase
|
||||
Try
|
||||
If String.IsNullOrEmpty(Folder) Then Return False
|
||||
Folder = PathUtils.AddSlashSuffix(Folder)
|
||||
If Folder.EndsWithF(":\System Volume Information\") OrElse Folder.EndsWithF(":\$RECYCLE.BIN\") Then Return False
|
||||
If Folder.EndsWithF(":\System Volume Information\", True) OrElse Folder.EndsWithF(":\$RECYCLE.BIN\", True) Then Return False
|
||||
If Not DirectoryUtils.Exists(Folder) Then Return False
|
||||
Dim TestFilePath As String = $"{Folder}CheckPermission{GetUuid()}.txt"
|
||||
FileUtils.Write(TestFilePath, "临时文件,用于检测该文件夹的权限是否正常。")
|
||||
@@ -593,7 +593,7 @@ Public Module ModBase
|
||||
Public Sub CheckPermissionWithException(Folder As String)
|
||||
If String.IsNullOrWhiteSpace(Folder) Then Throw New ArgumentNullException("文件夹名不能为空!")
|
||||
Folder = PathUtils.AddSlashSuffix(Folder)
|
||||
If Folder.EndsWithF(":\System Volume Information\") OrElse Folder.EndsWithF(":\$RECYCLE.BIN\") Then Throw New UnauthorizedAccessException("没有对系统文件夹的权限!")
|
||||
If Folder.EndsWithF(":\System Volume Information\", True) OrElse Folder.EndsWithF(":\$RECYCLE.BIN\", True) Then Throw New UnauthorizedAccessException("没有对系统文件夹的权限!")
|
||||
If Not DirectoryUtils.Exists(Folder) Then Throw New DirectoryNotFoundException("文件夹不存在!")
|
||||
Dim TestFilePath As String = $"{Folder}CheckPermission{GetUuid()}.txt"
|
||||
FileUtils.Write(TestFilePath, "临时文件,用于检测该文件夹的权限是否正常。")
|
||||
@@ -788,7 +788,7 @@ Public Module ModBase
|
||||
''' <summary>
|
||||
''' 可用于临时存放文件的,不含任何特殊字符的文件夹路径,以“\”结尾。
|
||||
''' </summary>
|
||||
Public PathPure As Lazy(Of String) = New Lazy(Of String)(
|
||||
Public PathPure As New Lazy(Of String)(
|
||||
Function()
|
||||
If Paths.Base.IsAsciiOnly() Then
|
||||
Return Paths.Base & "PCL\"
|
||||
@@ -845,6 +845,12 @@ Public Module ModBase
|
||||
Return (Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000
|
||||
End Function
|
||||
''' <summary>
|
||||
''' 获取十进制 Unix 时间戳。
|
||||
''' </summary>
|
||||
Public Function ToUnixTimestampUtc(Time As Date) As Long
|
||||
Return (Time.ToUniversalTime().Ticks - 621355968000000000) / 10000000
|
||||
End Function
|
||||
''' <summary>
|
||||
''' 时间戳转化为日期。
|
||||
''' </summary>
|
||||
Public Function GetDate(timeStamp As Integer) As Date
|
||||
@@ -1021,20 +1027,22 @@ Public Module ModBase
|
||||
''' <summary>
|
||||
''' 设置剪贴板。将在另一线程运行,且不会抛出异常。
|
||||
''' </summary>
|
||||
Public Sub ClipboardSet(Text As String, Optional ShowSuccessHint As Boolean = True, Optional SuccessHint As String = "")
|
||||
Public Sub ClipboardSet(Text As String, Optional ShowSuccessHint As Boolean = True)
|
||||
RunInThread(
|
||||
Sub()
|
||||
RunInUi(
|
||||
Sub()
|
||||
Try
|
||||
My.Computer.Clipboard.Clear()
|
||||
If Not String.IsNullOrEmpty(Text) Then My.Computer.Clipboard.SetText(Text)
|
||||
If ShowSuccessHint Then Hint(If(String.IsNullOrEmpty(SuccessHint), "已成功复制!", SuccessHint), HintType.Green)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, behavior:=LogBehavior.None)
|
||||
Hint("复制失败,可能由于剪贴板被其他程序占用!", HintType.Red)
|
||||
End Try
|
||||
End Sub)
|
||||
Try
|
||||
Retrier.Attempt(delay:=Function(Attempt) TimeSpan.FromMilliseconds(200), maxAttempts:=4, isRetryAllowed:=Function(ex) True, action:=
|
||||
Sub()
|
||||
RunInUiWait(
|
||||
Sub()
|
||||
My.Computer.Clipboard.Clear()
|
||||
If Not String.IsNullOrEmpty(Text) Then My.Computer.Clipboard.SetText(Text)
|
||||
End Sub)
|
||||
End Sub)
|
||||
If ShowSuccessHint Then Hint("已成功复制!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "可能由于剪贴板被其他程序占用,文本复制失败", LogBehavior.Toast)
|
||||
End Try
|
||||
End Sub)
|
||||
End Sub
|
||||
''' <summary>
|
||||
|
||||
Reference in New Issue
Block a user