Click here to Skip to main content
13,762,671 members
Click here to Skip to main content
Add your own
alternative version

Stats

9.8K views
29 bookmarked
Posted 21 Apr 2018
Licenced CPOL

File Explorer Clone with Tabs and Parallel File Search Tool

, 21 Apr 2018
Rate this:
Please Sign up or sign in to vote.
This article shows how to use Winforms, WPF and C# to create a File Explorer Clone with Tabs and an extremely fast parallel file search utility.

Introduction

This article shows how to use Winforms, WPF, C# to create a File Explorer Clone with Tabs that include an extremely fast parallel file search utility. I use this File Explorer to create, and organize, repositories of three types of things: C# WPF projects that automate redundant computer tasks; Knowledge Bases; and ToDoLists.

Here is a screenshot of the File Explorer Clone in List View:


(Click to enlarge)

Here is a screenshot of the File Explorer Clone in Details View:


(Click to enlarge)

Background

My original goal was to automate problem-solving itself, but in the process of trying to do that, I ended up creating a clone of File Explorer. I wanted to automate problem-solving because I saw a general pattern and because most of my programming time is spent performing problem-solving tasks.

Here is the general pattern, or algorithm, that can be used to solve any problem:

A problem arises when there is a "gap" between the Actual and the Ideal.

  1. The first step to solving the problem is to compare the Actual to the Ideal and find the differences.
  2. Once the differences have been identified, we need to translate those differences into Actions that we know how to perform.
  3. Once the Differences have been translated into Actions, we perform those actions on the Actual in order to transform it into the Ideal.

Artificial Intelligence uses the above steps to solve problems. AI has a knowledge base of actions it knows how to perform, and it uses those actions to remove the differences between the way something actually is and the way it ideally should be.

A knowledge base can be used to store the translations between our understanding of something (represented in human language) and the computers understanding (scripts written in computer language). The knowledge base serves as a key-value pair dictionary, with the human language as the "key" and the script in computer language as the ultimate "value."

In the same way that Google maps finds the shortest distance between two locations, AI uses the knowledge base to determine the fewest actions needed to be performed in order to transform the actual problem state into the ideal solution state.

What I originally wanted to do was to create an application that would do the above problem-solving steps for me, but this proved to be too complicated. As a result, I settled for writing many little C# WPF applications that would automate little things that I knew how to do. After writing quite a few of these little C# WPF applications, I realized that I needed an easy way to put these little action scripts into some sort of knowledge base and launch them with hotkeys.

This is what led me to create this clone of File Explorer that has tabs. I decided to add tabs to my File Explorer clone because I do not like the way File Explorer requires you to open up a different instance of File Explorer every time you want to look at a different folder. The tabs also provide the benefit of allowing you to save where you are in multiple file explorers so that you can come back to it later.

In order to categorize information in a knowledge base, you need to be able to create categories and subcategories in addition to just having folders. The difference between categories/subcategories and regular folders is that categories/subcategories allow you to persist what you have expanded/closed when you leave the folder structure while folders do not.

I soon realized that I often like to edit or view files on the fly without exiting the file explorer clone, and this is what led me to create the preview mode.


(Click to enlarge)

Search is another important feature in any knowledge base, so I added a search icon that does a parallel search in the background when clicked. Search allows you to find all instances of string or regular expression in text, word, or open office files included within all of the subfolders of a parent folder. You can use a hotkey to navigate to the particular line in the result in a file or to open a new tab in the File Explorer clone that points to the immediate parent folder of the file that contains the text that was found.


(Click to Enlarge)

In order to add hotkeys, metadata, and other functionality to the folders/files, I added a context menu when the user right-clicks on the folder/file.

Using the Code

The easiest way to get started is to just download the executable. However, if you download the source code, you will find that it contains a number of solutions and projects. These solutions and projects demonstrate several of the things that you can automate and use the file explorer clone to do. Since this article is only focusing on the file explorer clone, the solution that you will want to build is the one called IdealAutomateExplorer.

The IdealAutomateExplorer solution consists of three projects: dgFilterPopup; IdealAutomateExplorer; and IdealSqlTracer.

dgFilterPopup is an excellent library that allows one to add filtering capabilities to the datagridview. I did not write this project, and I am greatly indebted to Vincenzo Rossi for sharing information about this library in his superb CodeProject article. Here is a screenshot of the features that this library adds to the File Explorer clone:

The second project in the IdealAutomateExplorer solution is the IdealAutomateExplorer project. The main page in this project is the ExplorerView.cs page. This page contains the tabControl. Inside each tabPage in the tabControl, there is a splitContainer. Panel1 of the splitContainer is used to hold the datagridview for the folder of the current tab. Panel2 is used in preview mode to display the file that has been selected in the datagridview. Wordpad is used to open any Word type documents because Wordpad is a free tool that should be on everyone's computer whereas Word is not.

The third project in the solution is IdealSqlTracer. IdealSqlTracer can be accessed from the Tools/Sql/IdealSqlTracer menu option. IdealSqlTracer provides you with an alternative to SqlProfiler that allows you capture all of the SQL behind any desktop or web application. One nice feature of IdealSqlTracer is that it takes the captured SQL and formats it so that it is easy to read. There is plenty of documentation in the help screens to learn more about this powerful tool.

Points of Interest

There are two places where information is stored for this application to allow it to be persisted when the application is closed.

The first place is in the file directory structure itself. Whenever you add a category or a subcategory, information about whether that category/subcategory is expanded is placed in a folder that has the name... IdealAutomate.

The second place information is kept is in the roaming directory. On my computer, the name of this folder is C:\Users\harve\AppData\Roaming\IdealAutomate\IdealAutomateExplorer, but the name on your computer will be slightly different. There are methods called SetValueByKey and GetValueByKey that are used to put information into this roaming folder and to retrieve it from there.

History

  • 4-21-2018: Originally submitted for publication

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Wade Harvey
Software Developer IdealProgrammer.com
United States United States
No Biography provided

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionMany images are missing Pin
Mou_kol11-Jun-18 21:28
memberMou_kol11-Jun-18 21:28 
QuestionLike looking in a mirror 'cept you're a shrink Pin
Mitchster25-May-18 6:43
memberMitchster25-May-18 6:43 
AnswerRe: Like looking in a mirror 'cept you're a shrink Pin
Wade Harvey9-Jul-18 3:53
memberWade Harvey9-Jul-18 3:53 
QuestionSpam Pin
Member 1379700324-Apr-18 22:09
memberMember 1379700324-Apr-18 22:09 
QuestionMany code Pin
LightTempler22-Apr-18 10:12
memberLightTempler22-Apr-18 10:12 
AnswerRe: Many code Pin
Member 244330622-Apr-18 13:34
memberMember 244330622-Apr-18 13:34 
AnswerRe: Many code Pin
TheNexpert11-May-18 1:47
memberTheNexpert11-May-18 1:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06-2016 | 2.8.181112.3 | Last Updated 22 Apr 2018
Article Copyright 2018 by Wade Harvey
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid