Black Knight

Chameleon





JScript .NET Tutorial

To write a Chameleon plug-in in JScript .NET, follow these steps:

1. Copy and paste the code skeleton below into an empty .js file.

import System;
import System.IO;
import System.ComponentModel;
import BKTech.Chameleon.Plugins;

package Your.Namespace
{
    public class YourPluginName implements IChameleonPlugin
    {
        //the array of input files from the client
        private var myDataFiles : String[];

         //a delegate that allows this plug-in to
        //send progress updates to the client
        private var myReporter : FeedBack.sendFeedBack;

        //Returns author string for display in GUI
        function get_Author() : String
        {
            return "";
        }

	//Returns category string for display in GUI
	//no effect on plug-in placement in tree
        function get_Category() : String
        {
            return "";
        }

        //Returns description string for display in GUI
        function get_Description() : String
        {
            return "";
        }

	//Returns expected input string for display in GUI
	function get_ExpectedInput() : String
	{
		return "";
	}

        //Returns output string for display in GUI
        function get_Output() : String
        {
            return "";
        }

	/// <summary>Initializes this plug-in</summary>
        /// <param name="dataFiles">The array of
        /// input files from the client</param>
        /// <param name="reporter">A delegate for reporting status updates
        /// to the client</param>
        /// <returns>True if we are clear to begin execution, false if we have
        /// invalid input and need to abort</returns>
        function Initialize(dataFiles : String[], reporter : FeedBack.sendFeedBack) : Boolean
        {
            myReporter = reporter;
            myDataFiles = dataFiles;
            myReporter("Plug-in initialized" , FeedBack.ReturnCode.Success);
            return true;
        }

        /// <summary>
        /// The core logic of this plug-in
        /// </summary>
        /// <returns>True if executed successfully, false otherwise</returns>
        function Execute() : Boolean
        {

            myReporter("Plug-in is complete", FeedBack.ReturnCode.Success);
            return true;
        }

        /// <summary>
        /// Loads saved custom properties
        /// </summary>
        /// <param name="loadValue">The value saved by the client in
        ///the .cham file for this plug-in</param>
        /// <returns>True if loaded successfully, false if there was
        /// a problem</returns>
        function Load(loadValue : String) : Boolean
        {
            return true;
        }

        /// <summary>Saves this plug-in's data</summary>
        function Save() : String
        {
            return "";
        }

	/// <summary>Cleans up this plug-in</summary>
	function Clean() : Boolean
	{
            return true;
	}
    }
}


		

2. Implement desired logic

3. Compile using Microsoft-provided 'jsc' compiler:

jsc /t:library /reference:"{ChameleonInstallDirGoesHere}\Chameleon_Plugin.dll" PluginFile.js

4. Copy to the plug-ins directory

5. Start Chameleon