Example #1
0
        static void doFile(string filePath)
        {
            string assemblyullName = Path.GetFullPath(filePath);

            try
            {
                //required to change directory for loading referenced assemblies
                Environment.CurrentDirectory = Path.GetDirectoryName(filePath);
                Assembly assembly = Assembly.LoadFile(assemblyullName);

                AssemblyInfoLoader aInfo = new AssemblyInfoLoader(assembly);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write(filePath);

                Console.ForegroundColor = ConsoleColor.Green;
                if (aInfo.JitTrackingEnabled)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                Console.Write(" : Debug=");
                Console.Write(aInfo.JitTrackingEnabled);

                Console.ForegroundColor = ConsoleColor.Green;
                if (!aInfo.JitOptimized)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                Console.Write(" Optimized=");
                Console.WriteLine(aInfo.JitOptimized);

                Console.ForegroundColor = ConsoleColor.Green;
            }
            catch (Exception ex)
            {
                //if try to load win32 binary, then it will throw BadImageFormat exception...
                //which doesn't contain any HResult. So, just search for it.
                if (ex.Message.Contains(Resource.NotDotNetAssemblyErrorMessage) || ex.Message.Contains("0x80131018"))
                {
                    Console.WriteLine(string.Format(Resource.NotDotNetAssembly, filePath));
                }
                else
                {
                    Console.WriteLine(string.Format(Resource.LoadError, ex.Message));
                }
            }
        }
Example #2
0
        static void doFile(string filePath)
        {
            string assemblyullName = Path.GetFullPath(filePath);

            try
            {
                //required to change directory for loading referenced assemblies
                Environment.CurrentDirectory = Path.GetDirectoryName(filePath);
                Assembly assembly = Assembly.LoadFile(assemblyullName);

                AssemblyInfoLoader aInfo = new AssemblyInfoLoader(assembly);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write(filePath);

                Console.ForegroundColor = ConsoleColor.Green;
                if (aInfo.JitTrackingEnabled)
                    Console.ForegroundColor = ConsoleColor.Red;
                Console.Write(" : Debug=");
                Console.Write(aInfo.JitTrackingEnabled);

                Console.ForegroundColor = ConsoleColor.Green;
                if (!aInfo.JitOptimized)
                    Console.ForegroundColor = ConsoleColor.Red;
                Console.Write(" Optimized=");
                Console.WriteLine(aInfo.JitOptimized);

                Console.ForegroundColor = ConsoleColor.Green;
            }
            catch (Exception ex)
            {
                //if try to load win32 binary, then it will throw BadImageFormat exception...
                //which doesn't contain any HResult. So, just search for it.
                if (ex.Message.Contains(Resource.NotDotNetAssemblyErrorMessage) || ex.Message.Contains("0x80131018"))
                    Console.WriteLine(string.Format(Resource.NotDotNetAssembly, filePath));
                else
                    Console.WriteLine(string.Format(Resource.LoadError, ex.Message));
            }
        }