Your reply makes sense. I am not too sure about how to make threads in my my code, and also how do you create an index of your own (similar to Windows)?
Keeping with the KISS mentality and without getting into intricate details about threads, here is some sampler code:
-
object object1 = new object();
-
int object2 = 0;
-
string object3 = "";
-
List<object> objects = new List<object>();
-
objects.Add(object1);
-
objects.Add(object2);
-
objects.Add(object3);
-
Thread t = new Thread(new ParameterizedThreadStart(SomeFunction));
-
t.Start(objects);
-
... somewhere else in your code
-
static void SomeFunction(object parameters)
-
{
-
List<object> objects = (List<object>)parameters;
-
object someObject = objects[0];
-
int someInt = (int)objects[1];
-
string someString = (string)objects[2];
-
-
// do stuff
-
}
-
There is another version of a thread you can call without the parameter if you didnt want to pass something. In your case you would probably pass a folder or multiple folders for that thread to handle.
The problem with you creating an index is that you will need to watch the folders for changes which will be doing much the same thing as you are doing now every time the program restarts. If you can afford to have the program watch the folders indefinitely you could just have it use a FileSystemWatcher and any time a file/folder updates, deletes, or gets added you update your index.
For the index I would suggest SQL if it is going to be sufficiently large, XML if it is smaller.