I have a program that i developed to use a basic plugin architecture. Effectively, when the program loads it uses reflection to search the directory for dll's that fit a certain interface and then loads them. It now appears that the current list of plugins is all that will be used.
Therefore, is my current practise of check the dll files still the best practise, or are there better ways to load each dll?
Thanks.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr. Stroustroupe.
C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.
C is more difficult to learn than JavaScript, but it's a valuable skill to have because most programming languages are actually implemented in C. This is because C is a “machine-level” language. So learning it will teach you how a computer works and will actually make learning new languages in the future easier.
From your question it looks like you've built (or are trying to build) your own kind of plugin architecture. Its not such a good idea since .NET already has what you're looking for.
.NET comes with 2 ways to allow plugins.
(1) System.Addin - I've barely heard/read much about it. But you can take a look at a few articles here:
System.Addin article from MSDN magazine <- Note the Year 2007
System.Addin tools and examples at Codeplex
(2) Now, MEF, MEF is just awesome! Its a great and easy way to introduce a plugin architecture into your system. MEF is also a part of Silverlight and Visual Studio 2010 uses it. I can see you want to load dlls with plugins dynamically, with MEF you can design your app in such a way the classes you package with your software can be in your own assembly (.exe) and then you can use MEF to dynamically look for dlls in the future that will have classes that you need. The whole procedure itself is very simple in MEF.
Mike Taulty has a brilliant video series on MEF
MEF Article at Codeproject - Part 1 MEF Article at Codeproject - Part 2
MEF is Open Source on Codeplex
I personally think you should go with MEF, its new, easy and even visual studio uses it, even so you can take a look at:
Choosing between MEF and MAF (System.AddIn)
Do check out other top voted questions on the mef tag at SO
You can use the FileSystemWatcher class to monitor a directory for changes.
publicvoid CreateWatcher()
{
//Create a new FileSystemWatcher.
FileSystemWatcher watcher = newFileSystemWatcher();
//Set the filter to only catch DLL files.
watcher.Filter = "*.dll";
//Subscribe to the Created event.
watcher.Created += new
FileSystemEventHandler(watcher_FileCreated);
//Set the path to C:\Temp\
watcher.Path = @"C:\Temp\";
//Enable the FileSystemWatcher events.
watcher.EnableRaisingEvents = true;
}
Then it becomes a plug and play affair :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With