Пример #1
0
    static void Main(string[] args)
    {
#if GENERICS
        System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.Idle;
#endif

        TypeWriter writer = new TypeWriter(Console.Out);
        foreach (string s in args)
        {
            Assembly a = null;
            try {
                a = Assembly.LoadFrom(s);
                if (a == null)
                {
                    a = Assembly.Load(s);
                }
            }
            catch (Exception e) {
                Console.WriteLine(e);
            }
            if (a == null)
            {
                Console.WriteLine("TxRef: could not load assembly '{0}'.", s);
                return;
            }
            ArrayList l = new ArrayList();
            Type[]    types;
            try {
                types = a.GetTypes();
            }
            catch (ReflectionTypeLoadException re) {
                foreach (Exception e in re.LoaderExceptions)
                {
                    Console.WriteLine(e);
                }
                types = RemoveNulls(re.Types);
            }

            Array.Sort(types, new TypeComparer());

            foreach (Type t in types)
            {
                if (t.IsPublic)
                {
                    if (!l.Contains(t.Namespace))
                    {
                        l.Add(t.Namespace);
                    }
                }
            }

            l.Sort(null);

            foreach (string namespaceName in l)
            {
                writer.WriteNamespace(namespaceName, types);
            }
        }
    }