Esempio n. 1
0
        private ClassMember GetMemberDeclare(ISheet sheet, int index)
        {
            IRow  partRow  = sheet.GetRow((int)E_DATA_ROW.PART);
            ICell partCell = partRow.GetCell(index);

            if (partCell == null)
            {
                return(null);
            }

            IRow attributeRow = sheet.GetRow((int)E_DATA_ROW.ATTRIBUTE);

            ICell attributeCell = attributeRow == null ? null : attributeRow.GetCell(index);
            IRow  typeRow       = sheet.GetRow((int)E_DATA_ROW.TYPE);
            ICell typeCell      = typeRow.GetCell(index);
            IRow  columnRow     = sheet.GetRow((int)E_DATA_ROW.NAME) ?? throw new ArgumentNullException("sheet.GetRow((int) E_DATA_ROW.NAME)");
            ICell columnCell    = columnRow.GetCell(index);

            string name = columnCell.StringOrNull();
            string type = typeCell.StringOrNull();

            string attribute = string.Empty;

            if (attributeCell != null)
            {
                attribute = attributeCell.StringOrNull();
            }

            E_PART part = (E_PART)Enum.Parse(typeof(E_PART), partCell.StringCellValue);

            return(ClassMember.GenClassMember(part, attribute, type, name));
        }
Esempio n. 2
0
        private ClassDeclare GetClaassDeclare(ISheet sheet)
        {
            ClassDeclare ret = new ClassDeclare {
                name = sheet.SheetName
            };
            List <ClassMember> lst = new List <ClassMember>();
            int max = this.GetColumnMax(sheet);

            for (int i = 0; i < max; ++i)
            {
                ClassMember item = this.GetMemberDeclare(sheet, i);
                if (item != null)
                {
                    lst.Add(item);
                }
            }

            ret.class_members = lst.ToArray();
            return(ret);
        }