Пример #1
0
        public ClassFolder Copy()
        {
            ClassFolder f = new ClassFolder();

            f.Name        = this.Name;
            f.Caption     = this.Caption;
            f.Description = this.Description;
            f.ID          = this.ID;

            f._isBrowsable        = this._isBrowsable;
            f._isReadOnly         = this._isReadOnly;
            f._isPartition        = this._isPartition;
            f._isExpanded         = this._isExpanded;
            f._isItemListExpanded = this._isItemListExpanded;
            f._isSelected         = this._isSelected;

            foreach (object i in items)
            {
                if (i is ValueField)
                {
                    f.items.Add(((ValueField)i).Clone());
                }
                if (i is ReferenceField)
                {
                    f.items.Add(((ReferenceField)i).Clone());
                }
                if (i is EnumField)
                {
                    f.items.Add(((EnumField)i).Clone());
                }
            }

            return(f);
        }
Пример #2
0
 public void MoveUp(int i)
 {
     if (i > 0)
     {
         ClassFolder swap = folders[i - 1];
         folders[i - 1] = folders[i];
         folders[i]     = swap;
     }
 }
Пример #3
0
 public void MoveDown(int i)
 {
     if (i + 1 < folders.Count)
     {
         ClassFolder swap = folders[i + 1];
         folders[i + 1] = folders[i];
         folders[i]     = swap;
     }
 }
Пример #4
0
 public int IndexOf(ClassFolder value)
 {
     for (int x = 0; x < itemCount; x++)
     {
         if (folders[x].Equals(value))
         {
             return(x);
         }
     }
     return(-1);
 }
Пример #5
0
 public void Insert(int index, ClassFolder value)
 {
     itemCount++;
     if (itemCount > folders.Length)
     {
         for (int x = index + 1; x == itemCount - 2; x++)
         {
             folders[x] = folders[x - 1];
         }
     }
     folders[index] = value;
 }
Пример #6
0
        public void Remove(ClassFolder value)
        {
            int index = IndexOf(value);

            if (index == -1)
            {
                //throw (new Exception("ClassFolder not found in collection."));
            }
            else
            {
                RemoveAt(index);
            }
        }
Пример #7
0
        public int Add(ClassFolder value)
        {
            itemCount++;
            if (itemCount > folders.GetUpperBound(0) + 1)
            {
                ClassFolder[] tempfolders = new ClassFolder[itemCount * 2];
                for (int x = 0; x <= folders.GetUpperBound(0); x++)
                {
                    tempfolders[x] = folders[x];
                }
                folders = tempfolders;
            }
            folders[itemCount - 1] = value;

            OnAdd(EventArgs.Empty);
            return(itemCount - 1);
        }
Пример #8
0
        private void EnsureSystemFolderExists()
        {
            foreach (ClassFolder f in folders)
            {
                if (f.Name == "_system" & f.IsReadOnly & !f.IsExpanded)
                {
                    return;
                }
            }

            ClassFolder systemFolder = new ClassFolder("_system");

            systemFolder.Caption     = "System Folder";
            systemFolder.Description = "Internal system folder for supporting NitroCast class entry options.";
            systemFolder.IsReadOnly  = true;
            systemFolder.IsBrowsable = false;
            systemFolder.ParentClass = this;
            folders.Add(systemFolder);
        }
Пример #9
0
 public void Move(ClassFolder src, ModelClass dst, int index)
 {
     src.ParentClass.Folders.Remove(src);
     dst.Folders.Insert(index, src);
     src.ParentClass = dst;
 }
Пример #10
0
 public void Move(ClassField src, ClassFolder dst, int index)
 {
     src.ParentFolder.Items.Remove(src);
     dst.Items.Insert(index, src);
     src.ParentFolder = dst;
 }
Пример #11
0
 public void Move(ClassField src, ClassFolder dst)
 {
     src.ParentFolder.Items.Remove(src);
     dst.Items.Add(src);
     src.ParentFolder = dst;
 }
Пример #12
0
 public void Move(ClassFolder src, ModelClass dst)
 {
     src.ParentClass.Folders.Remove(src);
     dst.Folders.Add(src);
     src.ParentClass = dst;
 }
