internal VsaItem(VsaEngine engine, string name, VsaItemType type, VsaItemFlag flag) { this.engine = engine; this.name = name; this.type = type; this.flag = flag; }
public virtual IVsaItem CreateItem (String name, VsaItemType itemType, VsaItemFlag itemFlag) { lock (this) { CheckForClosed(); if (engine.IsRunning) { throw new VsaException(VsaError.EngineRunning); } if (itemType != VsaItemType.Code) { // We only support code items in this implementation. throw new VsaException(VsaError.ItemTypeNotSupported); } if (itemFlag == VsaItemFlag.Class) { // We don't support class flags. throw new VsaException(VsaError.ItemFlagNotSupported); } VsaItem.ValidateName(engine, name); VsaItem item = new VsaCodeItem(engine, name, itemFlag); itemList.Add(item); return(item); } }
internal VsaItem(VsaEngine engine, string itemName, VsaItemType type, VsaItemFlag 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, VsaItemType type, VsaItemFlag flag) { this.engine = engine; this.type = type; this.name = itemName; this.flag = flag; this.codebase = null; this.isDirty = true; }
// Constructor. internal VsaItem(VsaEngine engine, String name, VsaItemType type, VsaItemFlag flag) { this.engine = engine; this.codebaseOption = null; this.isDirty = false; this.type = type; this.name = name; this.flag = flag; }
public virtual IVsaItem CreateItem(string name, VsaItemType itemType, VsaItemFlag itemFlag) { if (names.Contains(name)) { throw new VsaException(VsaError.ItemNameInUse); } IVsaItem item = null; switch (itemType) { case VsaItemType.AppGlobal: if (itemFlag != VsaItemFlag.None) { throw new VsaException(VsaError.ItemFlagNotSupported); } item = new VsaGlobalItem(engine, name, itemFlag); break; case VsaItemType.Code: item = new VsaCodeItem(engine, name, itemFlag); break; case VsaItemType.Reference: if (itemFlag != VsaItemFlag.None) { throw new VsaException(VsaError.ItemFlagNotSupported); } item = new VsaReferenceItem(engine, name, itemFlag); break; } if (item != null) { items.Add(item); names.Add(name); } engine.IsDirty = true; return(item); }
internal VsaReferenceItem(VsaEngine engine, string name, VsaItemFlag flag) : base(engine, name, VsaItemType.Reference, flag) { this.dirty = true; }
internal VsaGlobalItem (VsaEngine engine, string name, VsaItemFlag flag) : base (engine, name, VsaItemType.AppGlobal, flag) { this.dirty = true; }
internal VsaCodeItem(VsaEngine engine, string name, VsaItemFlag flag) : base(engine, name, VsaItemType.Code, flag) { this.dirty = true; }
public virtual IVsaItem CreateItem(string name, VsaItemType itemType, VsaItemFlag itemFlag) { if (names.Contains (name)) throw new VsaException (VsaError.ItemNameInUse); IVsaItem item = null; switch (itemType) { case VsaItemType.AppGlobal: if (itemFlag != VsaItemFlag.None) throw new VsaException (VsaError.ItemFlagNotSupported); item = new VsaGlobalItem (engine, name, itemFlag); break; case VsaItemType.Code: item = new VsaCodeItem (engine, name, itemFlag); break; case VsaItemType.Reference: if (itemFlag != VsaItemFlag.None) throw new VsaException (VsaError.ItemFlagNotSupported); item = new VsaReferenceItem (engine, name, itemFlag); break; } if (item != null) { items.Add (item); names.Add (name); } engine.IsDirty = true; return item; }
// Constructor. internal VsaCodeItem(VsaEngine engine, String name, VsaItemFlag flag) : base(engine, name, VsaItemType.Code, flag) { sourceText = null; parsed = null; }
public virtual IVsaItem CreateItem (String name, VsaItemType itemType, VsaItemFlag itemFlag) { lock(this) { CheckForClosed(); if(engine.IsRunning) { throw new VsaException(VsaError.EngineRunning); } if(itemType != VsaItemType.Code) { // We only support code items in this implementation. throw new VsaException(VsaError.ItemTypeNotSupported); } if(itemFlag == VsaItemFlag.Class) { // We don't support class flags. throw new VsaException(VsaError.ItemFlagNotSupported); } VsaItem.ValidateName(engine, name); VsaItem item = new VsaCodeItem(engine, name, itemFlag); itemList.Add(item); return item; } }
public virtual IVsaItem CreateItem(string name, VsaItemType itemType, VsaItemFlag itemFlag) { if (this.isClosed) { throw new VsaException(VsaError.EngineClosed); } if (this.engine.IsRunning) { throw new VsaException(VsaError.EngineRunning); } this.TryObtainLock(); try{ // The name must be valid for all items except reference items (in which case we don't care) if (itemType != VsaItemType.Reference && !this.engine.IsValidIdentifier(name)) { throw new VsaException(VsaError.ItemNameInvalid); } // Make sure the name isn't already in use foreach (Object vsaItem in this.items) { if (((VsaItem)vsaItem).Name.Equals(name)) { throw new VsaException(VsaError.ItemNameInUse); } } IVsaItem item = null; switch (itemType) { // IVsaReference case VsaItemType.Reference: if (itemFlag != VsaItemFlag.None) { throw new VsaException(VsaError.ItemFlagNotSupported); } // create a wrapper around an assembly item = new VsaReference((VsaEngine)this.engine, name); break; //IVsaGlobalItem case VsaItemType.AppGlobal: if (itemFlag != VsaItemFlag.None) { throw new VsaException(VsaError.ItemFlagNotSupported); } item = new VsaHostObject((VsaEngine)this.engine, name, VsaItemType.AppGlobal); ((VsaHostObject)item).isVisible = true; break; // IVsaCodeItem case VsaItemType.Code: if (itemFlag == VsaItemFlag.Class) { throw new VsaException(VsaError.ItemFlagNotSupported); } item = new VsaStaticCode((VsaEngine)this.engine, name, itemFlag); this.staticCodeBlockCount++; break; } if (item != null) { this.items.Add(item); } else { throw new VsaException(VsaError.ItemTypeNotSupported); } ((VsaEngine)this.engine).IsDirty = true; return(item); }finally{ this.ReleaseLock(); } }
public virtual IVsaItem CreateItem(string name, VsaItemType itemType, VsaItemFlag itemFlag){ if (this.isClosed) throw new VsaException(VsaError.EngineClosed); if (this.engine.IsRunning) throw new VsaException(VsaError.EngineRunning); this.TryObtainLock(); try{ // The name must be valid for all items except reference items (in which case we don't care) if (itemType != VsaItemType.Reference && !this.engine.IsValidIdentifier(name)) throw new VsaException(VsaError.ItemNameInvalid); // Make sure the name isn't already in use foreach (Object vsaItem in this.items){ if (((VsaItem)vsaItem).Name.Equals(name)) throw new VsaException(VsaError.ItemNameInUse); } IVsaItem item = null; switch (itemType){ // IVsaReference case VsaItemType.Reference: if (itemFlag != VsaItemFlag.None) throw new VsaException(VsaError.ItemFlagNotSupported); // create a wrapper around an assembly item = new VsaReference((VsaEngine)this.engine, name); break; //IVsaGlobalItem case VsaItemType.AppGlobal: if (itemFlag != VsaItemFlag.None) throw new VsaException(VsaError.ItemFlagNotSupported); item = new VsaHostObject((VsaEngine)this.engine, name, VsaItemType.AppGlobal); ((VsaHostObject)item).isVisible = true; break; // IVsaCodeItem case VsaItemType.Code: if (itemFlag == VsaItemFlag.Class) throw new VsaException(VsaError.ItemFlagNotSupported); item = new VsaStaticCode((VsaEngine)this.engine, name, itemFlag); this.staticCodeBlockCount++; break; } if (item != null){ this.items.Add(item); }else{ throw new VsaException(VsaError.ItemTypeNotSupported); } ((VsaEngine)this.engine).IsDirty = true; return item; }finally{ this.ReleaseLock(); } }
internal VsaGlobalItem(VsaEngine engine, string name, VsaItemFlag flag) : base(engine, name, VsaItemType.AppGlobal, flag) { this.dirty = true; }
internal VsaStaticCode(VsaEngine engine, string itemName, VsaItemFlag flag) : base(engine, itemName, VsaItemType.Code, flag) { this.compiledClass = null; this.codeContext = new Context(new DocumentContext(this), ""); }