Liste en parametre

cs_trouduc Messages postés 56 Date d'inscription jeudi 26 décembre 2002 Statut Membre Dernière intervention 28 septembre 2005 - 1 juil. 2005 à 23:15
cs_trouduc Messages postés 56 Date d'inscription jeudi 26 décembre 2002 Statut Membre Dernière intervention 28 septembre 2005 - 2 juil. 2005 à 00:40
voila j'ai une liste qui contient les parametre de mon serveur et je voudrais afficher ses parametre dans mon prog, mon probleme c'est que je doit afficher ca dans plusieurs textbox, checkbox, slider, listbox. je sais pas comment faire ca simple.

voici ma liste dans un fichier txt

sv.serverName "Default Server Name"
sv.password ""
sv.internet 0
sv.bandwidthChoke 0
sv.serverIP ""
sv.serverPort 16567
sv.welcomeMessage ""
sv.punkBuster 0
sv.allowFreeCam 0
sv.allowExternalViews 1
sv.allowNoseCam 1
sv.hitIndicator 1
sv.maxPlayers 64
sv.numPlayersNeededToStart 2
sv.notEnoughPlayersRestartDelay 15
sv.startDelay 15
sv.endDelay 15
sv.spawnTime 15
sv.manDownTime 15
sv.endOfRoundDelay 15
sv.ticketRatio 100
sv.roundsPerMap 3
sv.timeLimit 0
sv.scoreLimit 0
sv.soldierFriendlyFire 100
sv.vehicleFriendlyFire 100
sv.soldierSplashFriendlyFire 100
sv.vehicleSplashFriendlyFire 100
sv.tkPunishEnabled 1
sv.tkNumPunishToKick 3
sv.tkPunishByDefault 0
sv.votingEnabled 1
sv.voteTime 90
sv.minPlayersForVoting 2
sv.gameSpyPort 29900
sv.allowNATNegotiation 0
sv.interfaceIP ""
sv.autoRecord 0
sv.demoIndexURL http://
sv.demoDownloadURL http://
sv.autoDemoHook "adminutils/demo/rotate_demo.exe"
sv.demoQuality 1
sv.adminScript "default"
sv.timeBeforeRestartMap 30
sv.autoBalanceTeam 0
sv.teamRatioPercent 100
sv.voipEnabled 1
sv.voipQuality 3
sv.voipServerRemote 0
sv.voipServerRemoteIP ""
sv.voipServerPort 55125
sv.voipBFClientPort 55123
sv.voipBFServerPort 55124
sv.voipSharedPassword ""
sv.useGlobalRank 1
sv.useGlobalUnlocks 1
sv.sponsorText ""
sv.sponsorLogoURL ""
sv.communityLogoURL ""
sv.radioSpamInterval 6
sv.radioMaxSpamFlagCount 6
sv.radioBlockedDurationTime 30

serais bien de pas afficher les sv.****** et j'aimerais aussi sauvegarder ses données quand je les modifie.
voici le code de ma source (en fais ou je suis rendu dans mon projet)

Dim IDProg As Integer


Private Sub Combo1_Click()
List2.Clear
ChargeMap
End Sub


Private Sub Command1_Click()
If Command1.Caption = "Start" Then
Command1.Caption = "Stop"
IDProg = Shell("Bf2_w32ded.exe +config" & " " & Chr(34) & "ServerConfigs" & Combo1.Text & Chr(34) _
& " " & "+mapList" & " " & Chr(34) & "ServerConfigs\Maps\map" & Combo1.Text & Chr(34), vbNormalNoFocus)
Else
Command1.Caption = "Start"
AppActivate (IDProg)
SendKeys "exit", True
SendKeys "~", True
End If
End Sub


Private Sub Command11_Click()
Unload Me
End Sub


Private Sub Command12_Click()
List2.AddItem List1.List(List1.ListIndex)
End Sub


Private Sub Command13_Click()
List2.RemoveItem List2.ListIndex
End Sub


Private Sub Command2_Click()
AppActivate (IDProg)
SendKeys "gameLogic.togglePause", True
SendKeys "~", True
End Sub


Private Sub Command3_Click()
AppActivate (IDProg)
SendKeys "admin.clearBanList", True
SendKeys "~", True
End Sub


Private Sub Command4_Click()
AppActivate (IDProg)
SendKeys "admin.restartMap", True
SendKeys "~", True
End Sub


Private Sub Command5_Click()
AppActivate (IDProg)
SendKeys "admin.runNextLevel", True
SendKeys "~", True
End Sub


Private Sub Command6_Click()
AppActivate (IDProg)
SendKeys "admin.banPlayerKey" & " " & Text1.Text, True
SendKeys "~", True
End Sub


