il ne faut pas selectionner de gros fichiers sinon sa plante ca ne sert que pour la librairie ( 0k --> 100k)
Code : Tout sélectionner
If OpenWindow(0, 0, 0, 700, 400, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "Librarie Viewer") = 0 Or CreateGadgetList(WindowID(0)) = 0
MessageRequester("Attention", "Le programme ne peut être lancé")
End
EndIf
If OpenPreferences("Librarie Viewer.pref")
pure_directory.s = ReadPreferenceString("pure_repertoire", "")
ClosePreferences()
EndIf
If pure_directory = ""
If CreatePreferences("Librarie Viewer.pref")
pure_directory = PathRequester("Repertoire de PureBasic", "C\:")
WritePreferenceString("pure_repertoire", pure_directory)
ClosePreferences()
EndIf
EndIf
ExplorerListGadget(0, 10, 10, 220, 380, pure_directory + "\PureLibraries\", #PB_Explorer_FullRowSelect)
RemoveGadgetColumn(0, 3)
RemoveGadgetColumn(0, 2)
EditorGadget(1, 240, 10, 450, 380, "")
Repeat
event = WaitWindowEvent()
If event = #PB_Event_Gadget
Select EventGadgetID()
Case 0
selec = GetGadgetState(0)
If Selec <> -1
name.s = GetGadgetText(0) + GetGadgetItemText(0, Selec, 0)
text.s = "librarie: " + name + Chr(13) + Chr(13)
If OpenFile(0, name)
string.s = ""
Repeat
string + ReadString() + Chr(13)
pos = FindString(string, "ERUP", 0)
pos1 = 0
If pos
pos1 = FindString(string, "ERUP", pos + 1)
EndIf
Until pos1 Or Eof(0)
pos = FindString(string, "LIB3", 0)
If pos = 0
pos = FindString(string, "LIB2", 0)
EndIf
If pos
; nom de la librairie
text + "Name: "
pos + 4
posfin = Lof()
For a = 1 To 5
posfin_1 = FindString(string, Chr(a), pos)
If posfin_1 < posfin And posfin_1 : posfin = posfin_1 : EndIf
Next
text + Mid(string, pos, posfin - pos) + Chr(13)
; nom des libraries window utilisées
text + "Window Librarie:" + Chr(13)
posfin + 2
posfin_1 = Len(string)
For a = 1 To 8
posfin_2 = FindString(string, Chr(a), posfin)
If posfin_2 < posfin_1 And posfin_2 : posfin_1 = posfin_2 : EndIf
Next
While posfin < posfin_1 And posfin_1
pos = FindString(string, Chr(13), posfin)
text + " - " + Mid(String, posfin, pos - posfin) + Chr(13)
posfin = pos + 1
Wend
; nom de l'aide
text + Chr(13) + "Help: "
posfin + 1
posfin_1 = Len(string)
For a = 1 To 8
posfin_2 = FindString(string, Chr(a), posfin)
If posfin_2 < posfin_1 And posfin_2 : posfin_1 = posfin_2 : EndIf
Next
pos = FindString(string, Chr(13), posfin)
text + Mid(String, posfin, pos - posfin) + Chr(13) + Chr(13)
posfin = pos + 1
; nom des libraries Pure utilisées
text + "Pure Librarie:" + Chr(13)
posfin + 1
posfin_1 = Len(string)
For a = 1 To 8
posfin_2 = FindString(string, Chr(a), posfin)
If posfin_2 < posfin_1 And posfin_2 : posfin_1 = posfin_2 : EndIf
Next
librarie.s = Mid(string, posfin, posfin_1 - posfin)
For pos = 1 To Len(librarie) - 1
If Mid(librarie, pos + 1, 1) = Chr(13) And Mid(librarie, pos, 1) = Chr(13)
librarie = Mid(librarie, 1, pos)
Break
EndIf
Next
nb = CountField(librarie, Chr(13))
nb_1 = 1
While posfin < posfin_1 And posfin_1 And nb <> nb_1
nb_1 + 1
pos = FindString(string, Chr(13), posfin)
text + " - " + Mid(String, posfin, pos - posfin) + Chr(13)
posfin = pos + 1
Wend
; fonctions
text + Chr(13) + "Functions and descriptions:" + Chr(13)
string = Mid(string, posfin, Len(string) - posfin)
pos = 1
While FindString(string, "(", pos) And FindString(string, ")", pos)
posfin = FindString(string, Chr(13), pos)
text + " - " + Mid(string, pos, posfin - pos)
pos = FindString(string, "(", posfin)
posfin = FindString(string, Chr(13), pos)
text + Mid(string, pos, posfin - pos) + Chr(13)
pos = posfin + 1
Wend
SetGadgetText(1, text)
Else
SetGadgetText(1, text + string)
EndIf
CloseFile(0)
EndIf
EndIf
EndSelect
EndIf
Until event = #PB_Event_CloseWindow
End