예제 #1
0
        public static bool isRoot(SectionBody scb)
        {
            bool isRootFlag = true;

            if (scb.BodyList != null)
            {
                foreach (string s in scb.BodyList)
                {
                    if (s.Contains('{') || s.Contains('}'))
                    {
                        isRootFlag = false;
                        break;
                    }
                }
            }

            return(isRootFlag);
        }
예제 #2
0
        public static KeyValuePair <string, string> getSectionNameAndInstanceNameValue(SectionBody scb)
        {
            string?s = scb.BodyList?[0];

            string[] sArr;
            if (s != null && s.Contains(' '))
            {
                sArr = Regex.Split(s, @"[\s]+");
                // s_arr = s.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);
                if (sArr.Length > 1)
                {
                    if (sArr[1].Trim() != "{")
                    {
                        return(new KeyValuePair <string, string>(sArr[0].Trim(), sArr[1].Trim()));
                    }
                    else
                    {
                        return(new KeyValuePair <string, string>(sArr[0].Trim(), ""));
                    }
                }
            }

            return(new KeyValuePair <string, string>(s?.Trim() !, ""));
        }