示例#1
0
        //Recursive Scan Method
        private void RecScan()
        {
            //Enable Analyze Button
            this.Button_Analyze.Enabled = true;

            //Enable Remove Button
            this.Label_Remove.Enabled = true;

            //Clear Global Files List
            GlobalFilesList.Clear();

            //Set Flag
            RecursiveFlag = true;

            //Init Labels
            this.Label_Selection_Extensions.Text = "Extensions ";
            this.Label_Selection_Files.Text      = "Files ";
            this.Label_Mode.Text = "Mode ";

            //Scanning
            this.Label_Folder_Files.Text = "Files Scanning...";
            this.Label_Extensions.Text   = "Extensions Scanning...";
            this.Label_Folders.Text      = "Folders Scanning...";
            this.Label_Mode.Text         = "Mode Recursive Scan";

            //Clear CheckList
            this.Checklist_Types.Items.Clear();
            RecExtensionList.Clear();

            int RecFilesCount = 0;

            //Recursive Scan
            try
            {
                string[] Files = Directory.GetFiles(SelectedFolderPath, "*", SearchOption.AllDirectories);

                foreach (string File in Files)
                {
                    GlobalFilesList.Add(File);
                    RecFilesCount++;
                    string FileExtension = Path.GetExtension(File);
                    if (RecExtensionList.Contains(FileExtension) == false)
                    {
                        RecExtensionList.Add(FileExtension);
                    }
                }
            }

            catch
            {
                MessageBox.Show
                (
                    "Exception:"
                    + Environment.NewLine +
                    "- - - - - - -"
                    + Environment.NewLine +
                    "Types Filter encountered access violation."
                    + Environment.NewLine +
                    "To avoid this problem, narrow down the search to a specific directory."
                    ,
                    "Types Filter"
                );
            }

            //Scan Folders
            int FoldersCount = 0;

            try
            {
                string[] Folders = Directory.GetDirectories(SelectedFolderPath, "*", SearchOption.AllDirectories);

                foreach (string Folder in Folders)
                {
                    FoldersCount++;
                }
            }

            catch { /* Pass */ }

            //Add to CheckList
            int RecItemsCount = 0;

            foreach (string RecItem in RecExtensionList)
            {
                this.Checklist_Types.Items.Insert(RecItemsCount, RecItem); RecItemsCount++;
            }

            //Set Folder Information
            Label_Folders.Text      = "Folders " + (FoldersCount).ToString();
            Label_Folder_Files.Text = "Files " + (RecFilesCount).ToString();
            Label_Extensions.Text   = "Extensions " + (RecExtensionList.Count()).ToString();
            if (RecursiveFlag == false)
            {
                this.Label_Mode.Text = "Mode Non Recursive";
            }
            else
            {
                this.Label_Mode.Text = "Mode Recursive";
            }

            //Enable Remove Button
            this.Label_Remove.Enabled = true;

            //Init Mode
            this.Label_Mode.Text = "Mode ";
        }
示例#2
0
        //Scan Method
        private void Scan()
        {
            //Enable Analyze Button
            this.Button_Analyze.Enabled = true;

            //Clear Global Files List
            GlobalFilesList.Clear();

            //Set Flag
            RecursiveFlag = false;

            //Init Labels
            this.Label_Selection_Extensions.Text = "Extensions ";
            this.Label_Selection_Files.Text      = "Files ";

            //Scanning
            this.Label_Folder_Files.Text = "Files Scanning...";
            this.Label_Extensions.Text   = "Extensions Scanning...";
            this.Label_Folders.Text      = "Folders 1";
            this.Label_Mode.Text         = "Mode: Scan";

            //Clear CheckList
            this.Checklist_Types.Items.Clear();
            ExtensionList.Clear();

            //Scan
            string[] Files = Directory.GetFiles(SelectedFolderPath);

            //Unique Extensions Added to Extenstion List
            try
            {
                foreach (string File in Files)
                {
                    GlobalFilesList.Add(File);
                    string FileExtension = Path.GetExtension(File);
                    if (ExtensionList.Contains(FileExtension) == false)
                    {
                        ExtensionList.Add(FileExtension);
                    }
                }
            }

            catch { }

            //Add to CheckList
            foreach (string Extension in ExtensionList)
            {
                this.Checklist_Types.Items.Add(Extension);
            }

            //Set Folder Information
            Label_Folder_Files.Text = "Files " + (Files.Count()).ToString();
            Label_Extensions.Text   = "Extensions " + (ExtensionList.Count()).ToString();
            if (RecursiveFlag == false)
            {
                this.Label_Mode.Text = "Mode Non Recursive";
            }
            else
            {
                this.Label_Mode.Text = "Mode Recursive";
            }

            //Enable Remove Button
            this.Label_Remove.Enabled = true;

            //Init Mode
            this.Label_Mode.Text = "Mode ";
        }