Results 1 to 5 of 5

Thread: Bug in code. Help?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Location
    Florida
    Posts
    44

    Bug in code. Help?

    Theres a bug in my code for recieving remote directory list.. For some reason it seems to put an "F" at the end of the file name and I also can't access this file. I hope someone can help cause I've been banging my head over this... You can see screenshots and download the project here:http://www.shepstype-r.com/rfm_error/index.php
    I think this is where it is...
    VB Code:
    1. Public Sub ChangeDirectory(ByVal NewDirectory As String)
    2. ' "CHG"/Directory
    3. If Not bCon Then Exit Sub
    4. If Len(NewDirectory) = 0 Then Exit Sub
    5. Dim sPacket As String
    6. sPacket = "CHG" & DELIM & NewDirectory
    7. frmMain.sckMain.SendData sPacket & EOP
    8. End Sub
    9.  
    10. Public Sub ParseChangeDirectory(ByVal Data As String)
    11. On Error Resume Next
    12. ' Successfull: "CHG"/"Directory"/D:Folder1|F:File1*123|F:File2*123
    13. ' Folder doesn't exist: "CHG"/"Directory"/"NonExist"
    14. Dim sBuff() As String: sBuff() = Split(Data, DELIM)
    15. If sBuff(2) = "NonExist" Then
    16.     frmMain.StatusBar.SimpleText = "Status: Error changing directory; directory does not exist."
    17.     Exit Sub
    18. Else
    19.     sCurDir = sBuff(1)
    20.     frmMain.txtCurDir.Text = sCurDir
    21.     Dim sDir() As String, sType() As String, lLoop As Long, sTmpDir As String, sSize() As String
    22.     sDir() = Split(sBuff(2), "|")
    23.     With frmMain
    24.         .TVDir.Nodes.Clear
    25.         .LVFile.ListItems.Clear
    26.         For lLoop = 0 To UBound(sDir)
    27.             sTmpDir = sDir(lLoop)
    28.             If Len(sTmpDir) > 0 Then
    29.                 sType() = Split(sTmpDir, "*?*")
    30.                 If sType(0) = "D" Then
    31.                     .TVDir.Nodes.Add , , sType(1), sType(1), "Dir"
    32.                 ElseIf sType(0) = "F" Then
    33.                     sSize() = Split(sType(1), "*")
    34.                     .LVFile.ListItems.Add , , sSize(0), , "FN"
    35.                     .LVFile.ListItems(.LVFile.ListItems.Count).ListSubItems.Add , , BytesToKB(CDbl(sSize(1)))
    36.                     .LVFile.ListItems(.LVFile.ListItems.Count).ListSubItems(1).Bold = True
    37.                 End If
    38.             End If
    39.         Next lLoop
    40.         .LVFile.Refresh
    41.     End With
    42. End If
    43. End Sub
    Thanks for any help or comments/suggestions!!!!!
    $hep
    Last edited by $hep; Jun 27th, 2004 at 03:11 PM.

  2. #2
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    Its not a bug. That File Manager is from PSC i remember looking at this a few months back. The "F" is a delmiter to recgonise where the last folder is. Its so you can distinguish the difference between files and folders. Its just bad coding. If you want to change it you'll need to redo the whole enumerating the files and folders part.

  3. #3
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    chnage the F to a space and do the same on the server side, though this may cause other problems.

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2004
    Location
    Florida
    Posts
    44
    Your right..Its from PSC..I downloaded it cause I could use it. And I wanted to play with it. It seemed like good code..Compared to some others.
    It seems to only add the "F" to folders with a large amount folders inside. Then it won't let you inside that folder. I'll try changing the "F" to " " on both server/client...Is this what you mean?
    Thanks for your help..!
    $hep

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2004
    Location
    Florida
    Posts
    44
    It works!
    Thanks for the hint Jmacp!!!!
    $hep

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width