logic/parser/TableExcelExportCS.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;

namespace tablegen2.logic
{
    public class TableExcelExportCS
    {
        private static readonly string s_CodeDataTemplate = "\\CodeDataTemplate.txt";
        private static readonly string s_Timer = "__DATA_TABLE_CREATE_TIME__";
        private static readonly string s_NameSpace = "__DATA_TABLE_NAME_SPACE__";
        private static readonly string s_ClassName = "__DATA_TABLE_CLASS_NAME__";
        private static readonly string s_ClassDescription = " __DATA_TABLE_COMMENT__";
        private static readonly string s_TableProperty = "__DATA_TABLE_PROPERTIES__";
        private static readonly string s_TableParser = "__DATA_TABLE_PARSER__";
        private static readonly string s_Table = "\t";
        private static readonly string s_Space = "\r";

        private static StringBuilder ReadCodeTemplate()
        {
            string path =Util.WorkPath + s_CodeDataTemplate;

            if (!File.Exists(path))
            {
                throw new Exception($"config path '{path }' in not exists {s_CodeDataTemplate}file");
            }


            string[] data =  File.ReadAllLines(path);

            StringBuilder sb = new StringBuilder(); ;

            foreach (var str in data)
            {
                sb.Append(str);
                sb.AppendLine();
            }

            return sb;

        
        }
        public static void exportExcelFile(TableExcelData data, string filePath)
        {

            StringBuilder sb = ReadCodeTemplate();

            sb.Replace(s_Timer, DateTime.Now.ToString());
            sb.Replace(s_NameSpace, "App.DataTable");
            sb.Replace(s_ClassName, Path.GetFileName(filePath).Split('.')[0].Trim());
            sb.Replace(s_ClassDescription,"");
            sb.Replace(s_TableProperty, TableProperty(data));
            sb.Replace(s_TableParser, TableParser(data));

            // using (StreamWriter w = File.CreateText(filePath))
            // {
            //     for (int i = 0; i < str.Length; i++)
后面还有 80 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。