Esempio n. 1
0
        // populate drive listbox with drive details
        public void FillDrives()
        {
            //get list of drives by calling static method ScanDrives
            IEnumerable <DriveInfo> lDrives = CDriveDetails.ScanDrives();

            //clear listbox if it has current data
            if (lsbDriveName.HasItems)
            {
                lsbDriveName.Items.Clear();
            }

            //add heading to list box which displays available drives
            lsbDriveName.Items.Add(new TextBlock().Text = "Drive List");
            foreach (var iEListDrives in lDrives)
            {
                //add each drive name to the listBox
                lsbDriveName.Items.Add(new ListBoxItem().Content = iEListDrives.Name);
            }
        }
Esempio n. 2
0
        }//id:0.1

        //Attempt to Recover files hidden by the shortcut virus
        private void BtnFix_Click(object sender, RoutedEventArgs e)
        {
            if (lsbDriveName.SelectedIndex >= 0)                      //check if an item was selected
            {                                                         //id:if 2.3
                itcProcessTrace.Items.Clear();                        //clear Item Content control that displays processing data
                Stack <string> subFoldersList = new Stack <string>(); //contains stack list of subfolders empty initially

                //declared variable gets directory listing to the drive selected initially
                DirectoryInfo directoryList = new DirectoryInfo(lsbDriveName.SelectedValue.ToString());


                CDriveDetails.FileRecover(directoryList, ref subFoldersList);   //make initial call to method to recover files pass drive letter and an empyy stack
                do
                {
                    if (subFoldersList.Count > 0) //check if the sub directory stack has data from previous call
                    {
                        //recall the FileRecover Method passing the stack: subFolderList and popping the top item and using it as the root directory
                        CDriveDetails.FileRecover((new DirectoryInfo(subFoldersList.Pop())), ref subFoldersList);
                    }
                } while (subFoldersList.Count > 0); //process loop until the stack becomes zero or less
            }//id:if 2.3
        }
Esempio n. 3
0
        //called when selection changed
        private void lsbDriveName_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {//id: 1
            Dictionary <String, String> driveDetails = new Dictionary <string, string>();

            if (itcDriveDetails.HasItems)      //check if any items is currently in the Itemcontrol
            {
                itcDriveDetails.Items.Clear(); //clear current list items
                itcProcessTrace.Items.Clear(); //clear Item Content control that displays processing data
            }

            //get list of Drive information
            if (lsbDriveName.HasItems)
            {
                //get a list of drives available on the current system.
                driveDetails = CDriveDetails.GetDriveDetails <String>(lsbDriveName.SelectedValue.ToString());

                foreach (var i in driveDetails) //traverse dictionary and store each traversed items in i
                {
                    itcDriveDetails.Items.Add(i.Value);
                }
            }
            //CDriveDetails.FileRecover(lsbDriveName.SelectedValue.ToString());
        }//id:1