Example #1
0
 public virtual IJSVsaItem CreateDynamicItem(string itemName, JSVsaItemType type)
 {
     if (!base.engine.IsRunning)
     {
         throw new JSVsaException(JSVsaError.EngineNotRunning);
     }
     return(this.AddItem(itemName, type));
 }
 internal VsaItem(VsaEngine engine, string itemName, JSVsaItemType type, JSVsaItemFlag flag)
 {
     this.engine   = engine;
     this.type     = type;
     this.name     = itemName;
     this.flag     = flag;
     this.codebase = null;
     this.isDirty  = true;
 }
 internal VsaItem(VsaEngine engine, string itemName, JSVsaItemType type, JSVsaItemFlag flag)
 {
     this.engine = engine;
     this.type = type;
     this.name = itemName;
     this.flag = flag;
     this.codebase = null;
     this.isDirty = true;
 }
 internal VsaScriptCode(VsaEngine engine, string itemName, JSVsaItemType type, IVsaScriptScope scope) : base(engine, itemName, type, JSVsaItemFlag.None)
 {
     this.binaryCode = null;
     this.executed = false;
     this.scope = (VsaScriptScope) scope;
     this.codeContext = new Context(new DocumentContext(this), null);
     this.compiledBlock = null;
     this.compileToIL = true;
     this.optimize = true;
 }
 internal VsaScriptCode(VsaEngine engine, string itemName, JSVsaItemType type, IVsaScriptScope scope) : base(engine, itemName, type, JSVsaItemFlag.None)
 {
     this.binaryCode    = null;
     this.executed      = false;
     this.scope         = (VsaScriptScope)scope;
     this.codeContext   = new Context(new DocumentContext(this), null);
     this.compiledBlock = null;
     this.compileToIL   = true;
     this.optimize      = true;
 }
 internal VsaHostObject(VsaEngine engine, string itemName, JSVsaItemType type, VsaScriptScope scope) : base(engine, itemName, type, JSVsaItemFlag.None)
 {
     this.hostObject = null;
     this.exposeMembers = false;
     this.isVisible = false;
     this.exposed = false;
     this.compiled = false;
     this.scope = scope;
     this.field = null;
     this.typeString = "System.Object";
 }
Example #7
0
 internal VsaHostObject(VsaEngine engine, string itemName, JSVsaItemType type, VsaScriptScope scope) : base(engine, itemName, type, JSVsaItemFlag.None)
 {
     this.hostObject    = null;
     this.exposeMembers = false;
     this.isVisible     = false;
     this.exposed       = false;
     this.compiled      = false;
     this.scope         = scope;
     this.field         = null;
     this.typeString    = "System.Object";
 }
        public IJSVsaItem CreateItem(string name, JSVsaItemType itemType, JSVsaItemFlag itemFlag)
        {
            IJSVsaItem item2;
            if (this.isClosed)
            {
                throw new JSVsaException(JSVsaError.EngineClosed);
            }
            if (this.engine.IsRunning)
            {
                throw new JSVsaException(JSVsaError.EngineRunning);
            }
            this.TryObtainLock();
            try
            {
                if ((itemType != JSVsaItemType.Reference) && !this.engine.IsValidIdentifier(name))
                {
                    throw new JSVsaException(JSVsaError.ItemNameInvalid);
                }
                foreach (object obj2 in this.items)
                {
                    if (((VsaItem) obj2).Name.Equals(name))
                    {
                        throw new JSVsaException(JSVsaError.ItemNameInUse);
                    }
                }
                IJSVsaItem item = null;
                switch (itemType)
                {
                    case JSVsaItemType.Reference:
                        if (itemFlag != JSVsaItemFlag.None)
                        {
                            throw new JSVsaException(JSVsaError.ItemFlagNotSupported);
                        }
                        break;

                    case JSVsaItemType.AppGlobal:
                        if (itemFlag != JSVsaItemFlag.None)
                        {
                            throw new JSVsaException(JSVsaError.ItemFlagNotSupported);
                        }
                        goto Label_00E3;

                    case JSVsaItemType.Code:
                        if (itemFlag == JSVsaItemFlag.Class)
                        {
                            throw new JSVsaException(JSVsaError.ItemFlagNotSupported);
                        }
                        goto Label_010E;

                    default:
                        goto Label_012A;
                }
                item = new VsaReference(this.engine, name);
                goto Label_012A;
            Label_00E3:
                item = new VsaHostObject(this.engine, name, JSVsaItemType.AppGlobal);
                ((VsaHostObject) item).isVisible = true;
                goto Label_012A;
            Label_010E:
                item = new VsaStaticCode(this.engine, name, itemFlag);
                this.staticCodeBlockCount++;
            Label_012A:
                if (item != null)
                {
                    this.items.Add(item);
                }
                else
                {
                    throw new JSVsaException(JSVsaError.ItemTypeNotSupported);
                }
                this.engine.IsDirty = true;
                item2 = item;
            }
            finally
            {
                this.ReleaseLock();
            }
            return item2;
        }
