Exemplo n.º 1
0
        private void ReadProperties()
        {
            var propertyBuilders = new List <StringBuilder>();

            //  Now start parsing the raw IL, line by line.
            using (var reader = new StringReader(RawIL))
            {
                //  Read each line
                string        line;
                StringBuilder currentBuilder = null;
                string        currentName    = null;
                while ((line = reader.ReadLine()) != null)
                {
                    //  Is it a class start token? If so, we can start a new builder.
                    if (ILParseHelper.IsLinePropertyDeclaration(line))
                    {
                        currentBuilder = new StringBuilder();
                        currentName    = ILParseHelper.GetPropertyNameFromDeclarationLine(line);
                    }

                    //  If don't have a current class, skip.
                    if (currentBuilder == null)
                    {
                        continue;
                    }

                    //  Add the line to the class builder.
                    currentBuilder.AppendLine(line);

                    //  Is it a class end token? If so, clear the current class identifier.
                    if (ILParseHelper.IsLinePropertyEndDeclaration(line, ShortName, currentName))
                    {
                        propertyBuilders.Add(currentBuilder);
                        currentName    = null;
                        currentBuilder = null;
                    }
                }
            }

            propertyBuilders.ForEach(mb =>
            {
                var method    = new DisassembledProperty();
                method.Parent = this;
                method.RawIL  = mb.ToString();
                method.InitialiseFromIL();
                method.FullName = FullName + "." + method.ShortName;
                properties.Add(method);
            });
        }
Exemplo n.º 2
0
        public override void InitialiseFromIL()
        {
            string line;

            using (var reader = new StringReader(RawIL))
            {
                while ((line = reader.ReadLine()) != null)
                {
                    var methodName = ILParseHelper.GetPropertyNameFromDeclarationLine(line);
                    if (methodName != null)
                    {
                        ShortName = methodName;
                        FullName  = methodName;
                        break;
                    }
                }
            }
        }