Ejemplo n.º 1
0
    public static int PrinterAssemblyInPlace(string assemblyFileFullPath)
    {
        AssemPrinter test = new AssemPrinter();

        test.ConnectEvent();

        try
        {
            string OutputFile = assemblyFileFullPath + ".txt";
            test.sw = File.CreateText(OutputFile);
            Console.WriteLine("Created Text:" + OutputFile);
            test.CurrentAssembly = Assembly.ReflectionOnlyLoadFrom(assemblyFileFullPath);
            test.PrintAssembly(test.CurrentAssembly);
        }
        catch (Exception e)
        {
            if (e is ReflectionTypeLoadException)
            {
                ReflectionTypeLoadException rtle = (ReflectionTypeLoadException)e;
                string msg = e.Message + "\n";
                foreach (Exception ex in rtle.LoaderExceptions)
                {
                    msg += "=> " + ex.Message + "\n";
                    if (ex.InnerException != null)
                    {
                        msg += "=> Inner => " + ex.InnerException.GetType().ToString() + " - " + ex.InnerException.Message;
                    }
                }

                test.ReportFailure(msg);
            }
            else
            {
                test.ReportFailure(e.ToString());
            }
        }
        finally
        {
            test.sw.Close();
        }
        return(test.ExitTest());
    }
Ejemplo n.º 2
0
    public static int PrinterAssemblyInPlace(string assemblyFileFullPath)
    {
        AssemPrinter test = new AssemPrinter();

        test.ConnectEvent();

        try
        {
            string OutputFile = assemblyFileFullPath + ".txt";
            test.sw = File.CreateText(OutputFile);
            Console.WriteLine("Created Text:" + OutputFile);
            test.CurrentAssembly = Assembly.ReflectionOnlyLoadFrom(assemblyFileFullPath);
            test.PrintAssembly(test.CurrentAssembly);
        }
        catch (Exception e)
        {
            if (e is ReflectionTypeLoadException)
            {
                ReflectionTypeLoadException rtle = (ReflectionTypeLoadException) e;
                string msg = e.Message + "\n";
                foreach(Exception ex in rtle.LoaderExceptions)
                {
                                    msg += "=> " + ex.Message + "\n";
                    if (ex.InnerException != null)
                        msg += "=> Inner => " + ex.InnerException.GetType().ToString() + " - " + ex.InnerException.Message;
                }

                            test.ReportFailure(msg);
            }
            else
                test.ReportFailure(e.ToString());
        }
        finally
        {
            test.sw.Close();
        }
        return test.ExitTest();
    }
Ejemplo n.º 3
0
 public int Run(String assemblyFileFullPath)
 {
     return(AssemPrinter.PrinterAssemblyInPlace(assemblyFileFullPath));
 }