public InspectableAssembly(string filename, ParseContext context)
 {
     Stream = File.OpenRead(filename);
     Pe = new PEReader(Stream);
     Reader = Pe.GetMetadataReader();
     Context = context;
 }
Пример #2
0
        public void Parse(P.Program program, string filename)
        {
            var context = new ParseContext(program);

            var ia = new InspectableAssembly(filename, context);
            EntryPointQueue(ia, context);

            while(context.Todo.Count > 0)
            {
                context.Todo.Dequeue().Process();
            }
        }
Пример #3
0
        private void EntryPointQueue(InspectableAssembly ia, ParseContext context)
        {
            foreach (var typeHandle in ia.Reader.TypeDefinitions)
            {
                var parseTarget = ia.CreateParseTarget(typeHandle);
                parseTarget.MethodName = "Main";

                if (IgnoreClassList.Contains(parseTarget.ClassName))
                    continue;

                context.AddTodo(parseTarget);
            }
        }      
        public ParseTarget(ParseContext context, string assemblyName, Version assemblyVersion, string fqName)
        {
            AssemblyName = assemblyName;
            ClassName = fqName;
            AssemblyVersion = assemblyVersion;

            for(int i = 0; i < Extensions.Length; i++)
            {
                try
                {
                    var path = TryExtenstion(Extensions[i]);
                    Ia = new InspectableAssembly(path, context);
                }
                catch
                {
                    if (i == Extensions.Length - 1)
                        throw;
                }
            }
        }
        public ParseTarget(ParseContext context, string assemblyName, string fqName)
            : this(context, assemblyName, new Version(9,9,9,9), fqName)
        {

        }