Example #9
0
        public IJSVsaItem CreateItem(string name, JSVsaItemType itemType, JSVsaItemFlag itemFlag)
        {
            IJSVsaItem item2;

            if (this.isClosed)
            {
                throw new JSVsaException(JSVsaError.EngineClosed);
            }
            if (this.engine.IsRunning)
            {
                throw new JSVsaException(JSVsaError.EngineRunning);
            }
            this.TryObtainLock();
            try
            {
                if ((itemType != JSVsaItemType.Reference) && !this.engine.IsValidIdentifier(name))
                {
                    throw new JSVsaException(JSVsaError.ItemNameInvalid);
                }
                foreach (object obj2 in this.items)
                {
                    if (((VsaItem)obj2).Name.Equals(name))
                    {
                        throw new JSVsaException(JSVsaError.ItemNameInUse);
                    }
                }
                IJSVsaItem item = null;
                switch (itemType)
                {
                case JSVsaItemType.Reference:
                    if (itemFlag != JSVsaItemFlag.None)
                    {
                        throw new JSVsaException(JSVsaError.ItemFlagNotSupported);
                    }
                    break;

                case JSVsaItemType.AppGlobal:
                    if (itemFlag != JSVsaItemFlag.None)
                    {
                        throw new JSVsaException(JSVsaError.ItemFlagNotSupported);
                    }
                    goto Label_00E3;

                case JSVsaItemType.Code:
                    if (itemFlag == JSVsaItemFlag.Class)
                    {
                        throw new JSVsaException(JSVsaError.ItemFlagNotSupported);
                    }
                    goto Label_010E;

                default:
                    goto Label_012A;
                }
                item = new VsaReference(this.engine, name);
                goto Label_012A;
Label_00E3:
                item = new VsaHostObject(this.engine, name, JSVsaItemType.AppGlobal);
                ((VsaHostObject)item).isVisible = true;
                goto Label_012A;
Label_010E:
                item = new VsaStaticCode(this.engine, name, itemFlag);
                this.staticCodeBlockCount++;
Label_012A:
                if (item != null)
                {
                    this.items.Add(item);
                }
                else
                {
                    throw new JSVsaException(JSVsaError.ItemTypeNotSupported);
                }
                this.engine.IsDirty = true;
                item2 = item;
            }
            finally
            {
                this.ReleaseLock();
            }
            return(item2);
        }
        public virtual IJSVsaItem AddItem(string itemName, JSVsaItemType type)
        {
            VsaItem item = null;
            if (this.isClosed)
            {
                throw new JSVsaException(JSVsaError.EngineClosed);
            }
            if (this.GetItem(itemName) != null)
            {
                throw new JSVsaException(JSVsaError.ItemNameInUse);
            }
            switch (((int) type))
            {
                case 0x10:
                case 0x11:
                case 0x12:
                    item = new VsaHostObject(base.engine, itemName, type, this);
                    if ((type == ((JSVsaItemType) 0x11)) || (type == ((JSVsaItemType) 0x12)))
                    {
                        ((VsaHostObject) item).exposeMembers = true;
                    }
                    if ((type == ((JSVsaItemType) 0x10)) || (type == ((JSVsaItemType) 0x12)))
                    {
                        ((VsaHostObject) item).isVisible = true;
                    }
                    if (base.engine.IsRunning)
                    {
                        ((VsaHostObject) item).Compile();
                        ((VsaHostObject) item).Run();
                    }
                    break;

                case 0x13:
                    item = new VsaScriptScope(base.engine, itemName, this);
                    break;

                case 20:
                    item = new VsaScriptCode(base.engine, itemName, type, this);
                    break;

                case 0x15:
                    if (!base.engine.IsRunning)
                    {
                        throw new JSVsaException(JSVsaError.EngineNotRunning);
                    }
                    item = new VsaScriptCode(base.engine, itemName, type, this);
                    break;

                case 0x16:
                    if (!base.engine.IsRunning)
                    {
                        throw new JSVsaException(JSVsaError.EngineNotRunning);
                    }
                    item = new VsaScriptCode(base.engine, itemName, type, this);
                    break;
            }
            if (item == null)
            {
                throw new JSVsaException(JSVsaError.ItemTypeNotSupported);
            }
            this.items.Add(item);
            return item;
        }
 public virtual IJSVsaItem CreateDynamicItem(string itemName, JSVsaItemType type)
 {
     if (!base.engine.IsRunning)
     {
         throw new JSVsaException(JSVsaError.EngineNotRunning);
     }
     return this.AddItem(itemName, type);
 }
 internal VsaHostObject(VsaEngine engine, string itemName, JSVsaItemType type) : this(engine, itemName, type, null)
 {
 }
