0
我有開始應用此代碼下載尺寸文件阻止執行的
client.DownloadFileAsync(new Uri("http://mysite/myapplication.exe"), tempPath + "\\" + sDownloadFileName);
try
{
string tempPath = System.IO.Path.GetTempPath();
Process.Start(tempPath + "myapplication.exe");
Application.Exit();
}
catch
{
MessageBox.Show"Error, the file is corrupt");
}
之後,但如果文件(HTTP://mysite/myapplication.exe)不存在.. 一個文件創建的相同1KB,啓動並返回錯誤=( 可能塊的執行文件,如果是小的10 MB?
try
{
string tempPath = System.IO.Path.GetTempPath();
if (tempPath + "myapplication.exe" == -10 MB)
{
MessageBox.Show"Error, the file is corrupt");
}
else if
{
Process.Start(tempPath + "myapplication.exe");
}
}