Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyangwx committed Jun 2, 2024
1 parent d2006ac commit fa9cc69
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 45 deletions.
2 changes: 1 addition & 1 deletion LTFSCopyGUI/ChangerTool.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions LTFSCopyGUI/LTFSConfigurator.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
62 changes: 31 additions & 31 deletions LTFSCopyGUI/LTFSWriter.resx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAG
CwAAAk1TRnQBSQFMAgEBBAEAAewBCgHsAQoBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CwAAAk1TRnQBSQFMAgEBBAEAAfQBCgH0AQoBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down Expand Up @@ -452,7 +452,7 @@
<value>696, 18</value>
</metadata>
<data name="提取ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="提取ToolStripMenuItem.Text" xml:space="preserve">
<value>提取</value>
Expand All @@ -476,52 +476,52 @@
<value>仅验证</value>
</data>
<data name="校验ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="校验ToolStripMenuItem.Text" xml:space="preserve">
<value>校验</value>
</data>
<data name="移动到索引区ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="移动到索引区ToolStripMenuItem.Text" xml:space="preserve">
<value>移动到索引区</value>
</data>
<data name="定位到起始块ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="定位到起始块ToolStripMenuItem.Text" xml:space="preserve">
<value>定位到起始块</value>
</data>
<data name="ToolStripSeparator2.Size" type="System.Drawing.Size, System.Drawing">
<value>169, 6</value>
<value>177, 6</value>
</data>
<data name="剪切文件ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="剪切文件ToolStripMenuItem.Text" xml:space="preserve">
<value>剪切文件</value>
</data>
<data name="粘贴选中ToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="粘贴选中ToolStripMenuItem1.Text" xml:space="preserve">
<value>粘贴选中</value>
</data>
<data name="重命名文件ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="重命名文件ToolStripMenuItem.Text" xml:space="preserve">
<value>重命名文件</value>
</data>
<data name="重命名目录ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="重命名目录ToolStripMenuItem.Text" xml:space="preserve">
<value>重命名目录</value>
</data>
<data name="ToolStripSeparator3.Size" type="System.Drawing.Size, System.Drawing">
<value>169, 6</value>
<value>177, 6</value>
</data>
<data name="导入文件ToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down Expand Up @@ -554,25 +554,25 @@
</value>
</data>
<data name="导入文件ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="导入文件ToolStripMenuItem.Text" xml:space="preserve">
<value>导入文件</value>
</data>
<data name="添加文件ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="添加文件ToolStripMenuItem.Text" xml:space="preserve">
<value>添加文件</value>
</data>
<data name="添加目录ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="添加目录ToolStripMenuItem.Text" xml:space="preserve">
<value>添加目录</value>
</data>
<data name="新建目录ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="新建目录ToolStripMenuItem.Text" xml:space="preserve">
<value>新建目录</value>
Expand All @@ -590,43 +590,43 @@
<value>跳过符号链接</value>
</data>
<data name="选项ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="选项ToolStripMenuItem.Text" xml:space="preserve">
<value>选项</value>
</data>
<data name="ToolStripSeparator4.Size" type="System.Drawing.Size, System.Drawing">
<value>169, 6</value>
<value>177, 6</value>
</data>
<data name="删除文件ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="删除文件ToolStripMenuItem.Text" xml:space="preserve">
<value>删除文件</value>
</data>
<data name="删除目录ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="删除目录ToolStripMenuItem.Text" xml:space="preserve">
<value>删除目录</value>
</data>
<data name="ToolStripSeparator8.Size" type="System.Drawing.Size, System.Drawing">
<value>169, 6</value>
<value>177, 6</value>
</data>
<data name="生成标签ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="生成标签ToolStripMenuItem.Text" xml:space="preserve">
<value>生成标签</value>
</data>
<data name="设置标签ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="设置标签ToolStripMenuItem.Text" xml:space="preserve">
<value>设置标签</value>
</data>
<data name="文件详情ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="文件详情ToolStripMenuItem.Text" xml:space="preserve">
<value>文件详情</value>
Expand Down Expand Up @@ -656,13 +656,13 @@
<value>XAttr</value>
</data>
<data name="复制信息到剪贴板ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>172, 22</value>
<value>180, 22</value>
</data>
<data name="复制信息到剪贴板ToolStripMenuItem.Text" xml:space="preserve">
<value>复制信息到剪贴板</value>
</data>
<data name="ContextMenuStrip1.Size" type="System.Drawing.Size, System.Drawing">
<value>173, 446</value>
<value>181, 468</value>
</data>
<data name="&gt;&gt;ContextMenuStrip1.Name" xml:space="preserve">
<value>ContextMenuStrip1</value>
Expand Down Expand Up @@ -914,7 +914,7 @@
<value>备份当前索引</value>
</data>
<data name="索引ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 22</value>
<value>180, 22</value>
</data>
<data name="索引ToolStripMenuItem.Text" xml:space="preserve">
<value>索引操作</value>
Expand Down Expand Up @@ -958,13 +958,13 @@
<value>更新全部索引(安全弹出)</value>
</data>
<data name="数据操作ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 22</value>
<value>180, 22</value>
</data>
<data name="数据操作ToolStripMenuItem.Text" xml:space="preserve">
<value>数据操作</value>
</data>
<data name="ToolStripSeparator5.Size" type="System.Drawing.Size, System.Drawing">
<value>121, 6</value>
<value>177, 6</value>
</data>
<data name="ToolStripTextBox2.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
Expand Down Expand Up @@ -1126,13 +1126,13 @@
<value>显示文件数</value>
</data>
<data name="自动化ToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 22</value>
<value>180, 22</value>
</data>
<data name="自动化ToolStripMenuItem1.Text" xml:space="preserve">
<value>自动化</value>
</data>
<data name="ToolStripSeparator6.Size" type="System.Drawing.Size, System.Drawing">
<value>121, 6</value>
<value>177, 6</value>
</data>
<data name="清除当前索引后数据ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>196, 22</value>
Expand All @@ -1153,7 +1153,7 @@
<value>查找指定位置前的索引</value>
</data>
<data name="回退ToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 22</value>
<value>180, 22</value>
</data>
<data name="回退ToolStripMenuItem.Text" xml:space="preserve">
<value>回退</value>
Expand Down
11 changes: 9 additions & 2 deletions LTFSCopyGUI/LTFSWriter.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
40 changes: 34 additions & 6 deletions LTFSCopyGUI/TapeUtils.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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..")
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fa9cc69

Please sign in to comment.