Game Development Reference
In-Depth Information
{
Console.WriteLine(String.Format(“Handle Command '{0}':”, command));
Console.WriteLine(“—-”);
foreach (string file in files)
{
Console.WriteLine(file);
}
}
}
}
For the most part, the extension code can stay the same. We will, however, modify
the method that handles menu commands so that it points to the static logic class
for the tool. The fromExtension parameter for SimpleTool.ProcessFiles() is set to
true so that a message box is shown instead of writing the messages to the console.
There is no console when executing the standalone extension.
protected override void HandleCommand(string command, string[] files)
{
SimpleTool.ProcessFiles(command, files, true);
}
As an example, we will create a simple console application. You can pass it several
files as command-line arguments, or you can use a switch to register or unregister
the shell extension with the operating system. The fromExtension parameter for
SimpleTool.ProcessFiles() is set to false so that the messages are written to the
console.
class Program
{
static int Main(string[] args)
{
Console.WriteLine(“SimpleTool.exe - Simple demo to show “ +
“how to link a tool to a shell extension.”);
if (args.Length == 1)
{
string option
= args[0].Replace('-', '/').ToLower(CultureInfo.InvariantCulture);
if (option == “/?” || args[0] == “/help”)
{
Search Nedrilad ::




Custom Search