diff --git a/LTFSCopyGUI/ChangerTool.vb b/LTFSCopyGUI/ChangerTool.vb index 13dc29e..22d37c1 100644 --- a/LTFSCopyGUI/ChangerTool.vb +++ b/LTFSCopyGUI/ChangerTool.vb @@ -130,7 +130,7 @@ Public Class ChangerTool If EmptyElement Is Nothing Then Exit Sub If ComboBox1.SelectedIndex > FullElement.Count - 1 Then Exit Sub If ComboBox2.SelectedIndex > EmptyElement.Count - 1 Then Exit Sub - If MessageBox.Show(New Form With {.TopMost = True}, $"{ComboBox1.SelectedItem} -> {ComboBox2.SelectedItem}", "", MessageBoxButtons.OKCancel) Then + If MessageBox.Show(New Form With {.TopMost = True}, $"{ComboBox1.SelectedItem} -> {ComboBox2.SelectedItem}", "", MessageBoxButtons.OKCancel) = DialogResult.OK Then Dim drv As String = $"\\.\CHANGER{CurrentChanger.DevIndex}" Dim src As UInt32 = FullElement(ComboBox1.SelectedIndex).ElementAddress Dim dest As UInt32 = EmptyElement(ComboBox2.SelectedIndex).ElementAddress diff --git a/LTFSCopyGUI/LTFSConfigurator.vb b/LTFSCopyGUI/LTFSConfigurator.vb index 831e372..f29c8c0 100644 --- a/LTFSCopyGUI/LTFSConfigurator.vb +++ b/LTFSCopyGUI/LTFSConfigurator.vb @@ -660,22 +660,24 @@ Public Class LTFSConfigurator Private Sub ButtonDebugReadInfo_Click(sender As Object, e As EventArgs) Handles ButtonDebugReadInfo.Click Me.Enabled = False Dim CMInfo As TapeUtils.CMParser = Nothing + TextBox8.Text = "" Try CMInfo = New TapeUtils.CMParser(TapeDrive) - Catch ex As Exception - TextBox8.AppendText("CM Data Parsing Failed." & vbCrLf) + TextBox8.AppendText("CM Data Parsing Failed." & vbCrLf & ex.ToString & vbCrLf) End Try - TextBox8.Text = "" - Try TextBox8.AppendText(CMInfo.GetReport()) + Catch ex As Exception + TextBox8.AppendText("Report generation failed.".PadRight(74) & vbCrLf & ex.ToString & vbCrLf) + End Try + Try If CheckBox4.Checked AndAlso CMInfo IsNot Nothing Then TextBox8.AppendText(CMInfo.GetSerializedText()) TextBox8.AppendText(vbCrLf) End If Catch ex As Exception - TextBox8.AppendText("| CM data parsing failed.".PadRight(74) & "|" & vbCrLf) + TextBox8.AppendText("CM Data Parsing failed.".PadRight(74) & vbCrLf & ex.ToString & vbCrLf) End Try TextBox8.Select(0, 0) TextBox8.ScrollToCaret() diff --git a/LTFSCopyGUI/LTFSWriter.resx b/LTFSCopyGUI/LTFSWriter.resx index 29f10d5..d60982b 100644 --- a/LTFSCopyGUI/LTFSWriter.resx +++ b/LTFSCopyGUI/LTFSWriter.resx @@ -227,7 +227,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAG - CwAAAk1TRnQBSQFMAgEBBAEAAewBCgHsAQoBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CwAAAk1TRnQBSQFMAgEBBAEAAfQBCgH0AQoBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -452,7 +452,7 @@ 696, 18 - 172, 22 + 180, 22 提取 @@ -476,52 +476,52 @@ 仅验证 - 172, 22 + 180, 22 校验 - 172, 22 + 180, 22 移动到索引区 - 172, 22 + 180, 22 定位到起始块 - 169, 6 + 177, 6 - 172, 22 + 180, 22 剪切文件 - 172, 22 + 180, 22 粘贴选中 - 172, 22 + 180, 22 重命名文件 - 172, 22 + 180, 22 重命名目录 - 169, 6 + 177, 6 @@ -554,25 +554,25 @@ - 172, 22 + 180, 22 导入文件 - 172, 22 + 180, 22 添加文件 - 172, 22 + 180, 22 添加目录 - 172, 22 + 180, 22 新建目录 @@ -590,43 +590,43 @@ 跳过符号链接 - 172, 22 + 180, 22 选项 - 169, 6 + 177, 6 - 172, 22 + 180, 22 删除文件 - 172, 22 + 180, 22 删除目录 - 169, 6 + 177, 6 - 172, 22 + 180, 22 生成标签 - 172, 22 + 180, 22 设置标签 - 172, 22 + 180, 22 文件详情 @@ -656,13 +656,13 @@ XAttr - 172, 22 + 180, 22 复制信息到剪贴板 - 173, 446 + 181, 468 ContextMenuStrip1 @@ -914,7 +914,7 @@ 备份当前索引 - 124, 22 + 180, 22 索引操作 @@ -958,13 +958,13 @@ 更新全部索引(安全弹出) - 124, 22 + 180, 22 数据操作 - 121, 6 + 177, 6 False @@ -1126,13 +1126,13 @@ 显示文件数 - 124, 22 + 180, 22 自动化 - 121, 6 + 177, 6 196, 22 @@ -1153,7 +1153,7 @@ 查找指定位置前的索引 - 124, 22 + 180, 22 回退 diff --git a/LTFSCopyGUI/LTFSWriter.vb b/LTFSCopyGUI/LTFSWriter.vb index cee50d8..cb4b759 100644 --- a/LTFSCopyGUI/LTFSWriter.vb +++ b/LTFSCopyGUI/LTFSWriter.vb @@ -3855,7 +3855,7 @@ Public Class LTFSWriter Private Sub 生成标签ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 生成标签ToolStripMenuItem.Click If My.Settings.LTFSWriter_FileLabel = "" Then 设置标签ToolStripMenuItem_Click(sender, e) - Exit Sub + If My.Settings.LTFSWriter_FileLabel = "" Then Exit Sub End If If ListView1.Tag IsNot Nothing Then Dim d As ltfsindex.directory = ListView1.Tag @@ -3874,7 +3874,14 @@ Public Class LTFSWriter Dim emptyfile As String = IO.Path.Combine(Application.StartupPath, "empty.file") IO.File.WriteAllBytes(emptyfile, {}) Dim fnew As New FileRecord(emptyfile, d) - fnew.File.name = $"{dir.name}{fl}" + With fnew.File + .name = $"{dir.name}{fl}" + .backuptime = Now.ToUniversalTime.ToString("yyyy-MM-ddTHH:mm:ss.fffffff00Z") + .creationtime = .backuptime + .modifytime = .backuptime + .accesstime = .backuptime + .changetime = .modifytime + End With While True Threading.Thread.Sleep(0) SyncLock UFReadCount diff --git a/LTFSCopyGUI/TapeUtils.vb b/LTFSCopyGUI/TapeUtils.vb index 452efff..11e13db 100644 --- a/LTFSCopyGUI/TapeUtils.vb +++ b/LTFSCopyGUI/TapeUtils.vb @@ -2451,12 +2451,18 @@ End SyncLock 'Erase ProgressReport("Initializing tape..") - If TapeUtils.SendSCSICommand(handle, {4, 0, 0, 0, 0, 0}, senseReport:=senseReportFunc) Then - ProgressReport("Initialization OK" & vbCrLf) + Dim cmdata As New CMParser(handle) + If cmdata.CartridgeMfgData.IsLTO9Plus Then + ProgressReport("LTO9 detected, skip initialization" & vbCrLf) Else - OnError("Initialization Fail" & vbCrLf) - Return False + If TapeUtils.SendSCSICommand(handle, {4, 0, 0, 0, 0, 0}, senseReport:=senseReportFunc) Then + ProgressReport("Initialization OK" & vbCrLf) + Else + OnError("Initialization Fail" & vbCrLf) + Return False + End If End If + If ExtraPartitionCount > 0 Then 'Mode Select:1st Partition to Minimum ProgressReport("MODE SELECT - Partition mode page..") @@ -3451,6 +3457,18 @@ End SyncLock Return fmt.Contains("LTO-7") OrElse fmt.Contains("LTO-8") OrElse fmt.Contains("LTO-9") End Get End Property + Public ReadOnly Property IsLTO8Plus As Boolean + Get + Dim fmt As String = Format + Return fmt.Contains("LTO-8") OrElse fmt.Contains("LTO-9") + End Get + End Property + Public ReadOnly Property IsLTO9Plus As Boolean + Get + Dim fmt As String = Format + Return fmt.Contains("LTO-9") + End Get + End Property Public ReadOnly Property CartridgeTypeAbbr As String Get If ((CartridgeType >> 15) And 1) = 1 Then Return "CU" @@ -4741,7 +4759,7 @@ End SyncLock ' "MAM002" has 1.5 bytes. Using 1.5 bytes For both cases, As the attribute length Is always small compared To what ' can be represented by 1.5 bytes (QXCR1001109840). a_AttributeLength = g_GetWord(a_Buffer, a_Index + 2) And &HFFF - + If a_AttributeID = &HFFF OrElse a_AttributeLength = 0 Then Exit While ' barcode If a_AttributeID = &H806 Then a_Barcode = getstr(a_Buffer, a_Index + 4, a_AttributeLength).TrimEnd() @@ -4977,6 +4995,16 @@ End SyncLock Public Sub New(TapeDrive As String, Optional ByVal BufferID As Byte = &H10) a_CMBuffer = ReadBuffer(TapeDrive, BufferID) If a_CMBuffer.Length = 0 Then a_CMBuffer = ReadBuffer(TapeDrive, &H5) + If a_CMBuffer.Length <> 0 Then + Try + RunParse() + Catch + End Try + End If + End Sub + Public Sub New(handle As IntPtr, Optional ByVal BufferID As Byte = &H10) + a_CMBuffer = ReadBuffer(handle, BufferID) + If a_CMBuffer.Length = 0 Then a_CMBuffer = ReadBuffer(handle, &H5) RunParse() End Sub Public Shared Function FromTapeDrive(TapeDrive As String) As CMParser @@ -5223,7 +5251,7 @@ End SyncLock Output.Append("+=========================================================================+") Output.Append(vbCrLf) Catch ex As Exception - Output.Append("| CM data parsing failed.".PadRight(74) & "|" & vbCrLf) + Output.Append("| CM data parsing failed.".PadRight(74) & "|" & vbCrLf & ex.ToString & vbCrLf) End Try Return Output.ToString() End Function