Пример #1
0
        private void ParseTag(IEnumerable <string> tag)
        {
            var chars = tag.First().SkipWhile(c => c == ' ' || c == '<').TakeWhile(c => char.IsLetter(c));

            NodeName = new string(chars.ToArray());

            Regex attributes = new Regex("[ ,\t]{1}[a-z,A-Z,0-9]{1,}[ ]{0,}[=]{1}[ ]{0,}[\"]{1}[a-z,A-Z,0-9,_ ]{0,}[\"]{1}");

            System.Text.StringBuilder tagStr = new System.Text.StringBuilder();

            foreach (string str in tag)
            {
                tagStr.Append($" {str.Trim('\n')} ");
            }

            IEnumerable <string> attr = attributes.Matches(tagStr.ToString()).Select(m => m.Value);

            foreach (string attribute in attr)
            {
                string[] parts = attribute.Split('=');
                ObjectProperties.Add(parts[0].Trim(), parts[1].Trim().Trim('"'));
            }

            attributes = new Regex("[a-z,A-Z,0-9]{1,}[:]{1}[a-z,A-Z,0-9]{1,}[ ]{0,}[=]{1}[ ]{0,}[\"]{1}[a-z,A-Z,0-9]{0,}[\"]{1}");

            attr = attributes.Matches(tagStr.ToString()).Select(m => m.Value);

            foreach (string attribute in attr)
            {
                string[] parts = attribute.Split('=');
                AttachedProperties.Add(parts[0], parts[1].Trim('"'));
            }
        }
Пример #2
0
        public override ObjectProperties Properties()
        {
            var props = new ObjectProperties();

            foreach (var attr in node.Attributes)
            {
                props.Add(attr.Name, new ObjectResult(attr.NodeValue), null);
            }

            return(props);
        }
Пример #3
0
        public bool Init(byte[] buffer, AbbreviationTable abbreviationTable)
        {
            int len   = GetByte(buffer, Header);
            int index = Header + 1;

            // load object name
            if (len > 0)
            {
                Text t = new Text();

                for (int i = 0; i < len; i++)
                {
                    t.AddCharacters(GetWord(buffer, index));
                    index += 2;
                }

                Name = t.GetValue(abbreviationTable);
            }

            int x = GetByte(buffer, index);

            // load object properties
            while (x != 0)
            {
                List <int> list          = new List <int>();
                int        id            = x & 0x1f;
                int        numberOfBytes = (x >> 5) + 1;

                ObjectProperties.Add(id, new ObjectProperty()
                {
                    //TODO Verify Address
                    Address = index + 1,
                    Index   = id
                });

                for (int i = 0; i < numberOfBytes; i++)
                {
                    list.Add(GetByte(buffer, ++index));
                }

                ObjectProperties[id].List = list;

                x = GetByte(buffer, ++index);
            }

            LoadAttributes();

            return(true);
        }
        public void Analyze()
        {
            ExtractDerivedProperties();
            var propertyInfos = typeToProcess.GetProperties();

            Name = typeToProcess.Name;
            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                var props = GetPropertyDefinition(propertyInfo);
                if (!DerivedProperties.Any(a => a.Name == props.Name))
                {
                    ObjectProperties.Add(props);
                }
            }
        }
        public void Getproperties(Type type)
        {
            Session session = this.Session;
            //Type type = fObject.GetType().;

            XPClassInfo cinfo = session.GetClassInfo(type);

            ObjectProperties.Clear();
            foreach (XPMemberInfo mi in cinfo.PersistentProperties)
            {
                ObjectProperties.Add(new ObjectProperty(this.Session)
                {
                    Value       = mi.Name,
                    DisplayName = mi.DisplayName
                });
            }
        }