S
Steve Ricketts
I have an application that uses one of a selection of about five .dll's
depending on the user's environment. Each .dll has the same methods and
properties but in this case, uses a different video player. The application
is a conversion from VB6 where the dll name was read from the registry and a
generic object created so the program didn't have to change references to
the object's objects and methods... something like:
videoPlayer = GetString(HKEY_LOCAL_MACHINE, "Software\Velocedge",
"VideoPlayer")
Set videoCtl = CreateObject(videoPlayer)
call videoCtl.PlayerBegin(theURL)
Where video player could be one of:
- dlVideo.clsVideo (windows media)
- dlVideo.clsVideoV (VLC)
- dlVideo.clsVideoH (Helius)
- dlVideo.clsVideoMP (MPlayer)
- dlVideo.clsVideoF (Flash)
This allowed us to simply change the registry value and the application
would use another .dll to (in this case) play video. In the typical user's
case, they would only have one or two of the different types of video
players installed on their computer so we wouldn't want to load a .dll for a
player that didn't exist.
So, my question is, what is the best way to do a similar thing in C#? I've
thought about doing something like:
using dlVideo;
using dlVideoV;
using dlVideoH;
using dlVideoMP;
using dlVideoF;
switch (videoPlayer) {
case dlVideo.clsVideo:
videoCtl = new dlVideo();
break;
case dlVideo.clsVideoV
videoCtl = new dlVideoV();
break;
case dlVideo.clsVideoH
videoCtl = new dlVideoH();
break;
....
}
videoCtl.PlayerBegin(theURL);
But my guess is that there is a much better way. Thanks for any direction
you can provide.
sr
depending on the user's environment. Each .dll has the same methods and
properties but in this case, uses a different video player. The application
is a conversion from VB6 where the dll name was read from the registry and a
generic object created so the program didn't have to change references to
the object's objects and methods... something like:
videoPlayer = GetString(HKEY_LOCAL_MACHINE, "Software\Velocedge",
"VideoPlayer")
Set videoCtl = CreateObject(videoPlayer)
call videoCtl.PlayerBegin(theURL)
Where video player could be one of:
- dlVideo.clsVideo (windows media)
- dlVideo.clsVideoV (VLC)
- dlVideo.clsVideoH (Helius)
- dlVideo.clsVideoMP (MPlayer)
- dlVideo.clsVideoF (Flash)
This allowed us to simply change the registry value and the application
would use another .dll to (in this case) play video. In the typical user's
case, they would only have one or two of the different types of video
players installed on their computer so we wouldn't want to load a .dll for a
player that didn't exist.
So, my question is, what is the best way to do a similar thing in C#? I've
thought about doing something like:
using dlVideo;
using dlVideoV;
using dlVideoH;
using dlVideoMP;
using dlVideoF;
switch (videoPlayer) {
case dlVideo.clsVideo:
videoCtl = new dlVideo();
break;
case dlVideo.clsVideoV
videoCtl = new dlVideoV();
break;
case dlVideo.clsVideoH
videoCtl = new dlVideoH();
break;
....
}
videoCtl.PlayerBegin(theURL);
But my guess is that there is a much better way. Thanks for any direction
you can provide.
sr