Пример #13
0
        public ModelClass(XmlTextReader r, string version)
        {
            extended = new Dictionary <Type, ModelClassExtension>();

            // BE SURE TO CREATE SYSTEM FOLDER!

            if (r.Name != "ClassObject")
            {
                throw new Exception(string.Format("Source file does not match NitroCast DTD; " +
                                                  "expected 'ClassModel', found '{0}'.", r.Name));
            }

            r.MoveToAttribute("Name");
            name = r.Value;
            r.MoveToAttribute("NameSpace");
            _namespace = r.Value;
            r.MoveToContent();
            r.Read();

            outputpath = r.ReadElementString("OutputPath");
            if (r.Name == "WebOutputPath")
            {
                webOutputPath = r.ReadElementString("WebOutputPath");
            }
            defaultTableName = r.ReadElementString("DefaultTableName");
            isTableCoded     = bool.Parse(r.ReadElementString("DefaultTableNameHardCoded"));
            caption          = r.ReadElementString("Caption");
            description      = r.ReadElementString("Description");
            summary          = r.ReadElementString("Summary");

            if (r.Name == "IsCachingEnabled")
            {
                isCachingEnabled = bool.Parse(r.ReadElementString("IsCachingEnabled"));
            }
            if (r.Name == "CacheClass")
            {
                cacheClass = r.ReadElementString("CacheClass");
            }
            if (r.Name == "CacheName")
            {
                cacheName = r.ReadElementString("CacheName");
            }
            if (r.Name == "AspNetCachingEnabled")
            {
                isCachingEnabled = bool.Parse(r.ReadElementString("AspNetCachingEnabled"));
            }
            if (r.Name == "CacheLifetime")
            {
                cacheLifetime = TimeSpan.Parse(r.ReadElementString("CacheLifetime"));
            }
            if (r.Name == "IsCollectionCachingEnabled")
            {
                isCollectionCachingEnabled = bool.Parse(r.ReadElementString("IsCollectionCachingEnabled"));
            }
            if (r.Name == "CollectionCacheLifetime")
            {
                collectionCacheLifetime = TimeSpan.Parse(r.ReadElementString("CollectionCacheLifetime"));
            }
            if (r.Name == "LockType")
            {
                concurrency = (ConcurrencyType)Enum.Parse(typeof(ConcurrencyType), r.ReadElementString("LockType"), true);
            }
            if (r.Name == "Concurrency")
            {
                concurrency = (ConcurrencyType)Enum.Parse(typeof(ConcurrencyType), r.ReadElementString("Concurrency"), true);
            }
            if (r.Name == "IsThreadSafe")
            {
                isThreadSafe = bool.Parse(r.ReadElementString("IsThreadSafe"));
            }
            if (r.Name == "IsCreateDateEnabled")
            {
                r.ReadElementString("IsCreateDateEnabled");
            }
            if (r.Name == "IsModifyDateEnabled")
            {
                r.ReadElementString("IsModifyDateEnabled");
            }
            if (r.Name == "Interfaces")
            {
                interfaces = r.ReadElementString("Interfaces");
            }
            if (r.Name == "ToStringOverride")
            {
                toStringOverride = r.ReadElementString("ToStringOverride");
            }
            if (r.Name == "SimpleQueryEnabled")
            {
                simpleQueryEnabled = bool.Parse(r.ReadElementString("SimpleQueryEnabled"));
            }

            #region Obsolete Code

            // Place old version of fields data in data folder
            if (r.Name == "Fields")
            {
                // Make sure there is a default folder!
                if (folders.Count == 0)
                {
                    ClassFolder defaultFolder = new ClassFolder("Default");
                    defaultFolder.ParentClass = this;
                    folders.Add(defaultFolder);
                }

                if (!r.IsEmptyElement)
                {
                    r.Read();
                    while (r.LocalName == "FieldEntry")
                    {
                        ValueField field = new ValueField(r, version);
                        field.ParentFolder = folders[0];
                        folders[0].Items.Add(field);
                    }
                    r.ReadEndElement();
                }
                else
                {
                    r.Read();
                }
            }

            // Place old version of children data in data folder
            if (r.Name == "Children")
            {
                // Make sure there is a default folder!
                if (folders.Count == 0)
                {
                    ClassFolder defaultFolder = new ClassFolder("Default");
                    folders.Add(defaultFolder);
                }

                if (!r.IsEmptyElement)
                {
                    r.Read();
                    while (r.LocalName == "ChildEntry")
                    {
                        ReferenceField field = new ReferenceField(r, version);
                        field.ParentFolder = folders[0];
                        folders[0].Items.Add(field);
                    }
                    r.ReadEndElement();
                }
                else
                {
                    r.Read();
                }
            }

            #endregion

            if (r.Name == "ClassFolders")
            {
                if (!r.IsEmptyElement)
                {
                    r.Read();
                    while (r.LocalName == "ClassFolder")
                    {
                        ClassFolder folder = new ClassFolder(r, version);
                        folder.ParentClass = this;
                        folders.Add(folder);
                    }
                    r.ReadEndElement();
                }
                else
                {
                    r.Read();
                }
            }

            if (r.Name == "OutputPlugins")
            {
                if (!r.IsEmptyElement)
                {
                    r.Read();
                    while (r.LocalName == "ClassOutputConnector")
                    {
                        outputConnectors.Add(new OutputExtensionConnector(r, this));
                    }
                    r.ReadEndElement();
                }
                else
                {
                    r.Read();
                }
            }

            if (r.Name == "MetaAttributes")
            {
                if (!r.IsEmptyElement)
                {
                    r.Read();
                    while (r.LocalName == "MetaAttribute")
                    {
                        attributes.Add(new MetaAttribute(r));
                    }
                    r.ReadEndElement();
                }
                else
                {
                    r.Read();
                }
            }


            if (r.Name == "Extensions")
            {
                if (!r.IsEmptyElement)
                {
                    r.Read();

                    while (r.Name == "Extension")
                    {
                        ModelClassExtension newExtension = (ModelClassExtension)
                                                           ObjectExtension.Build(r, version);
                        extended.Add(newExtension.GetType(), newExtension);
                    }

                    r.ReadEndElement();
                }
                else
                {
                    r.Read();
                }
            }

            r.ReadEndElement();

            EnsureSystemFolderExists();
        }
Пример #14
0
 public bool Contains(ClassFolder value)
 {
     return(IndexOf(value) != -1);
 }