Voila ma petite méthode qui n'est pourtant pas compliqué .
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 public static void downloadfiles() { String path = Application.StartupPath + @"\pdata"; try { Directory.CreateDirectory(path); } catch { MessageBox.Show("Not Enough Rights, use administrator account", "Rights Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); } WebClient dl_files = new WebClient(); String url = "http://valiantro.com/vpatch/"; Uri uri = new Uri(url + "setting.cfg"); dl_files.DownloadFile(uri, "setting.cfg"); File.Delete(path + "\\setting.cfg"); File.Move(Application.StartupPath + "\\setting.cfg", path + "\\"); uri = new Uri(url + "patchlist.txt"); dl_files.DownloadFile(uri, "patchlist.txt"); File.Move(Application.StartupPath + @"\patchlist.txt", path); dl_files.Dispose(); }
Une exceptionje vois pas trop, i'l n'ya pas de fichier dans path c'est un dossier vide.Can not create a file when this one is already created?
je vois pas de quoi ca parle.
Sinon si vous avez des suggestions, toujours preneur !
Partager