public void WriteOutPut(String path, HcSubInfo info) { var requestPath = path + @"\Android\src\com\xl\frame\requester\" + info.Name; DirectoryInfo newFolder = null; if (!Directory.Exists(requestPath)) { Directory.CreateDirectory(requestPath); } newFolder = new DirectoryInfo(requestPath); foreach (var service in info.ServiceArray) { createRequester(newFolder.FullName, service, info.Name); } var outEntityPath = path + @"\Android\src\com\xl\frame\entity"; if (!Directory.Exists(outEntityPath)) { Directory.CreateDirectory(outEntityPath); } newFolder = new DirectoryInfo(outEntityPath); foreach (var service in info.ServiceArray) { createOutEntity(newFolder.FullName, service); } if (info.DTOArray != null) { foreach (var dto in info.DTOArray) { writeDTO(newFolder, dto); } } }
private void ReadInputDirectory(DirectoryInfo folder, Dictionary<String, HcSubInfo> dic) { //遍历文件夹 foreach (DirectoryInfo nextFolder in folder.GetDirectories()) { ReadInputDirectory(nextFolder, dic); } //遍历文件 foreach (FileInfo nextFile in folder.GetFiles()) { if (nextFile.Extension.Equals("." + Constants.FileExtension)) { if (nextFile.Name.Length > Constants.DTOFileFistName.Length && nextFile.Name.Substring(0, Constants.DTOFileFistName.Length).Equals(Constants.DTOFileFistName)) { var dtoInfo = convertFromDTOExcel(nextFile); var name = nextFile.Name.Replace(Constants.DTOFileFistName, string.Empty).Replace("(", string.Empty).Replace(")", string.Empty).Replace("." + Constants.FileExtension, string.Empty); if (dic.ContainsKey(name)) { dic[name].DTOArray = dtoInfo; } else { var subInfo = new HcSubInfo(); subInfo.Name = name; subInfo.DTOArray = dtoInfo; dic.Add(subInfo.Name, subInfo); } } } } }
private HcSubInfo convertFromServiceExcel(FileInfo nextFile) { var subInfo = new HcSubInfo(); ExcelOptions.GetExcelData(nextFile.FullName, s => setSubInfo(s, subInfo)); return subInfo; }
public void WriteOutPut(String path, HcSubInfo info) { string servicePath; servicePath = path + @"\Service\" + Constants.Package + @".main.service"; servicePath = servicePath + @"\src\" + Constants.Package.Replace(@".", @"\") + @"\main\service\" + info.Name.ToLower(); if (Directory.Exists(servicePath)) { Directory.Delete(servicePath, true); } servicePath = servicePath + @"\dto"; var newFolder = Directory.CreateDirectory(servicePath); foreach (var service in info.ServiceArray) { creatInDTO(newFolder, service, info.Name.ToLower()); createOutDTO(newFolder, service, info.Name.ToLower()); createServiceInteface(newFolder.Parent, service, info.Name.ToLower()); } string bizPath; bizPath = String.Format(@"{0}\Service\" + Constants.Package + @".main.biz\src\" + Constants.Package.Replace(@".", @"\") + @"\main\biz\" + info.Name.ToLower() + @"\dto", path); if (info.DTOArray != null) { foreach (var dto in info.DTOArray) { writeDTO(bizPath, dto, info.Name.ToLower()); } } }
public void WriteOutPut(String path, HcSubInfo info) { path = path + @"\IOS\" + info.Name; if (Directory.Exists(path)) { Directory.Delete(path, true); } var newFolder = Directory.CreateDirectory(path); foreach (var service in info.ServiceArray) { createModel(newFolder, service); } if (info.DTOArray != null) { foreach (var dto in info.DTOArray) { writeDTO(newFolder, dto); } } }
private void setSubInfo(Worksheet sheet, HcSubInfo subInfo) { var name = sheet.Name; if (name.Length > Constants.ServiceFirstName.Length && name.Substring(0, Constants.ServiceFirstName.Length).Equals(Constants.ServiceFirstName)) { if (subInfo.ServiceArray == null) { subInfo.ServiceArray = new List<HcServiceInfo>(); } var serviceInfo = new HcServiceInfo(); Range range = null; if (string.IsNullOrEmpty(subInfo.Name)) { range = (Range)sheet.Cells[3, 9]; subInfo.Name = range.Value.ToString(); } serviceInfo.ModelID = subInfo.Name; range = (Range)sheet.Cells[4, 9]; serviceInfo.Caption = range.Value.ToString(); range = (Range)sheet.Cells[5, 9]; serviceInfo.Name = range.Value.ToString(); range = (Range)sheet.Cells[9, 2]; serviceInfo.Summary = range.Value.ToString(); range = (Range)sheet.Cells[3, 40]; string type = range.Value.ToString(); switch (type) { case "Read": serviceInfo.ServiceType = Type.EmServiceType.Read; break; case "Update": serviceInfo.ServiceType = Type.EmServiceType.Update; break; default: break; } var irow = 20; setInDTO(sheet, serviceInfo, ref irow); setOutDTO(sheet, serviceInfo, ref irow); setInDTOCheck(sheet, serviceInfo, irow); subInfo.ServiceArray.Add(serviceInfo); } }