WipeFile() public méthode

Deletes a file in a secure way by overwriting it with random garbage data n times.
public WipeFile ( string filename, int timesToWrite ) : void
filename string Full path of the file to be deleted
timesToWrite int Specifies the number of times the file should be overwritten
Résultat void
        private void StartShredding()
        {
            btnShreddingEnable = true;
            Wipe wiper = new Wipe();
            wiper.WipeErrorEvent += Wiper_WipeErrorEvent;
            wiper.PassInfoEvent += Wiper_PassInfoEvent;
            wiper.SectorInfoEvent += Wiper_SectorInfoEvent;
            wiper.WipeDoneEvent += Wiper_WipeDoneEvent;
            foreach (Model_Shred MdlShared in ShredFilesCollection)
            {

                string full_param = string.Empty;
                if (MdlShared.FilePath != "Recycle Bin")
                {
                    FileAttributes attr = File.GetAttributes(MdlShared.FilePath);
                    if (attr.HasFlag(FileAttributes.Directory))
                    {
                        this.ProgressText = "Started to Shred Folder" + MdlShared.FilePath + " Please Wait.";
                        foreach (string file in Directory.EnumerateFiles(MdlShared.FilePath, "*.*", SearchOption.AllDirectories))
                        {
                            this.ProgressText = "Started to Shred File " + file + " inside folder " + MdlShared.FilePath +
                                                " Please Wait.";
                            wiper.WipeFile(file, 2);
                        }
                        Directory.Delete(MdlShared.FilePath, true);
                    }
                    else
                    {
                        this.ProgressText = "Started to Shred File " + MdlShared.FilePath + " Please Wait.";
                        wiper.WipeFile(MdlShared.FilePath, 2);
                    }
                }

                this.ProgressIndex++;
            }
            if (btnShredRecycleBinEnable)
            {
                this.ProgressText = "Started to Shreding recyclebin please Wait.";

                Thread.Sleep(2000);
                foreach (string file in Directory.EnumerateFiles("C:\\$RECYCLE.BIN", "*.*", SearchOption.AllDirectories)
                    )
                {
                    this.ProgressText = "Started to Shred File " + file + " please Wait.";
                    wiper.WipeFile(file, 2);
                }
            }


            btnShreddingEnable = true;
            this.ProgressText = "Shredding is done.";
        }