public static Class BuildClass(Namespace ns, Record record, Dictionary<string, Record> AllRecords)
 {
     ns.Usings.Add("System.IO");
     if (record.Fields.Exists(delegate(RecordField member)
     {
         return member.Type.StartsWith("FastSearchList<");
     }))
     {
         ns.Usings.Add("QiHe.CodeLib");
     }
     if (record.IsAbstract)
     {
         return BuildBaseClass(record, AllRecords);
     }
     else
     {
         return BuildClass(record, AllRecords);
     }
 }
 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();
     }
 }