Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
        }