using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Reflection; using org.jfree.chart; namespace Ujihara.Demo { class Program { static void Main(string[] args) { List classNames = new List(); foreach (string name in args) classNames.Add(name); if (classNames.Count == 0) classNames = null; Assembly asm = Assembly.GetExecutingAssembly(); string dir = Path.GetDirectoryName(asm.Location); foreach (Type type in asm.GetTypes()) { if (classNames != null && !classNames.Contains(type.Name)) continue; if (type.IsClass && !type.IsAbstract && typeof(ChartCreator).IsAssignableFrom(type)) { Console.Write("Creating " + type.Name + " chart... "); try { ConstructorInfo ci = type.GetConstructor(Type.EmptyTypes); ChartCreator cc = (ChartCreator)ci.Invoke(new object[] { }); JFreeChart chart = cc.CreateChart(); String filename = Path.Combine(dir, type.Name) + ".png"; ChartUtilities.saveChartAsPNG(new FileInfo(filename), chart, 640, 480); Console.WriteLine("done."); } catch (Exception e) { Console.WriteLine(); Console.WriteLine(e.Message); } } } } } }