Пример #1
0
        void ParseComponents()
        {
            foreach (var handle in metaReader.TypeDefinitions)
            {
                var typeDef = metaReader.GetTypeDefinition(handle);

                var baseTypeHandle = typeDef.BaseType;

                if (baseTypeHandle.Kind == HandleKind.TypeReference)
                {
                    var typeRef = metaReader.GetTypeReference((TypeReferenceHandle)baseTypeHandle);

                    if (metaReader.GetString(typeRef.Name) != "CSComponent")
                    {
                        continue;
                    }

                    var inspector = new CSComponentInspector(typeDef, peFile, metaReader);

                    var icomponent = inspector.Inspect();

                    if (icomponent != null)
                    {
                        InspectorComponents [icomponent.Name] = icomponent;
                    }
                }
            }
        }
            public string ToString(CSComponentInspector visualizer)
            {
                switch (this.Kind)
                {
                default:
                    return(".try");

                case HandlerKind.Catch:
                    return("catch **exceptiontype**");                   // + visualizer.VisualizeLocalType(this.ExceptionType);

                case HandlerKind.Filter:
                    return("filter");

                case HandlerKind.Finally:
                    return("finally");

                case HandlerKind.Fault:
                    return("fault");
                }
            }