public void GenRecordCode(string directory, Record record) { string subdir = directory; if (record.Category != null) { subdir = Path.Combine(directory, record.Category); if (!Directory.Exists(subdir)) { Directory.CreateDirectory(subdir); } } string nsName = NamespaceName + "." + Path.GetDirectoryName(record.Category); Namespace ns = new Namespace(nsName); Class cs = ExcelRecord.BuildClass(ns, record, AllRecords); if (cs != null) { string file = Path.Combine(subdir, record.Name + ".cs"); CodeWriter writer = new CodeWriter(file); ns.AddClass(cs); ns.Output(writer); writer.Close(); } }