Example #13
0
 internal VsaHostObject(VsaEngine engine, string itemName, JSVsaItemType type) : this(engine, itemName, type, null)
 {
 }
Example #14
0
        public virtual IJSVsaItem AddItem(string itemName, JSVsaItemType type)
        {
            VsaItem item = null;

            if (this.isClosed)
            {
                throw new JSVsaException(JSVsaError.EngineClosed);
            }
            if (this.GetItem(itemName) != null)
            {
                throw new JSVsaException(JSVsaError.ItemNameInUse);
            }
            switch (((int)type))
            {
            case 0x10:
            case 0x11:
            case 0x12:
                item = new VsaHostObject(base.engine, itemName, type, this);
                if ((type == ((JSVsaItemType)0x11)) || (type == ((JSVsaItemType)0x12)))
                {
                    ((VsaHostObject)item).exposeMembers = true;
                }
                if ((type == ((JSVsaItemType)0x10)) || (type == ((JSVsaItemType)0x12)))
                {
                    ((VsaHostObject)item).isVisible = true;
                }
                if (base.engine.IsRunning)
                {
                    ((VsaHostObject)item).Compile();
                    ((VsaHostObject)item).Run();
                }
                break;

            case 0x13:
                item = new VsaScriptScope(base.engine, itemName, this);
                break;

            case 20:
                item = new VsaScriptCode(base.engine, itemName, type, this);
                break;

            case 0x15:
                if (!base.engine.IsRunning)
                {
                    throw new JSVsaException(JSVsaError.EngineNotRunning);
                }
                item = new VsaScriptCode(base.engine, itemName, type, this);
                break;

            case 0x16:
                if (!base.engine.IsRunning)
                {
                    throw new JSVsaException(JSVsaError.EngineNotRunning);
                }
                item = new VsaScriptCode(base.engine, itemName, type, this);
                break;
            }
            if (item == null)
            {
                throw new JSVsaException(JSVsaError.ItemTypeNotSupported);
            }
            this.items.Add(item);
            return(item);
        }