MissileSharp is a .NET library to control an USB Missile Launcher.
(There is also a demo app called the MissileSharp Launcher)
For now it supports only one model, the Dream Cheeky Thunder, as this is the only one I own.
(I'm in Germany, and I bought my missile launcher from a German shop...but it seems to be the exact same model as the Dream Cheeky Thunder.)
You can either download MissileSharp from the download page on GitHub (link above) or install with NuGet:
The control software that came with the missile launcher is not needed at all.
Just connect the device to your machine, and Windows should automatically recognize it. That's enough for MissileSharp to control it.
The main class of MissileSharp is the
It has only one constructor, which expects a parameter of the type
ILauncherModel - these are the settings for the different missile launcher models.
(As MissileSharp only supports one model at the moment, you can only pass a
ThunderMissileLauncher for now)
Create a new
var launcher = new CommandCenter(new ThunderMissileLauncher());
You can also use the
LauncherModelFactory if you don't want to create an instance of the
ThunderMissileLauncher class directly, e.g. to get the model from a config file:
var launcherModel = LauncherModelFactory.GetLauncher("MissileSharp.ThunderMissileLauncher"); var launcher = new CommandCenter(launcherModel);
Then, you can start sending commands to the device.
There are three different types of commands:
You can use these commands as methods of the
launcher.Reset(); // reset to bottom left launcher.Right(1000); // turn right 1000 milliseconds launcher.Up(500); // move up 500 milliseconds launcher.Fire(2); // fire 2 missiles
This is also available as a fluent interface:
Instead of directly calling the methods, you can also pass a complete sequence of commands at once as an
LauncherCommand consists of an enum value (e.g.
Command.Fire - exactly the same commands as explained above) and a numeric parameter (for either the duration or the number of shots).
The following code does the same as the previous example, but creates and executes a
List<LauncherCommand> instead of directly calling
var commands = new List<LauncherCommand>(); commands.Add(new LauncherCommand(Command.Reset, 0)); commands.Add(new LauncherCommand(Command.Right, 1000)); commands.Add(new LauncherCommand(Command.Up, 500)); commands.Add(new LauncherCommand(Command.Fire, 2)); launcher.RunCommandSet(commands);
MissileSharp supports loading command sets from a config file as well.
A config file with the commands from the examples above would look like this:
[Steve] reset,0 right,1000 up,500 fire,2
You can save several of these command sets in the same file, each one under its own name (in this case, "Steve").
Lines beginning with
# will be ignored and can be used for comments.
First, you have to load the file once:
After that, you can execute any of the command sets by referring to the name:
launcher.RunCommandSet("Steve"); // shoot Steve
If you want to see a simple but complete example, there is a demo console application in the code (not in the releases).
Look at the code and the config file.
For a more complex demo application, take a look at the MissileSharp Launcher:
MissileSharp Launcher is a WPF application, which uses MissileSharp to do exactly what is described in the "Config files" section above:
On startup, it automatically loads command sets from a settings file and displays a button for each available command set. You can run the command sets by clicking the respective button.
Using the config file from the previous example, it looks like this:
You can edit the settings file at runtime with these two buttons:
The left one opens the settings file for editing.
After editing, click the right button to re-load the settings from the file.
Download a zip file with the binaries
At the moment, MissileSharp Launcher always uses the Thunder Missile Launcher model (hardcoded in
app.config), but that will be changed when MissileSharp supports more than one model.
build.bat in the main folder. This will create a new folder named
release with the compiled assembly.
build-release.bat to create a NuGet package and a zip file (all in the
release folder) as well.
Thanks to Chris Dance for the inspiration to this, especially his blog post Who broke the build? which made me want to buy my own missile launcher and write a library for it.
MissileSharp makes use of the following open source projects:
MissileSharp is licensed under the MIT License. See License.txt for details.