dclst help

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
skully zerø
Posts: 6
Joined: 2003-02-06 20:20
Location: Ohio
Contact:

dclst help

Post by skully zerø » 2003-02-06 20:30

Okay, i need a bit of assistance with the DC list. I can download it, unhuff it, then see it in the normal text heirarchial way. But my brain hurts to much to figure out how to load the folders into a listview respectively. So if anyone here has any knowledge or VB source on that, then that would be great
Yep its me i think

skully zerø
Posts: 6
Joined: 2003-02-06 20:20
Location: Ohio
Contact:

Post by skully zerø » 2003-02-08 16:37

wel..... i figured out of all the client proggers in here someone would know how at least in algo, guess not then
Yep its me i think

AlleyKat
Posts: 40
Joined: 2003-01-31 15:37
Location: Denmark

Post by AlleyKat » 2003-02-08 16:45

First of all - wait just a little more than a day perhaps?

Second of all - (now, I'm no VB programmer at all, but...) isn't that exactly what DC++ does? And can't you just see the routine there?

skully zerø
Posts: 6
Joined: 2003-02-06 20:20
Location: Ohio
Contact:

Post by skully zerø » 2003-02-08 18:11

sorry i might have been a little vague on what i was searching for. When you get a users share list and open it in a text editor, after being unrared or unhuffed, you see a heirarchial display of the users share.

Root Folder
Sub Folder
Sub Folder
Sub Folder
File
Sub Folder
File
File

in that format.

I am trying to build the viewer for that, a treeview for the folders and a listview for the files. I am having trouble getting the folders into the treeview respectively.

Also appologize for the last post, was a little agrivated with the whole problem after having been trying for the last 4 days now
Yep its me i think

skully zerø
Posts: 6
Joined: 2003-02-06 20:20
Location: Ohio
Contact:

Post by skully zerø » 2003-02-08 18:12

crap, that didnt work out like i had hoped, those subfolders had spaces before them to show that they were underneath the root folder or another subfolder, but either way i think you get the idea right
Yep its me i think

skully zerø
Posts: 6
Joined: 2003-02-06 20:20
Location: Ohio
Contact:

Post by skully zerø » 2003-02-11 00:16

never mind i finally took the time to figure it out, its not really that hard i just didnt want to waste the time doing it hehe
Yep its me i think

sarf
Posts: 382
Joined: 2003-01-24 05:43
Location: Sweden
Contact:

Post by sarf » 2003-02-12 16:54

skully zerø wrote:never mind i finally took the time to figure it out, its not really that hard i just didnt want to waste the time doing it hehe
Uhmm... why not post the code (or at least a link to the code) that you use to do this here, then? This would make it easier for all those young, aspiring VB programmers that you once belonged who read this thread to get something out of it.

Sarf
---
It can't rain all the time

skully zerø
Posts: 6
Joined: 2003-02-06 20:20
Location: Ohio
Contact:

Post by skully zerø » 2003-02-13 00:14

k this snippet, its kinda a slow process will load the text from a file into a string, then parce out only the folders and add it into a treeview, its a process before that that unzips or unhuffs the file to do this, as i said it only does the treeview stuff right now

Code: Select all

Public Sub OpenList(ThePath As String)
    ShareNum = ShareNum + 1
    ReDim ShareView(ShareNum) As frmShareView
    Set ShareView(ShareNum) = New frmShareView
    
    Dim Text1 As String
    Dim SubNode(0 To 100) As Node
    Dim ManySubs As Integer
    TName = Mid(ThePath, InStrRev(ThePath, "\") + 1, InStrRev(ThePath, ".") - 1)
    ShareView(ShareNum).Caption = TName
    FileNum = FreeFile
    Open ThePath For Input As FileNum
    NewLine = Input(LOF(FileNum), FileNum)
    Text1 = NewLine
    Close #1
    TFirst = Mid(Text1, 1, InStr(1, Text1, vbCrLf) - 1)
    Set SubNode(0) = ShareView(ShareNum).tvwFolder.Nodes.Add(, , , TFirst, 1)
    Text1 = Mid(Text1, InStr(1, Text1, vbCrLf) + 2)
    Last = 0
    Do
        tline = Mid(Text1, 1, InStr(1, Text1, vbCrLf) - 1)
        Text1 = Mid(Text1, InStr(1, Text1, vbCrLf) + 2)
        If InStr(1, tline, "|") < 1 Then
            ret = CountOcc(CStr(tline), vbTab)
            tline = Replace(tline, vbTab, "")
            If ret = 0 Then
                ManySubs = 0
                Set SubNode(0) = ShareView(ShareNum).tvwFolder.Nodes.Add(, , , tline, 1)
            ElseIf ret = 1 Then
                ManySubs = 1
                Set SubNode(1) = ShareView(ShareNum).tvwFolder.Nodes.Add(SubNode(0), tvwChild, , tline, 1)
            ElseIf Last < ret Then
                ManySubs = ManySubs + 1
                Set SubNode(ManySubs) = ShareView(ShareNum).tvwFolder.Nodes.Add(SubNode(ManySubs - 1), tvwChild, , tline, 1)
            ElseIf Last = ret Then
                Set SubNode(ManySubs) = ShareView(ShareNum).tvwFolder.Nodes.Add(SubNode(ManySubs - 1), tvwChild, , tline, 1)
            ElseIf ret < Last Then
                If past <> ManySubs Then
                    ManySubs = ManySubs - 1
                End If
                Set SubNode(ManySubs) = ShareView(ShareNum).tvwFolder.Nodes.Add(SubNode(ManySubs - 1), tvwChild, , tline, 1)
            End If
            past = ManySubs
            Last = ret
        End If
        DoEvents
    Loop Until InStr(1, Text1, vbCrLf) < 1
    ShareView(ShareNum).Show
End Sub

Public Function CountOcc(SourceStr As String, ToFindStr As String) As Long
    r = Replace(SourceStr, ToFindStr, "")
    CountOcc = Len(SourceStr) - Len(r)
End Function
and there it is, all ya need to read a normal plain text file into a treeview with respective heirarchial positioning, have fun
Yep its me i think

Locked