Sunday, September 22, 2013

Infected Drive Recovery

As for our USB drive, flash drive, external drive or even the hard drive can be affected by some sort of virus that could hide your file even though you've tried to use "folder option > show hidden file" or it deletes your file even though in consumes the remaining memory spaces. I'm using C# to program and to recovery hidden files.


Here, I provided you a video just to be clear


Codes down here


First, you must use the System.Diagnostics to make this program run.

This is the code for the button:

if (textBox1.Text != "")
            {
                errorProvider1.Clear();
                newprocess.StartInfo.UseShellExecute = false;
                newprocess.StartInfo.CreateNoWindow = true;
                newprocess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                newprocess.StartInfo.FileName = "attrib";
                newprocess.StartInfo.Arguments = "-a -r -s -h " + textBox1.Text + ":* /s /d";
                try
                {
                    using (Process exeProcess = Process.Start(newprocess.StartInfo))
                    {
                        exeProcess.WaitForExit();
                        done.Show();
                        textBox1.Text = "";
                    }
                }
                catch
                {
                    //Nothing
                }
            }
            else
            {
                errorProvider1.SetError(textBox1,"Insert Drive Letter");
            }

This is the code for keychange in textbox:


            e.Handled = !(char.IsLetter(e.KeyChar) || e.KeyChar == (char)Keys.Back);

Enjoy!!

4 comments: