Salut
Je me suis installé VB2010express et mis au VB, j'ai bien essayer le C et le python il y a quelques années mais trop dur tout seul sans aucune notion de programmation.
Par contre VB c'est quand même plus simple, puisque j'ai réussi a faire un logiciel qui ne fait presque rien mais qui le fait bien
Vous l'aurez compris, j'y connais rien en programmation et j'ai besoin que quelqu’un valide mon code en cas de grosse connerie.
ProfilManager ou MulliManager a choisir
Permet de sauvegarder 3 versions différente des 2 fichier MULLIGATAWNY présent dans SavedGames
Et de les restaurer facilement
Ce qui permettrai de passer facilement d'une config palette a une config boite H par exemple
Un bouton restore original profile en cas de souci
Rien d'autre...
EDIT: avec image c'est mieux
Voila le code, compilé pour .NET 3.5 (simple précision), ce code fonctionne en l’état, mais n'est surement pas bien concu...
Imports System.IO
Imports System.IO.File
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Procedure d'initialisation de ProfilManager,
'verifie la presence de richard burns rally.exe
'cree le dossier ProfilManager et ses sous dossiers
'sauvegarde le profil MULLIGATANWY dans le dossier OriginalProfil
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
'C'est parti!!
'verifie la presence de rbr.exe dans le dossier courant
If System.IO.File.Exists("richardburnsrally_SSE.exe") = False Then
MsgBox("launch the application in the folder richard burns rally")
Close()
Else
'verifie si le dossier ProfilManager existe
If System.IO.Directory.Exists("ProfilManager") = False Then
''si non cree le dossier ProfilManager et ses sous dossiers
System.IO.Directory.CreateDirectory("ProfilManager")
System.IO.Directory.CreateDirectory("ProfilManager\OriginalProfil")
System.IO.Directory.CreateDirectory("ProfilManager\Profil1")
System.IO.Directory.CreateDirectory("ProfilManager\Profil2")
System.IO.Directory.CreateDirectory("ProfilManager\Profil3")
Dim value As String
value = Application.StartupPath
''Création d'un flux d'écriture
Dim installpath As New StreamWriter(value & "\ProfilManager\installpath.txt")
'écriture et fermeture
installpath.WriteLine(value)
installpath.Close()
'detecte la presence de MULLIGATAWNY et fait une sauvegarde dans OriginalProfil
If Exists(value & "\SavedGames\pfMULLIGATAWNY.acm") Then
System.IO.File.Copy(".\SavedGames\pfMULLIGATAWNY.acm", ".\ProfilManager\OriginalProfil\pfMULLIGATAWNY.acm")
End If
If Exists(value & "\SavedGames\pfMULLIGATAWNY.rbr") Then
System.IO.File.Copy(".\SavedGames\pfMULLIGATAWNY.rbr", ".\ProfilManager\OriginalProfil\pfMULLIGATAWNY.rbr")
End If
End If
End If
End Sub
'ATTENTE DE L'UTILISATEUR
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim value As String
value = Application.StartupPath
'detecte la presence de MULLIGATAWNY et fait une sauvegarde dans Profil1
If Exists(value & "\ProfilManager\Profil1\pfMULLIGATAWNY.acm") Then
System.IO.File.Delete(".\ProfilManager\Profil1\pfMULLIGATAWNY.acm")
System.IO.File.Delete(".\ProfilManager\Profil1\pfMULLIGATAWNY.rbr")
End If
If Exists(value & "\SavedGames\pfMULLIGATAWNY.acm") Then
System.IO.File.Copy(".\SavedGames\pfMULLIGATAWNY.acm", ".\ProfilManager\Profil1\pfMULLIGATAWNY.acm")
End If
If Exists(value & "\SavedGames\pfMULLIGATAWNY.rbr") Then
System.IO.File.Copy(".\SavedGames\pfMULLIGATAWNY.rbr", ".\ProfilManager\Profil1\pfMULLIGATAWNY.rbr")
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim value As String
value = Application.StartupPath
'detecte la presence de MULLIGATAWNY et fait une sauvegarde dans Profil2
If Exists(value & "\ProfilManager\Profil2\pfMULLIGATAWNY.acm") Then
System.IO.File.Delete(".\ProfilManager\Profil2\pfMULLIGATAWNY.acm")
System.IO.File.Delete(".\ProfilManager\Profil2\pfMULLIGATAWNY.rbr")
End If
If Exists(value & "\SavedGames\pfMULLIGATAWNY.acm") Then
System.IO.File.Copy(".\SavedGames\pfMULLIGATAWNY.acm", ".\ProfilManager\Profil2\pfMULLIGATAWNY.acm")
End If
If Exists(value & "\SavedGames\pfMULLIGATAWNY.rbr") Then
System.IO.File.Copy(".\SavedGames\pfMULLIGATAWNY.rbr", ".\ProfilManager\Profil2\pfMULLIGATAWNY.rbr")
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim value As String
value = Application.StartupPath
'detecte la presence de MULLIGATAWNY et fait une sauvegarde dans Profil3
If Exists(value & "\ProfilManager\Profil3\pfMULLIGATAWNY.acm") Then
System.IO.File.Delete(".\ProfilManager\Profil3\pfMULLIGATAWNY.acm")
System.IO.File.Delete(".\ProfilManager\Profil3\pfMULLIGATAWNY.rbr")
End If
If Exists(value & "\SavedGames\pfMULLIGATAWNY.acm") Then
System.IO.File.Copy(".\SavedGames\pfMULLIGATAWNY.acm", ".\ProfilManager\Profil3\pfMULLIGATAWNY.acm")
End If
If Exists(value & "\SavedGames\pfMULLIGATAWNY.rbr") Then
System.IO.File.Copy(".\SavedGames\pfMULLIGATAWNY.rbr", ".\ProfilManager\Profil3\pfMULLIGATAWNY.rbr")
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim value As String
value = Application.StartupPath
'detecte la presence de Profil1
If System.IO.File.Exists(".\ProfilManager\Profil1\pfMULLIGATAWNY.acm") = False Then
MsgBox("You have to backup a profile before")
'Close()
Else
'copie les fichiers
System.IO.File.Delete(".\SavedGames\pfMULLIGATAWNY.acm")
System.IO.File.Delete(".\SavedGames\pfMULLIGATAWNY.rbr")
System.IO.File.Copy(".\ProfilManager\Profil1\pfMULLIGATAWNY.acm", ".\SavedGames\pfMULLIGATAWNY.acm")
System.IO.File.Copy(".\ProfilManager\Profil1\pfMULLIGATAWNY.rbr", ".\SavedGames\pfMULLIGATAWNY.rbr")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim value As String
value = Application.StartupPath
'detecte la presence de Profil2
If System.IO.File.Exists(".\ProfilManager\Profil2\pfMULLIGATAWNY.acm") = False Then
MsgBox("You have to backup a profile before")
'Close()
Else
'copie les fichiers
System.IO.File.Delete(".\SavedGames\pfMULLIGATAWNY.acm")
System.IO.File.Delete(".\SavedGames\pfMULLIGATAWNY.rbr")
System.IO.File.Copy(".\ProfilManager\Profil2\pfMULLIGATAWNY.acm", ".\SavedGames\pfMULLIGATAWNY.acm")
System.IO.File.Copy(".\ProfilManager\Profil2\pfMULLIGATAWNY.rbr", ".\SavedGames\pfMULLIGATAWNY.rbr")
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim value As String
value = Application.StartupPath
'detecte la presence de Profil3
If System.IO.File.Exists(".\ProfilManager\Profil3\pfMULLIGATAWNY.acm") = False Then
MsgBox("You have to backup a profile before")
'Close()
Else
'copie les fichiers
System.IO.File.Delete(".\SavedGames\pfMULLIGATAWNY.acm")
System.IO.File.Delete(".\SavedGames\pfMULLIGATAWNY.rbr")
System.IO.File.Copy(".\ProfilManager\Profil3\pfMULLIGATAWNY.acm", ".\SavedGames\pfMULLIGATAWNY.acm")
System.IO.File.Copy(".\ProfilManager\Profil3\pfMULLIGATAWNY.rbr", ".\SavedGames\pfMULLIGATAWNY.rbr")
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim value As String
value = Application.StartupPath
'detecte la presence de OriginalProfil
If System.IO.File.Exists(".\ProfilManager\OriginalProfil\pfMULLIGATAWNY.acm") = False Then
MsgBox("Original profile missing")
'Close()
Else
'copie les fichiers
System.IO.File.Delete(".\SavedGames\pfMULLIGATAWNY.acm")
System.IO.File.Delete(".\SavedGames\pfMULLIGATAWNY.rbr")
System.IO.File.Copy(".\ProfilManager\OriginalProfil\pfMULLIGATAWNY.acm", ".\SavedGames\pfMULLIGATAWNY.acm")
System.IO.File.Copy(".\ProfilManager\OriginalProfil\pfMULLIGATAWNY.rbr", ".\SavedGames\pfMULLIGATAWNY.rbr")
End If
End Sub
End Class