Example #1
0
        /// <summary>
        /// Loads the javascript file to be run, but does not start it.
        /// If the vpath starts with "~", then the filename is relative
        /// to the plugins folder.
        /// </summary>
        public JavascriptImplant(string vpath, string oscFormat, RangeMap activeArea) : base(activeArea)
        {
            // override the implant ID with something more useful
#warning This ImplantID will not be unique if the same implant is loaded twice!!!
            ImplantID = vpath;


            Active = true;

            ImplantType                = JavascriptImplantType.Load(vpath);
            ImplantInstance            = ImplantType.CreateInstance(this);
            ImplantInstance.osc.Format = oscFormat;
        }
        /// <summary>
        /// Returns the implant type object by id.  Only one type can
        /// be registered for each ID.
        /// </summary>
        public static JavascriptImplantType Get(string id)
        {
            JavascriptImplantType ret;

            lock (_lock)
            {
                if (!_implantTypes.TryGetValue(id, out ret))
                {
                    ret = new JavascriptImplantType(id);
                    _implantTypes.Add(id, ret);
                }
            }
            return(ret);
        }