⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 group.cs

📁 Freetextbox是优秀的在线编辑器
💻 CS
字号:
namespace FreeTextBoxControls.Support.Sgml
{
    using System;
    using System.Collections;

    public class Group
    {
        public Group(Group parent)
        {
            this.Parent = parent;
            this.Members = new ArrayList();
            this.GroupType = FreeTextBoxControls.Support.Sgml.GroupType.None;
            this.Occurrence = FreeTextBoxControls.Support.Sgml.Occurrence.Required;
        }

        public void AddConnector(char c)
        {
            if (!(this.Mixed || (this.Members.Count != 0)))
            {
                throw new Exception(string.Format("Missing token before connector '{0}'.", c));
            }
            FreeTextBoxControls.Support.Sgml.GroupType type1 = FreeTextBoxControls.Support.Sgml.GroupType.None;
            switch (c)
            {
                case '&':
                    type1 = FreeTextBoxControls.Support.Sgml.GroupType.And;
                    break;

                case ',':
                    type1 = FreeTextBoxControls.Support.Sgml.GroupType.Sequence;
                    break;

                case '|':
                    type1 = FreeTextBoxControls.Support.Sgml.GroupType.Or;
                    break;
            }
            if ((this.GroupType != FreeTextBoxControls.Support.Sgml.GroupType.None) && (this.GroupType != type1))
            {
                throw new Exception(string.Format("Connector '{0}' is inconsistent with {1} group.", c, this.GroupType.ToString()));
            }
            this.GroupType = type1;
        }

        public void AddGroup(Group g)
        {
            this.Members.Add(g);
        }

        public void AddOccurrence(char c)
        {
            FreeTextBoxControls.Support.Sgml.Occurrence occurrence1 = FreeTextBoxControls.Support.Sgml.Occurrence.Required;
            switch (c)
            {
                case '*':
                    occurrence1 = FreeTextBoxControls.Support.Sgml.Occurrence.ZeroOrMore;
                    break;

                case '+':
                    occurrence1 = FreeTextBoxControls.Support.Sgml.Occurrence.OneOrMore;
                    break;

                case '?':
                    occurrence1 = FreeTextBoxControls.Support.Sgml.Occurrence.Optional;
                    break;
            }
            this.Occurrence = occurrence1;
        }

        public void AddSymbol(string sym)
        {
            if (sym == "#PCDATA")
            {
                this.Mixed = true;
            }
            else
            {
                this.Members.Add(sym);
            }
        }

        public bool CanContain(string name, SgmlDtd dtd)
        {
            object obj1;
            IDisposable disposable1;
            IEnumerator enumerator1 = this.Members.GetEnumerator();
            try
            {
                while (enumerator1.MoveNext())
                {
                    obj1 = enumerator1.Current;
                    if ((obj1 is string) && (obj1 == name))
                    {
                        return true;
                    }
                }
            }
            finally
            {
                disposable1 = enumerator1 as IDisposable;
                if (disposable1 != null)
                {
                    disposable1.Dispose();
                }
            }
            enumerator1 = this.Members.GetEnumerator();
            try
            {
                while (enumerator1.MoveNext())
                {
                    obj1 = enumerator1.Current;
                    if (obj1 is string)
                    {
                        string text1 = (string) obj1;
                        ElementDecl decl1 = dtd.FindElement(text1);
                        if ((decl1 != null) && (decl1.StartTagOptional && decl1.CanContain(name, dtd)))
                        {
                            return true;
                        }
                    }
                    else
                    {
                        Group group1 = (Group) obj1;
                        if (group1.CanContain(name, dtd))
                        {
                            return true;
                        }
                    }
                }
            }
            finally
            {
                disposable1 = enumerator1 as IDisposable;
                if (disposable1 != null)
                {
                    disposable1.Dispose();
                }
            }
            return false;
        }


        public bool TextOnly
        {
            get
            {
                return (this.Mixed && (this.Members.Count == 0));
            }
        }


        public FreeTextBoxControls.Support.Sgml.GroupType GroupType;
        public ArrayList Members;
        public bool Mixed;
        public FreeTextBoxControls.Support.Sgml.Occurrence Occurrence;
        public Group Parent;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -