Esempio n. 1
0
 static void Main(String[] args)
 {
     using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, "790586ef-8565-4f70-9aa6-639b9c6c25db", out var createNew))
     {
         if (createNew)
         {
             if (args.Length > 0)
             {
                 var hasDeleted = false;
                 Parallel.ForEach <String>(args, item => {
                     if (AdvancedDeletion.IsExists(item, out var hasDot))
                     {
                         hasDeleted = true;
                         AdvancedDeletion.Delete(item);
                     }
                 });
                 if (hasDeleted)
                 {
                     using (var sound = new SoundPlayer(Registry.CurrentUser.OpenSubKey(@"AppEvents\Schemes\Apps\Explorer\EmptyRecycleBin\.Current", false).GetValue(null) as String))
                     {
                         sound.PlaySync();
                     }
                 }
                 return;
             }
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             Application.Run(new FormMain());
         }
         else
         {
             Environment.Exit(1);//It's not required but can send system a non-normal exit signal……
         }
     }
 }
Esempio n. 2
0
 private void BackgroundWorkerDel_DoWork(object sender, DoWorkEventArgs e)
 {
     AdvancedDeletion.Delete(Path);
 }