RAR-Files entpacken geht nicht

  • VB.NET

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von gfcwfzkm.

    RAR-Files entpacken geht nicht

    Hi,

    ich habe gestern im Google mal zeugs eigetippt und bin auf dies hier gestossen:

    VB.NET-Quellcode

    1. Imports RARNET
    2. Public Class Form1
    3. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    4. Dim dlg As OpenFileDialog = New OpenFileDialog()
    5. dlg.Title = "Unpack RAR Archive"
    6. dlg.CheckFileExists = True
    7. dlg.DefaultExt = "RAR"
    8. dlg.Filter = "RAR files (*.rar)|*.rar"
    9. Dim res As DialogResult = dlg.ShowDialog()
    10. If res = DialogResult.OK Then
    11. TextBox1.Text = dlg.FileName
    12. End If
    13. End Sub
    14. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    15. If TextBox1.TextLength < 1 Then Exit Sub
    16. If TextBox2.TextLength < 1 Then Exit Sub
    17. TextBox1.Enabled = False
    18. TextBox2.Enabled = False
    19. Button1.Enabled = False
    20. Button2.Enabled = False
    21. Dim d As New Decompressor(TextBox1.Text)
    22. AddHandler d.OnUnpack, AddressOf Unpacked
    23. AddHandler d.Unpacking, AddressOf InProgress
    24. d.UnPackAll(TextBox2.Text)
    25. End Sub
    26. Public Sub Unpacked(ByVal r As Decompressor.RAREntry)
    27. ToolStripLabel1.Visible = True
    28. ToolStripLabel1.Text = "Unpacked: " & r.FileName
    29. ' If u want to shorten the text and add "..."
    30. If ToolStripLabel1.Text.Length > 28 Then
    31. ToolStripLabel1.Text = ToolStripLabel1.Text.Substring(0, 28) + "..."
    32. End If
    33. End Sub
    34. Public Sub InProgress(ByVal fTotalFileSize As Long, ByVal fUnpacked As Long, ByRef Disposition As RARNET.Decompressor.RarDisposition)
    35. If fTotalFileSize = 0 Then Exit Sub
    36. ToolStripLabel2.Text = Format(fUnpacked / fTotalFileSize, "percent")
    37. ToolStripProgressBar1.Value = CInt(CDbl(Format(fUnpacked / fTotalFileSize)) * 100)
    38. Me.Refresh()
    39. End Sub
    40. Public Sub GetPath()
    41. Dim dlg2 As FolderBrowserDialog = New FolderBrowserDialog()
    42. Dim res2 As DialogResult = dlg2.ShowDialog()
    43. If res2 = DialogResult.OK Then
    44. TextBox2.Text = dlg2.SelectedPath
    45. End If
    46. End Sub
    47. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    48. If Not System.IO.File.Exists(Application.StartupPath & "\unrar.dll") Then
    49. MsgBox("Missing unpacking dll...")
    50. Application.Exit()
    51. End If
    52. ToolStripLabel1.Visible = False
    53. End Sub
    54. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    55. GetPath()
    56. End Sub
    57. End Class


    Der Fehler kommt beim entpacken (Siehe Anhang)
    Bilder
    • Unbenannt.PNG

      44,12 kB, 803×337, 180 mal angesehen