|
@@ -16,6 +16,7 @@ namespace GFGEditor
|
|
string[] files = Directory.GetFiles(ExcelConfig.excelsFolderPath);
|
|
string[] files = Directory.GetFiles(ExcelConfig.excelsFolderPath);
|
|
int totalCount = files.Length;
|
|
int totalCount = files.Length;
|
|
string strCfgArrayDispose = "";
|
|
string strCfgArrayDispose = "";
|
|
|
|
+ string strCfgArrayInit = "";
|
|
for (int i = 0; i < totalCount; i++)
|
|
for (int i = 0; i < totalCount; i++)
|
|
{
|
|
{
|
|
string filePath = files[i];
|
|
string filePath = files[i];
|
|
@@ -28,31 +29,43 @@ namespace GFGEditor
|
|
//IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
|
|
//IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
|
|
//DataSet result = excelReader.AsDataSet();
|
|
//DataSet result = excelReader.AsDataSet();
|
|
|
|
|
|
- HandleTableCollection(excelPackage.Workbook.Worksheets, rowCollectionHandler, out string dispose);
|
|
|
|
|
|
+ HandleTableCollection(excelPackage.Workbook.Worksheets, rowCollectionHandler, out string dispose, out string init);
|
|
strCfgArrayDispose = strCfgArrayDispose + dispose;
|
|
strCfgArrayDispose = strCfgArrayDispose + dispose;
|
|
|
|
+ strCfgArrayInit = strCfgArrayInit + init;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
string functionDispose = CodeTemplateFactory.FunctionDisposeTemplate;
|
|
string functionDispose = CodeTemplateFactory.FunctionDisposeTemplate;
|
|
functionDispose = functionDispose.Replace("{StrCfgArrayDispose}", strCfgArrayDispose);
|
|
functionDispose = functionDispose.Replace("{StrCfgArrayDispose}", strCfgArrayDispose);
|
|
string disposeAllCfgsCache = CodeTemplateFactory.DisposeAllCfgsCacheTemplate;
|
|
string disposeAllCfgsCache = CodeTemplateFactory.DisposeAllCfgsCacheTemplate;
|
|
disposeAllCfgsCache = disposeAllCfgsCache.Replace("{FunctionDispose}", functionDispose);
|
|
disposeAllCfgsCache = disposeAllCfgsCache.Replace("{FunctionDispose}", functionDispose);
|
|
- //创建管理类代码
|
|
|
|
- using (StreamWriter sw = new StreamWriter(ExcelConfig.configDataDisposePath + "DisposeAllCfgsCache.cs"))
|
|
|
|
|
|
+ using (StreamWriter sw = new StreamWriter(ExcelConfig.handleAllCfgsCache + "DisposeAllCfgsCache.cs"))
|
|
{
|
|
{
|
|
sw.Write(disposeAllCfgsCache);
|
|
sw.Write(disposeAllCfgsCache);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ string functionInit = CodeTemplateFactory.FunctionInitTemplate;
|
|
|
|
+ functionInit = functionInit.Replace("{StrCfgArrayInit}", strCfgArrayInit);
|
|
|
|
+ string initAllCfgsCache = CodeTemplateFactory.InitAllCfgsCacheTemplate;
|
|
|
|
+ initAllCfgsCache = initAllCfgsCache.Replace("{FunctionInit}", functionInit);
|
|
|
|
+ using (StreamWriter sw = new StreamWriter(ExcelConfig.handleAllCfgsCache + "InitAllCfgsCache.cs"))
|
|
|
|
+ {
|
|
|
|
+ sw.Write(initAllCfgsCache);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- private static void HandleTableCollection(ExcelWorksheets Worksheets, RowCollectionHandler rowCollectionHandler, out string strCfgArrayDispose)
|
|
|
|
|
|
+ private static void HandleTableCollection(ExcelWorksheets Worksheets, RowCollectionHandler rowCollectionHandler, out string strDispose, out string strInit)
|
|
{
|
|
{
|
|
- strCfgArrayDispose = "";
|
|
|
|
|
|
+ strDispose = "";
|
|
|
|
+ strInit = "";
|
|
for (int i = 1; i <= Worksheets.Count; i++)
|
|
for (int i = 1; i <= Worksheets.Count; i++)
|
|
{
|
|
{
|
|
ExcelWorksheet worksheet = Worksheets[i];
|
|
ExcelWorksheet worksheet = Worksheets[i];
|
|
string configArrayName = HandleTable(worksheet, rowCollectionHandler);
|
|
string configArrayName = HandleTable(worksheet, rowCollectionHandler);
|
|
if (string.IsNullOrEmpty(configArrayName)) continue;
|
|
if (string.IsNullOrEmpty(configArrayName)) continue;
|
|
string dispose = CodeTemplateFactory.StrCfgArrayDisposeTemplate.Replace("{configArrayName}", configArrayName);
|
|
string dispose = CodeTemplateFactory.StrCfgArrayDisposeTemplate.Replace("{configArrayName}", configArrayName);
|
|
- strCfgArrayDispose = strCfgArrayDispose + "\n" + dispose;
|
|
|
|
|
|
+ strDispose = strDispose + "\n" + dispose;
|
|
|
|
+ string init = CodeTemplateFactory.StrCfgArrayInitTemplate.Replace("{configArrayName}", configArrayName);
|
|
|
|
+ strInit = strInit + "\n" + init;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|