CsServer/Server/Git/XlsxToJson.cs

48 lines
1.3 KiB
C#

using Newtonsoft.Json;
using System.Collections.Generic;
using System.IO;
namespace Server.Git
{
public class XlsxToJson : AbstractGit
{
public override void ChangeScript()
{
//저장경로 : repositoryPath
//작업할것
//데이터 db에 업로드
//json화된 데이터 push
List<string> fileList = GetFiles(repositoryPath, ".xlsx");
Dictionary<string, Dictionary<long, Dictionary<string, object>>> sheetList = new Dictionary<string, Dictionary<long, Dictionary<string, object>>>();
for (int n = 0; n < fileList.Count; n++)
{
ExcelManager em = new ExcelManager(fileList[n]);
if (em.Play())
{
List<ExcelManager.sheet> sheets = em.sheets;
for (int m = 0; m < sheets.Count; m++)
{
sheetList.Add(sheets[m].name, sheets[m].dicViewer);
}
}
else
{
Console.WriteLine("-1 : NotUpdate");
return;
}
}
excel = JsonConvert.SerializeObject(sheetList);
//db에 데이터를올리는것은 이곳에 작성할 예정
}
}
}