The Lucid Scribe interface:

namespace lucidcode.LucidScribe.Interface
{

  public interface ILucidPlugin
  {

    /// <summary>
    /// The name of the plugin.
    /// </summary>
    String Name
    { get; }

    /// <summary>
    /// Initializes the plugin.
    /// </summary>
    /// <returns>Success or failure.</returns>
    Boolean Initialize();

    /// <summary>
    /// Gets the current value of the plugin - 10 times per second.
    /// </summary>
    Double Value
    { get; }

    /// <summary>
    /// Disposes the plugin.
    /// </summary>
    void Dispose();

  }

}

Follow these steps to use it:
1.) Add a reference to lucidcode.LucidScribe.Interface.dll.
2.) Create a public class and inherit the LucidPluginBase class.
3.) Override the Name and Value properties and the Initialize function.
4.) Compile the project and copy the DLL to the Lucid Scribe directory.
E.g.: The following plugin simply returns the current millisecond (every 100 milliseconds):

namespace lucidcode.LucidScribe.Plugin.Millisecond
{

    public class PluginHandler : lucidcode.LucidScribe.Interface.LucidPluginBase
    {

        public override string Name
        {
            get
            {
                return "Millisecond";
            }
        }

        public override bool Initialize()
        {
            return true;
        }

        public override double Value
        {
            get
            {
                return DateTime.Now.Millisecond;
            }
        }

    }
	
}

Curious? This is what it looks like in Lucid Scribe:

To run a plugin on a separate thread faster than 10 Hz without overclocking, implement the Illuminated interface:

namespace lucidcode.LucidScribe.Plugin.MillisecondI
{

    public class PluginHandler : lucidcode.LucidScribe.Interface.ILluminatedPlugin
    {

        public override string Name
        {
            get
            {
                return "Millisecond I";
            }
        }

        public override bool Initialize()
        {
            Thread ticker = new Thread(Ticker);
            ticker.Start();
            return true;
        }

        public event Interface.SenseHandler Sensed;
        private void Ticker()
        {
          do
          {
            if (Sensed != null)
            {
              TickCount += DateTime.Now.Millisecond + ",";
              Sensed(this, DateTime.Now.Millisecond);
              Thread.Sleep(1);
            }
          }
          while (true);
        }
    }
	
}
Advertisements