Click here to Skip to main content
12,552,693 members (61,322 online)
Click here to Skip to main content
Add your own
alternative version


44 bookmarked

BBuilder: Open Source Batch Builder

, 1 Nov 2007 BSD
Rate this:
Please Sign up or sign in to vote.
An article on BBuilder - Open Source Batch Builder
Screenshot - BBuilder1.png


One day my friend told me he needed to change his way of releasing builds. It meant he had to fix a batch to compile and publish several products. Such a process can be tedious since it has to be very reliable and you have to remember all the required DOS commands. Each step of a batch is in fact a command that can be accomplished in pure DOS or executing external executable files. So I thought it would be cool to make a batch editor in the following way:

  1. Choose a command from a toolbox
  2. Support re-ordering
  3. Save it to disk for further use
  4. Visualize all commands in a simple way
  5. Enable adding custom tools as plug-ins
  6. Test the batch before it goes somewhere (Scheduled Tasks) with optimizations

Obviously, I had an application in mind that had a toolbox to drop the commands on a batch document form. Something with an Outlook Look and Feel (OLAF). This way, we could easily edit/move up, down/delete the items. What if someone needs to use a custom command in his batch process?

Let's say, my friend needed to Compile (with a .NET compiler) and publish his work to several directories. It implied Restarting some IIS service and backing-up the old version before anything. Sending an email to his team to tell them to take the coffee break while he is uploading a new version. They would get an alert after the version was successfully uploaded and passed an automated crash test. All these steps in the process could be broken to atomic operations like: Compile, Backup, Restart Services, Copy, Send Email, etc … but it seems that limiting the toolbox to our development would be a mistake since each one of us needs some other operations. I decided to build the toolbox in a way that developers would add their own tools. The plug-in mechanism. Since I love programming in .NET (C#), I started to code my platform for plugging using reflection.


The article describes a simple way of creating a flexible application, following the architecture below:

Screenshot - BBuilder2.png

Figure 1: The plug-in model

Screenshot - BBuilder3.png

Figure 2: The plug-in into work

The Contract

The platform doesn't know the plug-in collection itself. But it surely knows the interface BBuilder.Interface. On load the application loads all the assemblies that implement BBuilder.Interface.

The "Contract" is divided by two parts:

  • The visual contract — A UserControl (ActionPanelControl) that defines all the defaults and UI validations
  • The functional contract — An interface (IActionPanel) that defines the real logic of the plug-in: The way it generates the command line.

Screenshot - BBuilder4.png

Is Reflection "Black Magic"?

A factory is used to provide an instance of the desired assembly; it uses reflection.

public IActionPanel GetInstanceOfPlugin(string type,string assemblyPath)
    if (!dictPlugins.ContainsKey(type))
      dictPlugins.Add(type, LoadPluginAssembly(assemblyPath));
    return Activator.CreateInstance(
      dictPlugins[type].GetType(type)) as IActionPanel;

Using the Code

This tutorial should allow you to add a new plug-in named "Search" within a few steps:

  1. Make a new project as "Class Library", name it "BBuilder.Plugins.Search"
  2. Add a new item as user control
  3. Name it for example, "Search.cs"
  4. Add a new item as resource file
  5. Rename it "Resource.resx"
  6. Double click on "Resource.resx". Add an Image resource named "Search".
  7. Click on the Search image and go to Properties (F4)
  8. Change persistence to 'Embedded in .resx', then Save and Close.
  9. Add a reference to BBuilder.Interface DLL
  10. In Search.cs — Change to the following lines:
  11. using BBuilder.Interface;
    namespace BBuilder.Plugins.Search
        public partial class Search : ActionPanelControl,IActionPanel
            public Search()
            #region IActionPanel Members
            public string Category
                get { return "BBuilder"; }
            public string AuthorName
                get { return "Breeback\nDownload updates at" + 
                    ""; }
            public string ImageKey
                get { return "Search"; }
            public string ActionName
                get { return "Search Files and Folders"; }
            public string Description
                get { return "search for files and folders"; }
            public string CommandLine
                get { return "echo my commandline goes here"; }
            public System.Drawing.Bitmap Image
                    return Resource.Search;
            public string Serialize()
                // need to return an encoded string for saving the action
                // to file
                return "";
            public void Deserialize(string strPanel)
                // need to decode the expected string to the settings of
                // the plugin
  12. Compile the Project
  13. Copy "BBuilder.Plugins.Search.dll" to "C:\Program Files\Breezback\BBuilder\Plugins"

