Beispiel #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……
         }
     }
 }
Beispiel #2
0
        private void LabelPath_DragDrop(object sender, DragEventArgs e)
        {
            var list = (String[])e.Data.GetData(DataFormats.FileDrop);

            if (list.Length == 1)
            {
                if (AdvancedDeletion.IsExists(list[0], out var b))
                {
                    Path = list[0];
                    StatusChange(Status.Dropped, Path);
                    return;
                }
                else if (b && FPForm.ShowDialog(this) == DialogResult.OK)
                {
                    Path = list[0] + FPForm.Dots;
                    if (AdvancedDeletion.IsExists(Path, out b))
                    {
                        StatusChange(Status.Dropped, Path);
                        return;
                    }
                }
            }
            StatusChange();
        }
Beispiel #3
0
 private void BackgroundWorkerDel_DoWork(object sender, DoWorkEventArgs e)
 {
     AdvancedDeletion.Delete(Path);
 }