我愿列出一条代表道路的座标。 这种结果确实具有等级顺序。
我指的是:就每个目录而言,我想首次在这条道路上列出所有档案(按字母顺序排列或无顺序排列)。 然后,将列出每一次子路线。 对于每个次主题,我想所有文件......等等。
例如:
(贝鲁特)
emule/changelog.txt
emule/config/
emule/config/adresses.dat
emule/config/nodes.dat
emule/config/webservices.dat
emule/eMule.tmpl
emule/eMule_Chicane.tmpl
emule/license.txt
emule/license-GER.txt
emule/readme.txt
emule/Skin/
emule/Skin/Daan-V2-8.eMuleSkin.ini
emule/Skin/DaanV2-8/
emule/Skin/DaanV2-8/back.ICO
emule/Skin/DaanV2-8/WebServer.ico
emule/Template.eMuleSkin.ini
emule/webserver/
emule/webserver/add_server.gif
emule/webserver/arrow_down.gif
emule/webserver/arrow_right.gif
emule/webserver/yellow.gif
emule/emule.exe
(After)
emule/changelog.txt
emule/emule.exe
emule/eMule.tmpl
emule/eMule_Chicane.tmpl
emule/license.txt
emule/license-GER.txt
emule/readme.txt
emule/Template.eMuleSkin.ini
emule/config/
emule/config/adresses.dat
emule/config/nodes.dat
emule/config/webservices.dat
emule/Skin/
emule/Skin/Daan-V2-8.eMuleSkin.ini
emule/Skin/DaanV2-8/
emule/Skin/DaanV2-8/back.ICO
emule/Skin/DaanV2-8/WebServer.ico
emule/webserver/
emule/webserver/add_server.gif
emule/webserver/arrow_down.gif
emule/webserver/arrow_right.gif
emule/webserver/yellow.gif
我尝试了许多解决办法,如Array.Sort()的习俗可比较功能。
你们是否有任何想法? 非常感谢。
EDIT:这里是我的可比较方法
zipEntries.Sort(AddressOf compareZipEntryFilenames)
Private Function compareZipEntryFilenames(ByVal x As Object, ByVal y As Object) As Integer
Dim one As String = CType(x, ZipEntry).FileName
Dim two As String = CType(y, ZipEntry).FileName
If Path.GetDirectoryName(one) = Path.GetDirectoryName(two) Then
Return String.Compare(one, two)
Else
Select Regex.Matches(one, "/").Count.CompareTo(Regex.Matches(two, "/").Count)
Case -1 one has less / than two; so one then two
Return -1
Case 1 one has more / than two; so two then one
Return 1
Case Else = 0, same number of /; so alphabetical sorting
Return String.Compare(one, two)
End Select
End If
End Function