Points of Interest

  1. Reflection for a flexible application
  2. Factory and Singleton design patterns
  3. IComparer implementation to generate a custom order
  4. Creating a windows application in .NET with a professional look like Outlook. With a powerful grid that overrides the Rendering
  5. Spawn process for Shell : Redirecting input/output
  6. Make a responsive UI with Background worker
  7. Deploying the application with a Setup project, with custom file type and icons



  • Added the 1st version


I'd like to thank all the people who helped me in this project, even if unconsciously:

  • OLAF Project– For the exceptional grid
  • Noogen Project for the Validators
  • Gregory Young for his expertise
  • Dina for her patience


This article, along with any associated source code and files, is licensed under The BSD License


About the Author

Web Developer
Israel Israel
Breezback works as a software developer for companies based in Israel. He holds a BSc. in Computer Science Engineering. He has a strong inclination towards Microsoft technologies especially the .NET Platform.
He has a strong passion for management and technology. His interests span through riding, diving, movies and books.

You may also be interested in...


Comments and Discussions

GeneralGreat article beautiful idea Pin
oryan.yitzhak18-Nov-07 15:13
memberoryan.yitzhak18-Nov-07 15:13 
GeneralRe: Great article beautiful idea Pin
breezback22-Nov-07 6:13
memberbreezback22-Nov-07 6:13 
GeneralGreat but... Pin
ksportz5-Nov-07 21:03
memberksportz5-Nov-07 21:03 
AnswerRe: Great but... Pin
breezback6-Nov-07 3:11
memberbreezback6-Nov-07 3:11 
GeneralRe: Great but... Pin
ksportz13-Nov-07 0:01
memberksportz13-Nov-07 0:01 
GeneralRe: Great but... Pin
ksportz13-Nov-07 0:04
memberksportz13-Nov-07 0:04 
AnswerRe: Great but... Pin
breezback14-Nov-07 1:47
memberbreezback14-Nov-07 1:47 
QuestionOutput parser Pin
jermyh3-Nov-07 21:31
memberjermyh3-Nov-07 21:31 
AnswerRe: Output parser Pin
breezback6-Nov-07 3:13
memberbreezback6-Nov-07 3:13 
NewsPlugins to add Pin
breezback3-Nov-07 19:50
memberbreezback3-Nov-07 19:50 
GeneralRe: Plugins to add Pin
ijevsk6-Nov-07 20:28
memberijevsk6-Nov-07 20:28 
GeneralRe: Plugins to add Pin
breezback6-Nov-07 21:36
memberbreezback6-Nov-07 21:36 
GeneralRe: Plugins to add Pin
breezback12-Jul-08 1:37
memberbreezback12-Jul-08 1:37 
GeneralAdditional Features Part 2 - Decision Architecture Pin
yang yu 17999991-Nov-07 8:47
memberyang yu 17999991-Nov-07 8:47 
GeneralAdditional Features Part 1 - Pipeline Architecture [modified] Pin
yang yu 17999991-Nov-07 8:00
memberyang yu 17999991-Nov-07 8:00 
AnswerRe: Additional Features Part 1 - Pipeline Architecture Pin
breezback1-Nov-07 9:13
memberbreezback1-Nov-07 9:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161021.1 | Last Updated 1 Nov 2007
Article Copyright 2007 by breezback
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid