Esempio n. 1
0
        public ViewModel_Shred()
        {
            this.WindowTitle = "Shred File & Folder";

            if (base.IsInDesignMode)
            {
                this.Log = "Starting to shred\r\nC:\\Windows\\win.com";
            }
            else
            {
                Command_ShredFile = new RelayCommand(() => Command_ShredFile_Click());
                Command_ShredFolder = new RelayCommand(Command_ShredFolder_Click);
                Wipe wipe = new Wipe();
                
            }
        }
Esempio n. 2
0
        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.";
        }