2012-02-22 3 views
0

私は小さなものに問題があります。私は自動アップデータをコーディングしています。私は.exeファイルをダウンロードすると、メインディレクトリに配置したいと思います。ファイル名がdir dontになっていれば

FILE.EXE =ここで私はメインディレクトリに場所をダウンロードしているそうで サブディレクトリへ=場所...それが働いてイマイチ、保証するために、パス操作に使用Path.Combineメインディレクトリに

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; 
    } 
} 
+2

「動作していません」について詳しく教えてください。それは本当に問題が何であるか教えてくれません。 –

答えて

0

をすべてを置きますファイル名の正確さ。それ以外では、あなたのコードに何が間違っているのか分かりません。あなたの問題の原因となっている行を調べるために、トレースしましたか?

関連する問題