0
我有問題的小東西......我編碼自動更新和當我下載.exe文件我想把它放在主要目錄..和其他人。擴展到子目錄。如果文件名的地方dir不工作
的file.exe =這是我下載的地方,主目錄 否則=地方子目錄...但它不是工作,將所有主目錄
if(ex[1] == "File.exe")
{
if (File.Exists(path))
{
if(File.Exists(String.Format("{0}WoW.exe", wow.GetValue("InstallPath").ToString())))
{
File.Copy(String.Format("{0}WoW.exe", wow.GetValue("InstallPath").ToString()), String.Format("{0}WoW_zaloha_Awrodar_old_file.exe", wow.GetValue("InstallPath").ToString()), false);
File.Delete(String.Format("{0}WoW.exe", wow.GetValue("InstallPath").ToString()));
}
else if(File.Exists(String.Format("{0}Wow.exe", wow.GetValue("InstallPath").ToString())))
{
File.Copy(String.Format("{0}Wow.exe", wow.GetValue("InstallPath").ToString()), String.Format("{0}Wow_zaloha_Awrodar_old_file.exe", wow.GetValue("InstallPath").ToString()), false);
File.Delete(String.Format("{0}Wow.exe", wow.GetValue("InstallPath").ToString()));
}
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
MD5 md5 = new MD5CryptoServiceProvider();
byte[] retVal = md5.ComputeHash(fs);
fs.Close();
StringBuilder sb = new StringBuilder();
foreach(byte b in retVal)
sb.Append(string.Format("{0:X2}", b));
if(ex[2] == sb.ToString())
proceed = false;
}
}
else
{
if(File.Exists(MPQpath))
{
FileStream fs = new FileStream(MPQpath, FileMode.Open, FileAccess.Read, FileShare.Read);
MD5 md5 = new MD5CryptoServiceProvider();
byte[] retVal = md5.ComputeHash(fs);
fs.Close();
StringBuilder sb = new StringBuilder();
foreach(byte b in retVal)
sb.Append(string.Format("{0:X2}", b));
if(ex[2] == sb.ToString())
proceed = false;
}
}
請詳細說明「不工作」?這實際上並沒有告訴我們問題是什麼。 – 2012-02-22 20:08:07