Game Development Reference
In-Depth Information
}
catch (Exception e)
{
MessageBox.Show(exception.ToString());
}
}
}
Standalone shell extensions exist as separate assemblies. This is ideal for extensions
that contain the actual tool logic, or for extensions that cannot be integrated into
the source code of an existing tool.
Sample Usage—Integrated
If you are able to modify the source code to your tool and if it is managed code,
you can integrate the shell extension right into the code base. There are a number
of benefits to this approach, but the most important is ease of deployment.
To start, we generally want to keep the logic called by the extension and the logic
called by the tool in the same location for maintainability. The following code imple-
ments a simple class that processes a collection of files using a specified command.
public static class SimpleTool
{
public static void ProcessFiles(string command,
string[] files,
bool fromExtension)
{
if (fromExtension)
{
StringBuilder buffer = new StringBuilder();
buffer.AppendLine(String.Format(“Handle Command '{0}':”, command));
buffer.AppendLine(“—-”);
foreach (string file in files)
{
buffer.AppendLine(file);
}
System.Windows.Forms.MessageBox.Show(buffer.ToString());
}
else
Search Nedrilad ::




Custom Search