p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "gacutil";
p.StartInfo.Arguments = "-l";
- p.Start ();
+ try {
+ p.Start ();
+ }
+ catch {
+ Console.WriteLine ("WARNING: gacutil could not be found.");
+ return new string[0];
+ }
string s;
ArrayList names = new ArrayList ();
return GetType (tname, false);
}
- static void PrintTypes (string assembly, bool show_private)
+ static void PrintRefs (string assembly)
+ {
+ Assembly a = GetAssembly (assembly, true);
+ foreach (AssemblyName an in a.GetReferencedAssemblies ())
+ Console.WriteLine (an);
+ }
+
+ static void PrintTypes (string assembly, bool show_private, bool filter_obsolete)
{
Assembly a = GetAssembly (assembly, true);
Type [] types = show_private ? a.GetTypes () : a.GetExportedTypes ();
Array.Sort (types, new TypeSorter ());
- foreach (Type t in types)
- Console.WriteLine (t.FullName);
+ int obsolete_count = 0;
+ foreach (Type t in types) {
+ if (filter_obsolete && t.IsDefined (typeof (ObsoleteAttribute), false))
+ obsolete_count ++;
+ else
+ Console.WriteLine (t.FullName);
+ }
- Console.WriteLine ("\nTotal: {0} types.", types.Length);
+ Console.WriteLine ("\nTotal: {0} types.", types.Length - obsolete_count);
}
internal static void Completion (string prefix)
assembly = options.AssemblyReference;
if (options.Type == null) {
- PrintTypes (assembly, options.ShowPrivate);
+ if (options.PrintRefs)
+ PrintRefs (assembly);
+ else
+ PrintTypes (assembly, options.ShowPrivate, options.FilterObsolete);
return;
}
}