1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
class Program
{
static void LaunchVLC(string arg)
{
ProcessStartInfo processInfo = new ProcessStartInfo(@"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe", arg);
Process myProcess = Process.Start(processInfo);
myProcess.Close();
}
static void Main(string[] args)
{
string dossier;
string fichier;
string chemin;
string[] lignes = new string[2];
string ficLog = "log.txt";
try
{
Console.WriteLine("Ouverture du fichier..");
System.IO.StreamReader monStreamReader = new System.IO.StreamReader(ficLog);
string ligne = monStreamReader.ReadLine();
int count = 0;
while (ligne != null)
{
lignes[count] = ligne;
ligne = monStreamReader.ReadLine();
count++;
}
monStreamReader.Close();
}
catch (Exception ex)
{
Console.WriteLine("Erreur lecture du fichier...");
Console.WriteLine(ex.Message);
}
dossier = lignes[0];
fichier = lignes[1];
chemin = "\""+dossier + fichier+"\"";
Console.WriteLine(chemin);
Console.Read();
String test = "\"G:\\Vidéos\\Ma video.avi\"";
LaunchVLC(test); // fonctionne
LaunchVLC(chemin); // fonctionne pas...
//chemin = "G:\Vidéos\Ma video.avi" (lorsque je l'affiche dans la console)
}
} |