linkteki dosyayı indiricem ama indirirken indirilicek yola illa dosya ismi girmemi istiyor ama ben şunu istiyorum dosya ismide sonundaki isim olacak yani otomatik alglayacak ve belirttiğim yola license.txt olarak indircek bunu nasıl yaparım bilen varmıdır ?
Kardeşim ya ben salağım ya da sen anlatamıyorsun. Söylediklerinden şöyle birşey çıkardım; indirilen dosyanın adı otomatik olarak hile.rar şeklinde iniyor fakat sen bunu kullanıcının girmesini mi istiyorsun ?
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DLButton.Click
Dim chElement = From chE In CheatList.Descendants("Cheat") Where chE.@Name = chList.SelectedItem.ToString
chSaveDialog.FileName = chElement.@Name
If chSaveDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
Try
My.Computer.Network.DownloadFile(chElement.Descendants("Download").Value, chSaveDialog.FileName, "", "", True, 500, True)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, Me.Text)
IO.File.Delete(chSaveDialog.FileName)
End Try
End If
End Sub
O kısmı bu kodla degiştir:
Kod:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DLButton.Click
Dim chElement = From chE In CheatList.Descendants("Cheat") Where chE.@Name = chList.SelectedItem.ToString
Dim fileName As String = chElement.Descendants("Download").Value.Substring(chElement.Descendants("Download").Value.LastIndexOf("/") + 1)
chSaveDialog.FileName = fileName
If chSaveDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
Try
My.Computer.Network.DownloadFile(chElement.Descendants("Download").Value, chSaveDialog.FileName, "", "", True, 500, True)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, Me.Text)
IO.File.Delete(chSaveDialog.FileName)
End Try
End If
End Sub
Dim remoteUri As String = url
Dim fileName As String = "dosya.exe"
Using (var client = new WebClient())
client.DownloadFile(remoteUri, fileName)
End Using