コード例 #1
0
ファイル: SbMapper.cs プロジェクト: 3F/SobaScript.Mapper
        /// <param name="name">Element name.</param>
        /// <param name="ident">Identificator of node.</param>
        /// <param name="strict"></param>
        /// <returns>null value if not found</returns>
        protected INodeInfo InfoBy(string name, NodeIdent ident, bool strict)
        {
            foreach (INodeInfo info in Inspector.GetBy(ident))
            {
                if (string.IsNullOrEmpty(info.Name))  // hidden property
                {
                    return(InfoBy(name, info.Link, strict));
                }

                string elem = new StringHandler().ProtectMixedQuotes(info.Name);
                elem = Regex.Replace(elem, SobaScript.Pattern.RoundBracketsContent, "()", RegexOptions.IgnorePatternWhitespace);

                if ((strict && elem == name) ||
                    (!strict && elem.Contains(name)))
                {
                    return(info);
                }
            }

            return(null);
        }