public LogMsgData[] IsValid(DataSheetInfo sInfo, int index)
        {
            List <LogMsgData> result = new List <LogMsgData>();
            DataFieldInfo     dfi    = sInfo.GetFieldInfo(index);
            int len = 0;

            if (!int.TryParse(dfi.validationValue, out len))
            {
                return(null);
            }
            int count = sInfo.GetContentCount();

            for (int i = 0; i < count; i++)
            {
                object data = sInfo.GetContentValue(i, index);
                if (data != null && (dfi.type == DataFieldType.Int || dfi.type == DataFieldType.Float || dfi.type == DataFieldType.Double || dfi.type == DataFieldType.Long))
                {
                }
            }

            if (result.Count > 0)
            {
                return(result.ToArray());
            }
            else
            {
                return(null);
            }
        }
        public LogMsgData[] IsValid(DataSheetInfo sInfo, int index)
        {
            List <LogMsgData> result = new List <LogMsgData>();
            DataFieldInfo     dfi    = sInfo.GetFieldInfo(index);
            int len = 0;

            if (!int.TryParse(dfi.validationValue, out len))
            {
                return(null);
            }
            int count = sInfo.GetContentCount();

            for (int i = 0; i < count; i++)
            {
                object data = sInfo.GetContentValue(i, index);
                if (data != null && (dfi.type == DataFieldType.String || dfi.type == DataFieldType.Stringt || dfi.type == DataFieldType.Res))
                {
                    string value = (string)data;
                    if (value.Length > len)
                    {
                        result.Add(new ErrorLogData3(LogConst.E_DataValidation_StrLen, "" + index, "" + len, value));
                    }
                }
            }

            if (result.Count > 0)
            {
                return(result.ToArray());
            }
            else
            {
                return(null);
            }
        }
        public LogMsgData[] IsValid(DataSheetInfo sInfo, int index)
        {
            List <LogMsgData> result = new List <LogMsgData>();
            DataFieldInfo     dfi    = sInfo.GetFieldInfo(index);
            int count = sInfo.GetContentCount();
            Dictionary <string, bool> cacheData = new Dictionary <string, bool>();

            for (int i = 0; i < count; i++)
            {
                object data = sInfo.GetContentValue(i, index);
                if (data == null)
                {
                    result.Add(new ErrorLogData1(LogConst.E_DataValidation_Null, "" + index));
                }
            }

            if (result.Count > 0)
            {
                return(result.ToArray());
            }
            else
            {
                return(null);
            }
        }
Example #4
0
        public DataToOptimizeLuaExporter(DataSheetInfo sheet, DataExportConfig config)
        {
            dataSheet    = sheet;
            exportConfig = config;

            CreateSummary();
        }
        public LogMsgData[] IsValid(DataSheetInfo sInfo, int index)
        {
            List <LogMsgData> result = new List <LogMsgData>();
            DataFieldInfo     dfi    = sInfo.GetFieldInfo(index);
            int count = sInfo.GetContentCount();
            Dictionary <string, bool> cacheData = new Dictionary <string, bool>();

            for (int i = 0; i < count; i++)
            {
                object data = sInfo.GetContentValue(i, index);
                if (data != null)
                {
                    string validaStr = null;
                    if (dfi.type == DataFieldType.Dic)
                    {
                        Dictionary <string, string> dicData = (Dictionary <string, string>)data;
                        List <string> tempStrs = new List <string>();
                        foreach (KeyValuePair <string, string> kvp in dicData)
                        {
                            string t = kvp.Key + ":" + (kvp.Value == null ? "null" : kvp.Value);
                            tempStrs.Add(t);
                        }
                        tempStrs.Sort();
                        validaStr = string.Join(",", tempStrs.ToArray());
                    }
                    else if (dfi.type == DataFieldType.Array)
                    {
                        List <string> arrData = (List <string>)data;
                        arrData.Sort();
                        validaStr = string.Join(",", arrData.ToArray());
                    }
                    else
                    {
                        validaStr = (string)data;
                    }
                    if (cacheData.ContainsKey(validaStr))
                    {
                        result.Add(new ErrorLogData2(LogConst.E_DataValidation_Repeat, "" + index, validaStr));
                    }
                    else
                    {
                        cacheData.Add(validaStr, true);
                    }
                }
            }
            if (result.Count > 0)
            {
                return(result.ToArray());
            }
            else
            {
                return(null);
            }
        }
Example #6
0
        public List <DataSheetInfo> ConvertToDataSheet()
        {
            List <DataSheetInfo> result = new List <DataSheetInfo>();

            foreach (KeyValuePair <string, WorkSheet> kvp in sheets)
            {
                logMsgMgr.Add(new InfoLogData1(LogConst.I_WorkToData_Start, kvp.Value.Name));
                logMsgMgr.Indent++;
                DataSheetInfo dSheet = new DataSheetInfo();
                if (dSheet.ReadFromWorkSheet(kvp.Value))
                {
                    result.Add(dSheet);
                }
                logMsgMgr.Indent--;
                logMsgMgr.Add(new InfoLogData(LogConst.I_WorkToData_End));
                logMsgMgr.Add(new EmptyLogData());
            }
            return(result);
        }
 public LogMsgData[] IsValid(DataSheetInfo sInfo, int index)
 {
     throw new NotImplementedException();
 }