public static string CsTableKeyList(DefTable table, string varName) { return(string.Join(", ", table.IndexList.Select(idx => $"{varName}.{idx.IndexField.ConventionName}"))); }
public override string Render(DefTable c) { throw new NotImplementedException(); }
public static string CsTableUnionMapTypeName(DefTable table) { return($"Dictionary<({string.Join(", ", table.IndexList.Select(idx => CsDefineType(idx.Type)))}), {CsDefineType(table.ValueTType)}>"); }
public static async Task LoadTableAsync(IAgent agent, DefTable table, string dataDir, string patchName, string patchDataDir, string inputConvertDataDir) { var mainLoadTasks = new List <Task <List <Record> > >(); // 如果指定了 inputConvertDataDir, 则覆盖dataDir为 inputConvertDataDir // 同时 修改所有表的input为 table.FullName string finalDataDir; List <string> finalInputFiles; if (string.IsNullOrWhiteSpace(inputConvertDataDir)) { finalDataDir = dataDir; finalInputFiles = table.InputFiles; } else { finalDataDir = inputConvertDataDir; finalInputFiles = new List <string>() { table.FullName }; } var mainGenerateTask = GenerateLoadRecordFromFileTasksAsync(agent, table, finalDataDir, finalInputFiles, mainLoadTasks); var patchLoadTasks = new List <Task <List <Record> > >(); Task patchGenerateTask = null; if (!string.IsNullOrWhiteSpace(patchName)) { var patchInputFiles = table.GetPatchInputFiles(patchName); if (patchInputFiles != null) { patchGenerateTask = GenerateLoadRecordFromFileTasksAsync(agent, table, patchDataDir, patchInputFiles, patchLoadTasks); } } await mainGenerateTask; var mainRecords = new List <Record>(256); foreach (var task in mainLoadTasks) { mainRecords.AddRange(await task); } s_logger.Trace("== load main records. count:{count}", mainRecords.Count); List <Record> patchRecords = null; if (patchGenerateTask != null) { patchRecords = new List <Record>(64); await patchGenerateTask; foreach (var task in patchLoadTasks) { patchRecords.AddRange(await task); } s_logger.Trace("== load patch records. count:{count}", patchRecords.Count); } table.Assembly.AddDataTable(table, mainRecords, patchRecords); s_logger.Trace("table:{name} record num:{num}", table.FullName, mainRecords.Count); }