Esempio n. 1
0
        // Token: 0x06002364 RID: 9060 RVA: 0x000AD420 File Offset: 0x000AB620
        public static T PaddingData <T>(string csvName, int row) where T : new()
        {
            T        t        = Activator.CreateInstance <T>();
            object   obj      = t;
            CsvTable csvTable = CsvHelper.Get(csvName);

            if (csvTable == null)
            {
                return(t);
            }
            if (row < 0 || row > csvTable.RowCount)
            {
                return(t);
            }
            foreach (FieldInfo fieldInfo in typeof(T).GetFields())
            {
                string value = csvTable.Read(row, fieldInfo.Name);
                if (!string.IsNullOrEmpty(value))
                {
                    try
                    {
                        object value2 = Convert.ChangeType(value, fieldInfo.FieldType);
                        fieldInfo.SetValue(obj, value2);
                    }
                    catch (Exception ex)
                    {
                        Debug.LogErrorFormat("Csv padding data error! {0}", new object[]
                        {
                            ex
                        });
                    }
                }
            }
            return((T)((object)obj));
        }
Esempio n. 2
0
        // Token: 0x06002361 RID: 9057 RVA: 0x000AD3A4 File Offset: 0x000AB5A4
        public static CsvTable Create(string csvName, string data = "", bool resolveColumnName = true, bool firstColumnIsID = true)
        {
            CsvTable csvTable = new CsvTable(csvName, data, resolveColumnName, firstColumnIsID);

            CsvHelper.tableDict.Remove(csvName);
            CsvHelper.tableDict.Add(csvName, csvTable);
            return(csvTable);
        }
Esempio n. 3
0
        // Token: 0x06002363 RID: 9059 RVA: 0x000AD3F0 File Offset: 0x000AB5F0
        public static T PaddingData <T>(string csvName, string id) where T : new()
        {
            T        result   = Activator.CreateInstance <T>();
            CsvTable csvTable = CsvHelper.Get(csvName);

            if (csvTable == null)
            {
                return(result);
            }
            int rowByID = csvTable.GetRowByID(id);

            return(CsvHelper.PaddingData <T>(csvName, rowByID));
        }
Esempio n. 4
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="separator"></param>
 public static void Init(char separator = ',')
 {
     CsvTable.Init(separator);
 }
Esempio n. 5
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="separator"></param>
 public static void Init(char separator = CsvTable.DEFAULT_SEPARATOR)
 {
     CsvTable.Init(separator);
 }