private static void WriteOneClass(ClassFormation classFormation, string classDir) { DataInfo dataInfo; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Clear(); stringBuilder.AppendLine("using System.Collections.Generic;"); stringBuilder.AppendLine(string.Empty); if (!string.IsNullOrEmpty(classFormation.Notes)) { stringBuilder.AppendLine("/// </summary>"); stringBuilder.AppendLine("/// " + classFormation.Notes); stringBuilder.AppendLine("/// </summary>"); } stringBuilder.AppendLine(string.Format("public class {0} : ConfigBaseData", classFormation.ClassName)); stringBuilder.AppendLine("{"); for (int i = 0, length = classFormation.DataList.Count; i < length; i++) { dataInfo = classFormation.DataList[i]; stringBuilder.AppendLine(" /// <summary>"); stringBuilder.AppendLine(" /// " + dataInfo.desc); stringBuilder.AppendLine(" /// <summary>"); stringBuilder.AppendLine(GetFieldStr(dataInfo)); stringBuilder.AppendLine(string.Empty); } stringBuilder.AppendLine("}"); File.WriteAllText(classDir + classFormation.ClassName + ".cs", stringBuilder.ToString()); }
private static ClassFormation ReadSheet(SheetData sheetData) { ClassFormation classFormation = new ClassFormation(sheetData.SheetName, sheetData.Notes); string strContent; List <string[]> strContentList = sheetData.StrContentList; for (int i = 0; i < sheetData.ColumCount; i++) { strContent = strContentList[0][i]; if (!Util.IsEmptyTittle(strContent)) { DataInfo data = Util.CreateDataInfo(strContent, i, sheetData.SheetName); data.desc = strContentList[1][i]; classFormation.AddDataInfo(data); } } return(classFormation); }