Private Sub Command7_Click()
AppActivate (IDProg)
SendKeys "admin.kickPlayer" & " " & Text1.Text, True
SendKeys "~", True
End Sub


Private Sub Command8_Click()
AppActivate (IDProg)
SendKeys "game.sayall" & " " & Chr(34) & "ADMIN:" & " " & Text2.Text & Chr(34), True
SendKeys "~", True
Text2.Text = ""
End Sub


Private Sub Command9_Click()
SauveMap
End Sub


Private Sub Form_Load()
ChargeMap
ChargeConfig
ChargeListeMap
Label1.Caption = Slider1.Value
End Sub


Private Sub Slider1_Change()
Label1.Caption = Slider1.Value
End Sub


Function ChargeConfig()
Dim sFile As String
sFile = Dir(App.Path & "\ServerConfigs\*.*")
While sFile <> ""
Combo1.AddItem sFile
sFile = Dir
Wend
End Function


Function ChargeMap()
On Error GoTo Fin:
Dim map As String
Open ("ServerConfigs\Maps\map" & Combo1.Text) For Input As #1
Do While Not EOF(1)
Line Input #1, map
If LenB(map) <> 0 Then List2.AddItem map
Loop
Close #1
Fin:
End Function


Function ChargeListeMap()
On Error GoTo Fin:
Dim item As String
Open "ServerConfigs\Maps\maplist.con" For Input As #1
Do While Not EOF(1)
Line Input #1, item
If LenB(item) <> 0 Then List1.AddItem item
Loop
Close #1
Fin:
End Function


Function SauveMap()
Dim cpt4 As Integer
Dim smap As String
Open ("ServerConfigs\Maps\map" & Combo1.Text) For Output As #2
For cpt4 = 0 To List2.ListCount
smap = List2.List(cpt4)
Print #2, smap
Next
Close #2
End Function

voila c'est pas tres beau mais j'suis seulement un debutant
a force de poser des questions je n'aurai plus aucun merite pour mon prog
je devrai le dedier a la communauté de VBFrance

merci de m'aider

2 réponses

nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 37
2 juil. 2005 à 00:20
Salut,





Le but de ton programme c'est de quoi faire

L'IHM



Donc tu as plusieurs possibilités de faire l'IHM

Soit tu utilises un SSTAB et tu regroupes les Paramétres par famille.



Soit tu utilises un treeview

Et la tu peux gerer des liste des paramétres (ajout de noeuds)

Tu peux faire un treeview pour chaque noued tu as des propietes



Pour le propriétes tu peuix utilisées les tags pour savoir ce que tu doit afficher



C'est un peu complexe.

Beauc oup de logiciel utilises ce principe de treeview



(regardes par les pages de propriétés de Visual studio .net ou de mozilla, firefox)



Exemple d'utilisation avec des ajouts de noueds

configuration d'un serveur web

(un noeud --> un site d'un utilisateur

sur le détail tu ajoutes les propriétés présente pour le site selecté

nom, adresse mail, date de maj, taille, protégé par mot de passe, ....



Pour le détail tu peux faire des usercontrol que tu place en fonction du tag de chaque noued je crois qu'il y en a )



C'est peu des idées comme ca des pistes a explorer.

Mais le probleme est peut etre mal posé ...



Voila
0
cs_trouduc Messages postés 56 Date d'inscription jeudi 26 décembre 2002 Statut Membre Dernière intervention 28 septembre 2005
2 juil. 2005 à 00:40
mon prog me sert a lancer un serveur de jeu et eventuellement configurer les options si je reussis ou si quelqu'un me donne un coup de main
je veut que mon prog lise cet liste et place les lignes au bon endroit dans mon prog (comme dans le screenshot)

c'est a dire

sv.serverName "Default Server Name" 'place "Default Server Name" dans un textbox1
sv.password "" 'place ce qu'il y a entre "" dans textbox2
sv.internet 0 'place ce 0 ou 1(boolean) dans un checkbox1
sv.bandwidthChoke 0 'place dans listbox1
sv.serverIP "" 'textbox
sv.serverPort 16567 'textbox
sv.welcomeMessage "" 'textbox
sv.punkBuster 0 'checkbox
sv.allowFreeCam 0 'checkbox
sv.allowExternalViews 1 'checkbox
sv.allowNoseCam 1 'checkbox
sv.hitIndicator 1 'checkbox
sv.maxPlayers 64 'slider etc. etc.
sv.numPlayersNeededToStart 2
sv.notEnoughPlayersRestartDelay 15
sv.startDelay 15
0
Rejoignez-nous